- Joined
- Jul 2, 2010
- Sythe Gold
- 0
- Messages
- 205
Hi, i recently got this as an assigment but i cant compile to make it work. Hope you guys can help me out. THANKS !
The question
Write a description of a counter that can count up on the negative clock edge. When counting up, the counter counts in binary from 2 to 7 and repeats. When resetting the counter with a LOW signal at the reset input, the counter’s output value is 2. An Led is lit when the output reaches a value of 7
What i done so far
library ieee;
use ieee.std_logic_1164.all;
use iee.numeric_std.all;
entity counter_up is
port (clk, reset_bar : in std_logic;
led_out : out std_logic;
q : out std_logic_vector ( 3 downto 0);
end counter_up;
architecture flow of counter_up is
signal count_up : unsigned ( 3 downto 0);
begin
process ( clk, reset_bar)
begin
if ( reset_bar ='0') then
count_sig <="0010";
elsif falling_edge (clk) then
if (count_sig =7 ) then
count_sig <= "0010";
(led_out = '1')
count_sig <="0111";
else
count_sig<= count_sign +1;
end if;
end if;
end process;
q<= std_logic_vector (count_sig);
end flow;
---------------------------------------------------------
My lect told me something wrong with this but he does not want to tell where when wrong. I will be grateful if you guys fix this for me. Thanks
The question
Write a description of a counter that can count up on the negative clock edge. When counting up, the counter counts in binary from 2 to 7 and repeats. When resetting the counter with a LOW signal at the reset input, the counter’s output value is 2. An Led is lit when the output reaches a value of 7
What i done so far
library ieee;
use ieee.std_logic_1164.all;
use iee.numeric_std.all;
entity counter_up is
port (clk, reset_bar : in std_logic;
led_out : out std_logic;
q : out std_logic_vector ( 3 downto 0);
end counter_up;
architecture flow of counter_up is
signal count_up : unsigned ( 3 downto 0);
begin
process ( clk, reset_bar)
begin
if ( reset_bar ='0') then
count_sig <="0010";
elsif falling_edge (clk) then
if (count_sig =7 ) then
count_sig <= "0010";
(led_out = '1')
count_sig <="0111";
else
count_sig<= count_sign +1;
end if;
end if;
end process;
q<= std_logic_vector (count_sig);
end flow;
---------------------------------------------------------
My lect told me something wrong with this but he does not want to tell where when wrong. I will be grateful if you guys fix this for me. Thanks
