Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Why is casez preferred than others?

Status
Not open for further replies.

stanford

Full Member level 2
Joined
Feb 16, 2014
Messages
132
Helped
4
Reputation
8
Reaction score
6
Trophy points
1,298
Activity points
2,223
I heard using 'casez' synthesizes into smaller hardware and casex could mask signals that are not initialized properly. Is this why casez is preferred over others?
 

x and z values as logic input only occur in simulation, never in hardware. Respectively the usage of casex and casez is a question of appropriate hardware simulation and if used in RTL code, of avoiding simulation mismatch.
 

x and z values as logic input only occur in simulation, never in hardware. Respectively the usage of casex and casez is a question of appropriate hardware simulation and if used in RTL code, of avoiding simulation mismatch.

Why do we use casez over case? case statement seems to be the safest way to match the conditions exactly.
 

casez also provides a compact and descriptive way to specify don't care bits in RTL code.
 

casez also provides a compact and descriptive way to specify don't care bits in RTL code.

My question is why would you want to use don't care over matching the conditions exactly, if this is just for simulation? Brute force matching (case) seems safer for validation.
 

My question is why would you want to use don't care over matching the conditions exactly, if this is just for simulation? Brute force matching (case) seems safer for validation.
Because the Don't Care syntax is easier to read showing your intent rather than listing all the matching conditions, and less prone for mistakes. This is independent of simulation or synthesis
 

My question is why would you want to use don't care over matching the conditions exactly, if this is just for simulation? Brute force matching (case) seems safer for validation.

One example of casez is to code a priority encoder (or servicing multiple interrupts based on priority). It makes easier to write the code, instead of writing multiple conditions using case statement.


casez ( intr [31:0])
32'b1zzzzzzz_zzzzzzzz_zzzzzzzz_zzzzzzzz : --------
32'b01zzzzzz_zzzzzzzz_zzzzzzzz_zzzzzzzz : --------
32'b001zzzzz_zzzzzzzz_zzzzzzzz_zzzzzzzz : --------
-------------
32'b00000000_00000000_00000000_00000001 : --------
--
endcase
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top