Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Counter in VHDL

Altera_Forum
Honored Contributor II
1,648 Views

Hello Guys 

I need a code of a COUNTER in VHDL that do this : 

1. The counter had 2 inputs  

a. Clk input 

b. a number (x) <-- Random number that alwayes changed 

2. the Default of the counter is to give us HIGH 

3. the counter count the Clk pulses 

if Clk pulses < number (x)  

the counter still give us HIGH 

if Clk pulses >= number (x) 

the counter change to LOW {--When the Clk pulses = number (x) the counter changes to LOW and stay LOW till it become 2004 Clk pulses} 

5. the counter continues count the Clk pulses till 2400 Clk pulses and then back to 0 and changed to HIGH 

6. the counter must do this nonstop. every time it take another number(x) and check it with the Clk pulses. (the number (x) can not be more than 2400). 

Thanks a lot for your help :D 

 

very important : How can i count CLK Pulses
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
920 Views

There are plenty of counter examples in books out there, but I've attached another one more specific to your question. It also includes a basic test bench. (Assuming my attach works).  

 

-- Randall
0 Kudos
Reply