Altera_Forum
Honored Contributor
17 years agoSimulation Results Always Show Don't Care?
Hello All,
I am very new at digital design and am learning on an Altera DE2-70 using VHDL. I have the following code snippet which always shows "Don't Care (XXX)" for the simulation results (clkOut). Can anyone help? The code basically takes clkIn and generates a clkOut whose period is given by the number of input clkIn clocks. I have also attached a Quartus II project archive if anyone cares to run the simulation. Thanks.
-- Frequency Divider (must be multiple of 2)
-- Author : Hitesh Patel, October 2008
-- blog.nirosoftware.com
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
USE ieee.std_logic_unsigned.all;
ENTITY FrequencyDivider IS
GENERIC (NumBits : INTEGER := 26);
PORT( clkIn : IN STD_LOGIC;
divisor : IN STD_LOGIC_VECTOR(NumBits-1 DOWNTO 0); -- 26 bits, must be multiple of 2
clkOut : BUFFER STD_LOGIC := '1');
END FrequencyDivider;
ARCHITECTURE FrequencyDivider OF FrequencyDivider IS
BEGIN
PROCESS(clkIn)
VARIABLE count : STD_LOGIC_VECTOR(NumBits-2 DOWNTO 0);
BEGIN
IF(clkIn'EVENT AND (clkIn = '1')) THEN
count := count + 1;
END IF;
IF(count = divisor(NumBits-2 DOWNTO 1)) THEN
clkOut <= NOT clkOut;
count := (OTHERS => '0');
END IF;
END PROCESS;
END FrequencyDivider;