Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Comunicados
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussões

Design a BCD counter with a asynchronous master reset. Display the values 0 to 9 on

Altera_Forum
Colaborador honorário II
1.873 Visualizações

Design a BCD counter with a asynchronous master reset. Display the values 0 to 9 on the 7-segment display and whenever the count is 1, 3 or 5, a Led will turn on. 

 

HI,i have a problem with the program with regards to the led_on.Can any kind soul provides some advice on this? 

 

This is so far what i've done, 

 

-- a BCD coubter with asynchronous reset 

library ieee; 

use ieee.std_logic_1164.all; 

use ieee.numeric_std.all; 

 

entity bcd_counter is 

port ( clk, reset_bar,led_on: in std_logic; 

q : out std_logic_vector (9 downto 0)); 

 

end bcd_counter; 

 

architecture flow of bcd_counter is 

 

signal count_sig: unsigned (9 downto 0); 

 

begin 

process (clk, reset_bar,led_on) 

begin 

if (reset_bar = '1' and led_on = '1') then 

count_sig <= "0000000000"; 

 

elsif falling_edge (clk) then 

if (count_sig = 9) then 

count_sig <= "0000000000"; 

else 

count_sig <= count_sig +1; 

if(led_on = '1') then 

count_sig <="0000000000"; 

else 

count_sig<= count_sig +1; 

 

end if; 

end if; 

end if; 

end process; 

 

q <= std_logic_vector (count_sig); 

 

end flow;
0 Kudos
7 Respostas
Altera_Forum
Colaborador honorário II
1.111 Visualizações

What does LED_ON do ? Is it like : counter_enable?  

Or do u whant to turn the led (make is light'n up)?
Altera_Forum
Colaborador honorário II
1.111 Visualizações

counter_enable which triggers the 9 output. I tried compiling the graph, the only thing that doesn't toggles is the led_on ): Is it because theres a problem with my if, else? Or do i have to include the led_on, on a separate if,else statement? I really need help on this ):

Altera_Forum
Colaborador honorário II
1.111 Visualizações

From the looks of it led_on is your reset signal, and reset_bar specifies if its an async or sync reset. 

 

What does your testbench code look like?
Altera_Forum
Colaborador honorário II
1.111 Visualizações

the resetbar is a master reset. Even with the compilation, the led_on was still unable to on. How do i use the if else, particularly on the led_on? So far what i've came out, is for the reset_bar. :

Altera_Forum
Colaborador honorário II
1.111 Visualizações

hope that image answer ur question tricky

Altera_Forum
Colaborador honorário II
1.111 Visualizações

Plz describe your needs for the programm. 

Also describe what every input has to do.  

 

We can't figure out what the code has to do (or what u whant LED_ON has to do).
Altera_Forum
Colaborador honorário II
1.111 Visualizações

A testbench is a peice of VHDL code used to drive your unit under test in a simulator, not the board you're going to run your design on.

Responder