Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

FSM works but there is sth wrong Please help

Status
Not open for further replies.

tryingsth

Junior Member level 2
Joined
Nov 21, 2012
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,458
Hello,

I use a state machine. But the machine is in 2 for loop. My problem is the state machine work correctly but it calculate the last elemnts of loop. I want to get all values from loop.

To be clearly I shared my code
This part my begining



FOR i IN 1 TO n LOOP
FOR j IN 1 TO n LOOP




CASE pr_state IS
WHEN st0 =>

IF(counter = 0 ) THEN

s1<=adder(matris_in(i-1,j-1),matris_in(i-1,j));
s2<=adder(matris_in(i-1,j+1),matris_in(i,j-1));
...
...

This part is my aim.I want to get outputs value for every value of i and j. But at this moment I only get value for all output matris's value that i=n j=n
I hope I can explain.

matris_out(i-1,j-1)<=tmp5;
--finish<='1';

end loop;
end loop;


Please help for my final project.
Thanks
 

I presume a misunderstanding of VHDL iteration loop operation. It's defining parallel operation, not a sequence in time. Any signal assigned in the loop will be updated after the end of the respective process.

Your code snippet is omitting the important details, however.

As a general suggestion, review your VHDL text books about the nature of loop constructs.

The discussed problem doesn't seem to be related to FSM, by the way.
 

but I used the loops in 'process'.

PROCESS(pr_state,counter,clk)

BEGIN
counter <= 0;

FOR i IN 1 TO n LOOP
FOR j IN 1 TO n LOOP




CASE pr_state IS
WHEN st0 =>

IF(counter = 0 ) THEN

s1<=adder(matris_in(i-1,j-1),matris_in(i-1,j));
s2<=adder(matris_in(i-1,j+1),matris_in(i,j-1));
....

Do I share all code?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top