Easy question about pipeline: Is this code synthesizable?

Gast #3743500
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.
#3743522
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;
Persönliche Seite #3743542
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.

Antwort schreiben

Eine eigene Frage? Dieser Thread ist über 12 Jahre alt. Stell sie in einem eigenen Thread – dort lesen mehr Leute mit, und sie wird öfter und schneller beantwortet.

Neuen Thread starten

Eine Lösung, Ergänzung oder Rückmeldung zu diesem Thread? Dann antworte hier.

Formatierung
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.