Forum Discussion

TAdel1's avatar
TAdel1
Icon for New Contributor rankNew Contributor
6 years ago

Clock divider simulation problem

Hello there ,

I tried to code this clock divider to divide my input clock by 16 , but when I run simulation I got my output signal period same as my input clock , any one please can tell me why that happened ? my code

LIBRARY ieee;

USE ieee.std_logic_1164.all;

USE ieee.std_logic_unsigned.all;

ENTITY TRICK IS

PORT ( CLK : IN STD_LOGIC;

F : OUT STD_LOGIC);

END TRICK;

ARCHITECTURE BEH OF TRICK IS

SIGNAL CNT : STD_LOGIC_VECTOR(3 DOWNTO 0);

BEGIN

PROCESS (CLK) IS

BEGIN

IF (CLK'EVENT AND CLK='1') THEN

CNT<= CNT + 1;

ELSE

CNT<=CNT;

END IF;

F<=CNT(3);

END PROCESS;

END BEH;

2 Replies

  • Vicky1's avatar
    Vicky1
    Icon for Regular Contributor rankRegular Contributor

    Hi,

    what you observed in simulation result? please provide screenshot.

    Have you initialized the inputs(CLK) & outputs(F,CNT) in testbench?

    Regards,

    Vicky

  • Vicky1's avatar
    Vicky1
    Icon for Regular Contributor rankRegular Contributor

    Hi,

    May I know any update?

    Should I consider that, case to be closed?

    Regards,

    Vicky