Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

Pb with shifting

architecture behave of convo is
signal rg: std_logic_vector(1 downto 0):="00";
signal c1: std_logic_vector(31 downto 0);
signal c2: std_logic_vector(31 downto 0);
begin
process(clk)
begin
if (clk 'event and clk='1') then
for i in 0 to 31 loop 
c1(i)<=wr_data(i) xor rg(1);
rg(1)<=rg(0);        :confused:
rg(0)<=wr_data(i);  :confused:
end loop;
end if;
end process;
C1_out<=c1;
--C2_out<=c2;
end;

Hello mates, I am having problem with my code : the instructions" rg(1)<=rg(0); and rg(0)<=wr_data(i); " seems that they r not working

I start my waveform(with no error in synth) and the result show that it is keep doing c1(i)<=wr_data(i) xor rg(1); for the initial rg(1) !!!

What could be the problem ? is it code syntax or what ?!

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    rg(0) is always assigned to wr_data(31), because signals take the last value assigned to them. did you mean for rg to be a variable?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    rg(0) is always assigned to wr_data(31), because signals take the last value assigned to them. did you mean for rg to be a variable?

    --- Quote End ---

    Yes I need rg(0) to be assigned to wr_data(i) ( same for assigning rg(1)) as you said rg should be variable every iteration