Skip to content

Write three inside constraints from scratch, three different set shapes

write-from-scratch

inside takes a set in braces, and the set can take three shapes:

a list of values            -- x inside {1, 2, 3}
a range mixed with values   -- x inside {[10:20], 255}
a range with variable ends  -- x inside {[lo:hi]}

Fix the class below.

RequirementsOn every randomize() call

  1. mode is exactly one of 0, 2, 4 or 8.
  2. address is between 10 and 20 inclusive, or exactly 255.
  3. val is between low_bound and high_bound inclusive, using those two variables, not the numbers they currently hold.

Source on GitHub

inside_operator_variants.sv