Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
18 years ago

VHDL code

Hello Guys

I got this Code

library ieee;

use ieee.std_logic_1164.all;

entity NewLUT is

port

(

clk : in std_logic;

--encoder_a : in std_logic;

data_in : in integer range 3185 to 4215 ; --std_logic_vector(12 downto 0);

data_out : out std_logic_vector (30 downto 0);

out_ready : out std_logic

);

end;

architecture arc_NewLUT of NewLUT is

signal temp : std_logic;

begin

process

begin

if CLK'EVENT and CLK = '1' then

temp <= '1';

if temp = '1' then

case data_in is

when 3185=> data_out <= ("1010101101110111011101110111100");

when 3186=> data_out <= ("1010101101101001110100000011011");

when 3187=> data_out <= ("1010101101011100001010001111011");

when 3188=> data_out <= ("1010101101001110100000011011010");

when 3189=> data_out <= ("1010101101000000110110100111010");

when 3190=> data_out <= ("1010101100110011001100110011001");

when 3191=> data_out <= ("1010101100100101100010111111001");

when 3192=> data_out <= ("1010101100010111111001001011001");

when 3193=> data_out <= ("1010101100001010001111010111000");

when 3194=> data_out <= ("1010101011111100100101100011000");

when 3195=> data_out <= ("1010101011101110111011101110111");

when 3196=> data_out <= ("1010101011100001010001111010111");

when 3197=> data_out <= ("1010101011010011101000000110110");

when 3198=> data_out <= ("1010101011000101111110010010110");

when 3199=> data_out <= ("1010101010111000010100011110110");

when 3200=> data_out <= ("1010101010101010101010101010101");

when 3201=> data_out <= ("1010101010011101000000110110101");

when 3202=> data_out <= ("1010101010001111010111000010100");

when 3203=> data_out <= ("1010101010000001101101001110100");

when 3204=> data_out <= ("1010101001110100000011011010011");

when 3205=> data_out <= ("1010101001100110011001100110011");

when 3206=> data_out <= ("1010101001011000101111110010011");

when 3207=> data_out <= ("1010101001001011000101111110010");

when 3208=> data_out <= ("1010101000111101011100001010010");

when 3209=> data_out <= ("1010101000101111110010010110001");

when 3210=> data_out <= ("1010101000100010001000100010001");

when 3211=> data_out <= ("1010101000010100011110101110000");

when 3212=> data_out <= ("1010101000000110110100111010000");

when 3213=> data_out <= ("1010100111111001001011000110000");

when 3214=> data_out <= ("1010100111101011100001010001111");

when 3215=> data_out <= ("1010100111011101110111011101111");

when others => data_out <= ("1111111111111111111111111111111");

end case;

else

data_out <= ("0000000000000000000000000000000");

end if;

out_ready <= '1';

wait for 25 ns; -- ERROR

out_ready <= '0';

end if;

--

-- Add a flag to be used as a clk to the register

--

end process;

end arc_NewLUT ;

the error msg is : error (10533): vhdl wait statement error at newlut.vhd(75): wait statement must contain condition clause with until keyword.

Why is this error i did not want UNTIL all i need to wait for 25 ns evrey time the code uses the case statement.

12 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Amirster, can you take a step back and explain what you're trying to do? In the original code you had a wait of 25ns. Synthesizable VHDL doesn't have a strong concept of time. The suggestions of making a counter depend on your clock frequency, which is outside of the VHDL construct. For example, if you made a counter that waits for 5 cycles, that will be different if you feed a 10MHz clock into the system versus a 100MHz clock.

    If you're looking for pure delay(and no registers), that is strongly recommended agains. There are cases where people do it, but it requires min/max setup and hold timing analysis, and can be quite complicated. I think we can answer your question better if you describe your problem from a higher level, as you most likely don't want a pure delay.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The first step is to have some kind of clock, a couple of time higher then the requested time intervals. What I usually do is make the design synchroneous to a masterclock.

    You can evaluate "on rising edge".

    I am used to the old AHDL language of Altera ( early user, late adapter....) it will look like:

    DFF.clk := Global clock ; evaluate every clock pulse

    DFF.d := Data == Value ; Latch result

    Result := DFF.q ;

    DFF2.clk := Global clock ;

    DFF2.d := Result ;

    Result2 := DFF2.q ; Delaye with one clock pulse

    eg in hardware you are creating a delay pipeline.

    Other solutions are start a counter and gate the result at a certain clock count,

    Use shift registers ( which are in fact cascaded DFF's )

    While writing VDL, just think in hardware!

    Succes,

    Andries