icd
Junior Member level 3
Hi,
I am trying to use a fast and slow clock oscillators as a two clocks to two 8-bit counters. The problem the 2 counters are not counting. They give me X as an output. I will appreciate any help to figure out the problem. below is my code and an image of the output:
I am trying to use a fast and slow clock oscillators as a two clocks to two 8-bit counters. The problem the 2 counters are not counting. They give me X as an output. I will appreciate any help to figure out the problem. below is my code and an image of the output:
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
use ieee.std_logic_arith.all ;
use ieee.std_logic_unsigned.all ;
LIBRARY work;
ENTITY ring IS
PORT
(
en_slow : IN STD_LOGIC;
en_fast : IN STD_LOGIC;
slow_clk : OUT STD_LOGIC;
fast_clk : OUT STD_LOGIC;
counter1, counter2 : out std_logic_vector(7 downto 0)
);
END ring;
ARCHITECTURE beh OF ring IS
SIGNAL SYNTHESIZED_WIRE_0 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_1 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_2 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_3 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_4 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_5 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_6 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_7 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_8 : STD_LOGIC;
SIGNAL SYNTHESIZED_WIRE_9 : STD_LOGIC;
signal cnt1, cnt2 : std_logic_vector(7 downto 0):=(others=>'0');
BEGIN
slow_clk <= SYNTHESIZED_WIRE_7;
fast_clk <= SYNTHESIZED_WIRE_2;
SYNTHESIZED_WIRE_1 <= NOT(SYNTHESIZED_WIRE_0);
SYNTHESIZED_WIRE_3 <= NOT(SYNTHESIZED_WIRE_1);
SYNTHESIZED_WIRE_8 <= en_fast AND SYNTHESIZED_WIRE_2;
SYNTHESIZED_WIRE_4 <= NOT(SYNTHESIZED_WIRE_3);
SYNTHESIZED_WIRE_5 <= NOT(SYNTHESIZED_WIRE_4);
SYNTHESIZED_WIRE_7 <= NOT(SYNTHESIZED_WIRE_5);
SYNTHESIZED_WIRE_9 <= NOT(SYNTHESIZED_WIRE_6);
SYNTHESIZED_WIRE_0 <= en_slow AND SYNTHESIZED_WIRE_7;
SYNTHESIZED_WIRE_6 <= NOT(SYNTHESIZED_WIRE_8);
SYNTHESIZED_WIRE_2 <= NOT(SYNTHESIZED_WIRE_9);
slow_clk_counter1_process : process(SYNTHESIZED_WIRE_7)
begin
if(SYNTHESIZED_WIRE_7'event and SYNTHESIZED_WIRE_7='1')then
cnt1<=cnt1+1;
end if;
counter1<=cnt1;
end process;
fast_clk_counter2_process : process(SYNTHESIZED_WIRE_2)
begin
if(SYNTHESIZED_WIRE_2'event and SYNTHESIZED_WIRE_2='1')then
cnt2<=cnt2+1;
end if;
counter2<=cnt2;
end process;
END beh;