Priority keyword of System Verilog

fragnen

Full Member level 4
Joined
Apr 3, 2019
Messages
211
Helped
0
Reputation
0
Reaction score
1
Trophy points
18
Activity points
1,490
Do the priority keyword of System Verilog make an incomplete case statement behave as a full case?
 

The priority and unique keywords before a SystemVerilog case statement do not change the execution behavior of the case statement. However, they do provide violation errors if the statement is coded in such a way that no branch is taken. This helps ensure what gets simulated matches the functionality of what is synthesized.
 

    fragnen

    Points: 2
    Helpful Answer Positive Rating

Does it mean we should use both priority and full_case pragma together for a case statement where the case statement is incomplete I.e. a few branches are not taken?
 

Hello dave_59,

Can you please reply to the query asked at post number 5 in this thread? Thanks in advance.
 

According to this paper priority behaves like a full_case. That means priority makes a case statement whose all case items are not defined to behave like a full case. Is not it?
The paper is misleading to say that priority modifies the behavior of the case statement for simulation. What it does is add an assertion so that if your intention was to interpret it as full_case, but you missed a case item, you would get an error and nothing gets executed. Synthesis treats a missing case item in a full_case as a don't care, and you get whatever logic it most optimal to implement.
 

The paper is misleading to say that priority modifies the behavior of the case statement for simulation.
Do you want to mean that then the priority modifies the behavior of the case statement for synthesis only?
 

If adding an assertion is considered "modified" behavior of the priority case, then you could consider both simulation and synthesis behaviors are modified. Priority adds an assertion for simulation, and adds full_case for synthesis.
 

The final answer is now being taken as below:

Priority adds an assertion for simulation, and adds full_case for synthesis. Here Priority adds full_case for synthesis means that synthesis treats a missing case item in a full_case as a don't care, and in the synthesis log file also we see that there were missing case items for that particular case statement.

Please confirm about the correctness of the final answer.

Regards
 

dave_59,

Can you please confirm about the correctness of the final answer in post no 10 in this thread?
 

Cookies are required to use this site. You must accept them to continue using the site. Learn more…