+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Junior Member level 1
    Points: 147, Level: 1

    Join Date
    Aug 2017
    Posts
    14
    Helped
    0 / 0
    Points
    147
    Level
    1

    substitution for loops in design compiler

    what should i use instead of loop to be synthesised in dc
    i nead a good alternative for the loop which is being used in the below process

    Code:
    process (clk)
    begin
     for i in 0 to 4999
     LOOP
    xn <=(FIR_IN(i));
    END LOOP;

    •   Alt4th August 2017, 11:04

      advertising

        
       

  2. #2
    Super Moderator
    Points: 237,321, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    41,068
    Helped
    12541 / 12541
    Points
    237,321
    Level
    100

    Re: substitution for loops in design compiler

    As shown, the loop is just useless. It only "executes" the last assignment. Explain what you want to achieve and give useful code examples with port and signal definition.



    •   Alt4th August 2017, 11:09

      advertising

        
       

  3. #3
    Junior Member level 1
    Points: 147, Level: 1

    Join Date
    Aug 2017
    Posts
    14
    Helped
    0 / 0
    Points
    147
    Level
    1

    Re: substitution for loops in design compiler

    FIR_IN is an array with 5000 data. each data in array is 16 bit."xn" is a 16 bit signal.
    i want to put each of these 5000 data in "xn" one by one and use "xn" in some functions like sum and mult.because i want to repeat putting data of array in " xn" for 5000 times, i nead a for loop but design compiler give an error.

    Code Verilog - [expand]
    1
    2
    3
    
    FIR_IN : T_2D;
    type T_2D is array (4999 downto 0) of std_logic_vector (15 downto 0);
    signal Xn : std_logic_vector(15 downto 0);



    •   Alt4th August 2017, 13:30

      advertising

        
       

  4. #4
    Super Moderator
    Points: 237,321, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    41,068
    Helped
    12541 / 12541
    Points
    237,321
    Level
    100

    Re: substitution for loops in design compiler

    What do you mean exactly with "one by one"? One array value per clock cycle can be output like below
    Code VHDL - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    process (clk)
      variable i: integer;
    begin
      if rising_edge(clk) then
        Xn <=FIR_IN(i);
        if i >= 4095 then
          i:=0;
        else
          i:=i+1;
        end if;
      end if;
    end process;


    1 members found this post helpful.

  5. #5
    Super Moderator
    Points: 27,821, Level: 40
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    6,355
    Helped
    1540 / 1540
    Points
    27,821
    Level
    40

    Re: substitution for loops in design compiler

    Quote Originally Posted by FvM View Post
    What do you mean exactly with "one by one"? One array value per clock cycle can be output like below
    I'm pretty sure they mean the want to process each FIR_IN(i) one at a time in sequential fashion. Unfortunately they don't understand pipelined design and that software loops are not the same as VHDL hardware loops.

    Loops in VHDL (spatial loop) make replicas of whatever is in the loop, in this case it replicates all assignments to xn until it reaches the last assignment. As VHDL only keeps the last assignment in a process (to the same signal) only xn <= FIR_IN(4999); is kept.

    To perform the equivalent software loop (temporal loop) you need to index each array (memory) location with a counter and assign xn in a clocked process like FvM shows. That will take 5000 clock cycles to iterate through all the FIR_IN values. If you attempt to do this temporal loop in VHDL you'll end up with an enormous circuit as it would be completely unrolled into hardware (replication) resulting in a very slow circuit. You can see this when a function with a loop is synthesized.


    1 members found this post helpful.

--[[ ]]--