Verilog Case : don't care

Guest #2907697
Hi!
simple question
can I use this kind of syntax into verilog :
1
 case(Fetched[24:4])
2
                21'bzzzzzzzzzzzzzzzzzzzz0 :nextstate <= ADD;
3
                21'bzzzzzzzzzzzzzzzzz0zz1 :nextstate <= ADD;
4
                21'b000zzzzzzzzzzzzzz1001 :nextstate <= MUL; //mult
5
                21'b01zzzzzzzzzzzzzzz1001 :nextstate <= MUL;
6
                21'b10z00zzzzzzzz00001001 :nextstate <= MUL;
7
                21'b10z00zzzzzzzz00001001 :nextstate <= SDS;
8
                21'b100101111111111110001 :nextstate <= BAE;
9
                  default: nextstate <= UNKNOW; //should not happens
10
              endcase

I have no error while simulating but have strange result
(I'm student working on sim vision)

thanks all :)
Guest #2907962
'z' ist not don't care, it stands for high impedance, a clearly defined 
state, at least for the simulator.
#2909804
Lattice User wrote:
> 'z' ist not don't care, it stands for high impedance, a clearly defined
> state, at least for the simulator.

It is actually casez that is preferable here. Specifically for this 
reason Verilog defines '?' as synonym for 'z'. With casex you wouldn't 
be able to distinguish unknowns and dont-cares since both use the same 
symbol.

Kind regards
Marcus
Guest #2909882
Marcus Harnisch wrote:
> It is actually casez that is preferable here. Specifically for this
> reason Verilog defines '?' as synonym for 'z'. With casex you wouldn't
> be able to distinguish unknowns and dont-cares since both use the same
> symbol.

You are right, see IEEE Std 1364-2001 Chapter 9.5.1
To make the intent more vissible i suggest using casez with '?'.

(Sometimes i have to ask what standard writer are smoking)

Reply

A question of your own? This thread is over 14 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.