Forum: FPGA, VHDL & Co. Easy question about pipeline: Is this code synthesizable?


von Enrique (Gast)


Lesenswert?

Hello!

I need to make a complex pipeline operation and I want to use this 
structure like a templeta:
1
--process for calcultation of the equation.
2
PROCESS(Clk)
3
BEGIN
4
    if(rising_edge(Clk)) then
5
    --Implement the pipeline stages using a for loop and case statement.
6
    --'i' is the stage number here.
7
    --The multiplication is done in 3 stages here.
8
    --See the output waveform of both the modules and compare them.
9
        for i in 0 to 2 loop 
10
            case i is 
11
                when 0 => temp1 <= a*data;
12
                when 1 => temp2 <= temp1*b;
13
                when 2 => result <= temp2*c;
14
                when others => null;
15
            end case;
16
        end loop; 
17
    end if; 
18
END PROCESS;

I just want to know if this is synthesizable in an Altera Cyclone IV 
with quartus II. Would I have any problem with the FOOR loop?

Any other suggestions about pipeline templates are also welcome....

Thanks.

: Bearbeitet durch Moderator
von Roger S. (edge)


Lesenswert?

yes, for loops work just fine in quartus.
Why do you have to obfuscate this, just write:
1
PROCESS
2
BEGIN
3
    wait until rising_edge(Clk);
4
    --blah...
5
    temp1 <= a*data;
6
    temp2 <= temp1*b;
7
    result <= temp2*c;
8
END PROCESS;

von J. S. (engineer) Benutzerseite


Lesenswert?

I do not see any reason at all to use a loop case construction with 
conditional behaviour like this since there are no divergent cases but 
all of the statements will have to be synthesized to make the circiut 
operating.

More over it was wrong to have any condional branches in pipelines 
regarding the space axis. Conditional synthesis makes sence for those 
applications only when pipeline lengths and micro cycles have to be 
dynamically tuned (conditional time axis), which is rarely required.

Furthermore I would recommend not to use those *temp" naming since there 
is nothing temporary about them- neither during synthesis nor during 
operation but they are solid and ever ready calculation results: present 
in any case.

The different "times" which are generated by such a pipeline construct 
within a rising_edge part, should better be named like *_d1,  *_d2 and 
so on to clarify their time relation to each other. Structures invented 
in later times in the pipeline should be named appropriately.

Taking into account that you apply all the incoming vectors 
synchronously, Im afraid, your construct above might be wrong. "b" and 
"c" for example will have to be applied at a later point of time in the 
pipeline, so you will need copies of those values like this here:

b_d1 <= b
c_d1 <= c
c_d2 <= c_d1

and finally apply "b_d1" for the second, and "c_d2" for the final 
multiplication.

: Bearbeitet durch User
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.