Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20764 ディスカッション

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

Altera_Forum
名誉コントリビューター II
1,266件の閲覧回数

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 件の賞賛
7 返答(返信)
Altera_Forum
名誉コントリビューター II
504件の閲覧回数

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
名誉コントリビューター II
504件の閲覧回数

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
名誉コントリビューター II
504件の閲覧回数

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
名誉コントリビューター II
504件の閲覧回数

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
名誉コントリビューター II
504件の閲覧回数

hope that image answer ur question tricky

Altera_Forum
名誉コントリビューター II
504件の閲覧回数

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
名誉コントリビューター II
504件の閲覧回数

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.

返信