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

74LS190 Verilog Code

Altera_Forum
Honored Contributor II
1,726 Views

Hi. I'm a newbie in Verilog Programming. I wish to code using Verilog the functions of the 74LS190 which is simply an Up/Down Counter. Anyone who knows any code on this? It's basically a counter that will count up from 0-9 then back to 0 or count down from 9-0 then back to 9. 74LS190 is a Synchronous Up/Down BCD Decade counter. The state changes of the counters are basically synchronous with the LOW-to-HIGH transition of the Clock Pulse Input. Help please. Thanks. 

 

Can you check if the code below is almost the same on what I am trying to find. 

 

module up_down_counter (count, D_in, load, count_up, cntr_on, clk, reset); 

output [2:0] count; 

input load, count_up, cntr_on, clk, reset; 

input [2:0] D_in; 

reg [2:0] count; 

 

always @ (posedge reset or posedge clk) 

if (reset==1'b1) count=3'b0; else 

if (load==1'b1) count=D_in; 

if (cntr_on==1)  

begin 

if (count_up==1'b1) count=count + 1;  

else 

count=count - 1; 

end 

 

endmodule  

 

 

Thanks!
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
949 Views

that looks like a standard updown counter...

0 Kudos
Reply