In previous post, we discussed how to detect x-related issues. However, designers should pay attention to their coding style, to minimize or eliminate these issues. The most important aspect, is the difference among “casex”, “casez” and “case-inside”.
“Casex” uses “x”, “?” and “z” to represent don’t-care in case items, and matches “x” with anything in case expression. Matching “x” with anything is super dangerous, and it may lead to unintended x-propagation issues, thus “casex” statement should be avoided.
“Casez” uses “?” and “z” to represent don’t-care in case items, and matches “z” with anything in case expression. Compared to “casex”, it is less dangerous, therefore designers should favor the use of “casez” over “casex”.
“Case-inside” uses “x”, “?” and “z” to represent don’t-care in case items, but it does not match “z” and “x” with anything in case expression. Obviously, “case-inside” statement is less error prone. However, our past experiences told us that, “case-inside” statement will block x-propagation in VCS, making it less attractive in RTL design.
Don Mills from Microchip Technology, published a paper “Yet Another Latch and Gotchas Paper”, to further discuss this issue. We highly recommend interviewees to read this paper.
Leave a Reply