Help with Vector Array's in VHDL; Cannot shift from one to another

Joined
Dec 4, 2007
Messages
1
Reaction score
0
I only copy and pasted the relevant code for now. Heres what I'm trying to do. I have to shift from one register to another, i.e.: reg1<= reg2; reg2<=reg3;reg3<=reg4;

It doesn't matter what I do with reg4, i can leave it as it is

Here is the declaration for the vector array:
Code:
type REG_ARRAY is array (0 to 4) of STD_LOGIC_VECTOR (31 downto 0);
	signal reg1 : REG_ARRAY;
	signal reg2 : REG_ARRAY;
	signal reg3 : REG_ARRAY;
	signal reg4 : REG_ARRAY;

I know there are values stored to the register because I output them to a ram and I can read them. However, when i try this it gives me all zeros, instead of just shifting the values from one register to another.

Code:
FOR i IN 0 to 4 LOOP
   reg1(i) <= reg2(i);
   reg2(i) <= reg3(i);
   reg3(i) <= reg4(i);
END LOOP;

The FOR Loop is within a process, and the reg array's are not in the sensitivity list because if I put them in, every time I change one it goes back into the process and in the end assigns reg4 to all the registers.

Any idea why this doesn't work? Thanks
 
Joined
Mar 29, 2012
Messages
1
Reaction score
0
The behavioral model of this may simulate. However, the reigsters won't shift like you expect on the FPGA because the logic operates concurrently.

And you're concurrently reading and writing reg2 and reg3 which is not possible.

That's why it's not working...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top