Jump to content

Sft constraint vs weighted constraint

Recommended Posts


We use the below constraint wrt "unaligned_transfer".



  constraint axi_narrow_unaligned_c {
        unaligned_transfer dist {1'b0 := 10 , 1'b1 := 90};
        soft unaligned_addr_offset == 'h0;
        solve unaligned_transfer before unaligned_addr_offset;
        (unaligned_transfer == 1'b1) -> unaligned_addr_offset inside {'h1,'h2,'h3};



There is a soft value = 0, provided for unaligned_addr_offset, and a weighted distribution allowed for  unaligned_transfer


What we observe is that the simulator always select "unaligned_transfer" = 0. Looks like its trying to prioritise the soft constraint. Is this expected?


Could you someone please point the LRM section where I can try to understand the expected simulator behaviour here?




Link to comment
Share on other sites

Section 18.5.14 of the 2017 LRM says "when there is no solution that satisfies all active hard constraints (if any) simultaneously with a constraint defined as soft, the solver shall discard that soft constraint and find a solution that satisfies the remaining constraints".  In this case, there is a solution that satisfies all the constraints, unaligned_transfer == 0.  I am guessing you hoped that the "solve..before" would mean unaligned_transfer was first chosen sometimes to be 1, thus making the soft constraint not satisfiable.  However, 18.5.10 states "solve..before" does not change legal sets, just distributions within the legal set: "Adding this order constraint does not change the set of legal value combinations, but alters their probability of occurrence"

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...