Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concatenating bits in VHDL

How do you concatenate bits in VHDL? I'm trying to use the following code:

Case b0 & b1 & b2 & b3 is ...

and it throws an error

Thanks

like image 627
Zain Rizvi Avatar asked Oct 16 '08 17:10

Zain Rizvi


2 Answers

The concatenation operator '&' is allowed on the right side of the signal assignment operator '<=', only

like image 165
user21246 Avatar answered Sep 26 '22 18:09

user21246


You are not allowed to use the concatenation operator with the case statement. One possible solution is to use a variable within the process:

process(b0,b1,b2,b3)
   variable bcat : std_logic_vector(0 to 3);
begin
   bcat := b0 & b1 & b2 & b3;
   case bcat is
      when "0000" => x <= 1;
      when others => x <= 2;
   end case;
end process;
like image 27
Justin Avatar answered Sep 24 '22 18:09

Justin