M
Matthias Alles
Guest
Hi!
I have a question regarding the following process, which doesn't what I
expected:
process(input_reg) is
variable interm: std_logic_vector(10 downto 0);
begin
for i in 0 to 10 loop
interm(i) := input_reg(31-i);
result <= unsigned(interm);
end loop;
end process;
where input_reg is std_logic_vector(0 to 31) and result is unsigned(10
downto 0)
In the simulation result will be set to "0UUUUUUUUUU". What I expected
was "0000000000" when the input reg is all-zero. Why are the bits all
undefined except for the bit that is set in the very last loop
iteration? Shouldn't each loop iteration set one additional bit, such
that in the last iteration all bits are set?
When I move the "result <= unsigned(interm);" outside of the loop the
thing simulates as expected.
Could anyone explain this to me?
Matthias
I have a question regarding the following process, which doesn't what I
expected:
process(input_reg) is
variable interm: std_logic_vector(10 downto 0);
begin
for i in 0 to 10 loop
interm(i) := input_reg(31-i);
result <= unsigned(interm);
end loop;
end process;
where input_reg is std_logic_vector(0 to 31) and result is unsigned(10
downto 0)
In the simulation result will be set to "0UUUUUUUUUU". What I expected
was "0000000000" when the input reg is all-zero. Why are the bits all
undefined except for the bit that is set in the very last loop
iteration? Shouldn't each loop iteration set one additional bit, such
that in the last iteration all bits are set?
When I move the "result <= unsigned(interm);" outside of the loop the
thing simulates as expected.
Could anyone explain this to me?
Matthias