I have the following type definitions
subtype msgBlock_t is std_logic_vector((Z-1) downto 0);
subtype msgBlock_u_t is unsigned((Z-1) downto 0);
type msgBlocks_t is array((K_B-1) downto 0) of msgBlock_t;
type msgBlocks_u_t is array((K_B-1) downto 0) of msgBlock_u_t;
signal shMsgBlocks_u: msgBlocks_u_t;
signal shMsgBlocks: msgBlocks_t;
I tried to convert the unsigned vector into a std_logic_vector using
shMsgBlocks = msgBlocks_t(shMsgBlocks_u);
but it doesn't work so now I'm using
c_g: for i in 0 to K_B-1 generate
c_g_i: shMsgBlocks(i) <= std_logic_vector(shMsgBlocks_u(i));
end generate c_g;
but when I do a XOR operation:
xor_L1: for i in 0 to (K_B/2)-1 generate
xor_L1_i: out_xor_L1 <= shMsgBlocks(2*i) xor shMsgBlocks(2*i+1);
end generate xor_L1;
the following error appears Error (10327): VHDL error at lambda.vhd(112): can't determine definition of operator ""xor"" -- found 0 possible definitions I know that std_logic_vector has to be used for memories/registers, while the unsigned type for binary numbers without sign. I need to use the unsigned type in my circuit because of the rol (rotate left) function. I cannot avoid to mix the two types. What is better to do in these cases ?
链接已复制
6 回复数
The xor operation works properly between std_logic_vector or unsigned vectors.
I need an array of unsigned vectors, that's why I'm using the subtype. I replaced all std_logic_vector declarations with unsigned ones and now it works. Thank you so much guys.Now it compiles. The problem is that I have a very long vector as input (unsigned(323 downto 0)) and so the Fitter gave me an error because there are not enough pins. Can I store this vector in a pre-initiliazed register ? Or is there something else I can do to avoid this problem?
