Skip to content

Write three constraints from scratch, each with its own name

write-from-scratch

Each constraint block is a class member and needs its own name: two blocks with the same name are a redefinition error, not one combined constraint. A range needs inside; pinning a field to one value needs == (= isn’t a constraint operator).

Fix the class below.

RequirementsEach in its own named constraint block

  1. priority_lo stays in [0:3].
  2. priority_hi stays in [4:7].
  3. mode always equals 2’b01.

Source on GitHub

sv_constraint_chain.sv