Forum Discussion

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

Strange synthesis result , getting crazy

I am new to VHDL.

I am using Quartus II v.8 Web edition for synthesis.For several days i stuck at the following simple code.:(

LIBRARY ieee;

USE ieee.std_logic_1164.all;

ENTITY clock IS

PORT

(

clk_in : IN STD_LOGIC;

triger : OUT STD_LOGIC

);

END clock;

ARCHITECTURE clock_architecture OF clock IS

BEGIN

PROCESS(clk_in)

variable second : INTEGER RANGE 0 TO 59:=0;

variable minute : INTEGER RANGE 0 TO 59:=0;

variable hour : INTEGER RANGE 0 TO 23:=0;

variable interval : INTEGER RANGE 0 TO 9:=0;

variable outtriger :STD_LOGIC :='0';

BEGIN

if(clk_in'event and clk_in='1') then

if second < 59 then

second:=second+1;

else

second:=0;

if minute <59 then

minute:=minute+1;

if interval<9 then

interval:=interval+1;

outtriger:='0';

else

interval:=0;

outtriger:='1';

end if;

else

minute:=0;

if hour<23 then

hour:=hour+1;

else

hour:=0;

end if; --end of hour

end if; -- end of minute

end if; --end of second

end if; -- end of clk'event

triger <= outtriger;

END PROCESS;

END clock_architecture;

When i watch the RTL after synthesis all the variable second, minute, interval converts to registers but i didn't find any register for hour.(I attached the RTL with this thread).But if i remove following code l can find the register representing hour in RTL.

if interval<9 then

interval:=interval+1;

outtriger:='0';

else

interval:=0;

outtriger:='1';

end if;

Plz ...plz ...plz help me if you can.:mad:

Thanks in Advanced

Raisul

http://www.velocityreviews.com/forums/images/statusicon/user_online.gif

2 Replies

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

    The synthesis tool recognizes that no output depends on the "hour" variable and synthesizes it away.

    The only input for the trigger output in the code you are evaluating is the minute signal, which is independent from the hour signal. So the hour does not need to be counted.

    If you create a dependency on the hour signal, lets say set the output to 1 in a specific hour only, then the hour will result in a register as well.

    Regards,

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

    Now i understand why my code was gerenating abnormal RTL.I created a dependency on the hour signal and the problem solved.

    Many Many thanks.I was stuck at this problem for more than a week.