verilog if else to casex

Guest
Please see the attached file.
That is what i think , i dont know the correct use of casex statement 
and the parameters to be given inside casex()
please help me out
Attached files:
Guest
1
reg A, B, C, D, E, F, G, H;
2
always@(*)
3
casex({A,B,C})
4
  3'b1xx:H = F & G;
5
  3'b01x:H = F | G;
6
  3'b001:H = F ^ G;
7
  3'b000:H = D & E;

think in sets.
The first if only concerns the A, the others don't matter.
the second if is inside the else clause to the first if so A==0 and 
B==1. c
does not matter. the third if is in the else clause to the previous 
statements, so A==0 B==0 and C==1. the last else selects the only 
leftover condition. A==0 B==0 C==0.

    A  B  C
    0  0  0  ->what's left for the else
    0  0  1  ->third if
    0  1  0  \->second if
    0  1  1  /
    1  0  0  \
    1  0  1   |
    1  1  0   |->first if
    1  1  1  /

Reply

A question of your own? This thread is over 9 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.