M
Mark
Guest
One syntax I've favored in verilog for compactness (and to see that
all variable conditions are covered) is to express logic in a truth
table as:
casez( {a,b,c} )
3'b000: z <= ...
3'b001: z <= ...
I'm trying to use a similar style in VHDL, and am wondering if there
is an elegant way to do this. My first attempt was:
case a & b & c is
when "000" => z <= ...
when "001" => z <= ..
With the error, "Ambiguous type in infix expression; unsigned or
signed."
OK. Strong typing... doesn't know what type the concatenation should
resolve to... so I write:
case std_logic_vector'(a & b & c) is
when "000" => z <= ...
when "001" => z <= ..
I get the model sim warning "Array type case expression must be of a
locally static subtype."
I could assign the concatenation first to a variable (verbose), or I
could disabled the warning in modelsim (but it does seem to be a valid
violation of the VHDL language), but does anyone have a suggestion on
how to write this in both a terse and correct way?
Thanks,
Mark
all variable conditions are covered) is to express logic in a truth
table as:
casez( {a,b,c} )
3'b000: z <= ...
3'b001: z <= ...
I'm trying to use a similar style in VHDL, and am wondering if there
is an elegant way to do this. My first attempt was:
case a & b & c is
when "000" => z <= ...
when "001" => z <= ..
With the error, "Ambiguous type in infix expression; unsigned or
signed."
OK. Strong typing... doesn't know what type the concatenation should
resolve to... so I write:
case std_logic_vector'(a & b & c) is
when "000" => z <= ...
when "001" => z <= ..
I get the model sim warning "Array type case expression must be of a
locally static subtype."
I could assign the concatenation first to a variable (verbose), or I
could disabled the warning in modelsim (but it does seem to be a valid
violation of the VHDL language), but does anyone have a suggestion on
how to write this in both a terse and correct way?
Thanks,
Mark