SystemVerilog:: Unique and Priority

来源:互联网 发布:cdrx4软件下载 编辑:程序博客网 时间:2024/05/22 03:06

http://www.doulos.com/knowhow/sysverilog/tutorial/rtl/


Unique and Priority

Another common mistake in RTL Verilog is the misuse of the parallel_case and full_case pragmas. The problems arises because these are ignored as comments by simulators, but they are used to direct synthesis. SystemVerilog addresses this with two new keywords: priority andunique.
Unlike the pragmas, these keywords apply to if statements as well as case statements. Each imposes specific simulation behaviour that is readily mapped to synthesised hardware. unique enforces completeness and uniqueness of the conditional; in other words, exactly one branch of the conditional should be taken at run-time. If the specific conditions that pertain at run-time would allow more than one branch of the conditional, or no branch at all, to be taken, there is a run-time error. For example, it is acceptable for the selectors in a case statement to overlap, but if that overlap condition is detected at runtime then it is an error. Similarly it is okay to have a unique case statement with no default branch, or an if statement with no else branch, but at run time the simulator will check that some branch is indeed taken. Synthesis tools can use this information, rather as they might a full_case directive, to infer that no latches should be created.
priority enforces a somewhat less rigorous set of checks, checking only that at least one branch of the conditional is taken. It therefore allows the possibility that more than one branch of the conditional could be taken at run-time. It licenses synthesis to create more extravagant priority logic in such a situation.
原创粉丝点击