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.

Questions about how to use casex in Verilog

Status
Not open for further replies.

billylee

Junior Member level 1
Joined
Sep 10, 2009
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Korea
Activity points
1,390
The following is an example of the casex statement
is this code ambiguous? Thank you!

always @(*) begin
casex (SumMsbSat1[16:13])
4'b0000 : SumMsbSat3 = SumMsbSat1[13:0];
4'b1111 : SumMsbSat3 = SumMsbSat1[13:0];
4'b0xxx : SumMsbSat3 = {1'b0, {13{1'b1}}};
4'b1xxx : SumMsbSat3 = {1'b1, {13{1'b0}}};
default : SumMsbSat3 = SumMsbSat1[13:0];
endcase
end
 

Case statement is prioritized so that it looks fine to me, though you don't need default in this case.
 

thank you for your reply :)
also my coworker agree with you!

and Merry christmas~!
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top