Altera_Forum
Honored Contributor
10 years agoExpression has 8 elements, but must have 9 elements, and also, else null
Hi,
I have this variable, X, which is an std_logic_vector(8 downto 0). I have inputs A,B,C which are std_logic_vector(7 downto 0). Also, a signal D which is also std_logic_vector(7 downto 0). I also have a signal Z which is std_logic_vector(7 downto 0). I need to add all the inputs and the signal into X and invert, so:X := not(A+B+C+D); At the end, I need to take the lower byte of X, so: Z <= (X'length-2 downto 0); I am getting an error with the X variable, but I'm not sure why. I understand that they both have different sizes, but when adding all these inputs/signals, it is very possible that due to the addition X will grow to 9 bits (maybe even more, thinking about it). Anyway to solve this problem? And a completely unrelated question... if I do something like: if (condition) then
do something;
else null; Does it make the design more efficient/better or is it redundant and it's best to not use an else at all and just end the if statement? Thanks!