8bit Up/Down Counter
AIM:Design and implement an 8bit Up/Down Counter with enable input and synchronous clear.
DESIGN
Verilog Program- Up Down Counter
`timescale 1ns / 1ps
///////////////////////////////////////////////////////////////////////////
// Company: TMP
// Create Date: 08:15:45 01/12/2015
// Module Name: Up Down Counter
// Project Name: Up Down Counter
///////////////////////////////////////////////////////////////////////////
module UpDownCounter(clk,enable,reset,mode,count,tc);
input clk,enable,reset,mode;
output reg [7:0]count;
output reg tc;
always @(posedge clk)
begin
if(enable)
begin
if(reset)
begin
count=0;
tc=0;
end
else
begin
if(mode==0)
begin
count=count+1;
if(count==255)
tc=1;
else
tc=0;
end
else
begin
count=count-1;
<if(count==0)
tc=1;
else
tc=0;
end
end
end
end
endmodule
.................................................................................................
Related Programs:
Verilog program for Basic Logic Gates
Verilog program for Half Adder
Verilog program for Full Adder
Verilog program for 4bit Adder
Verilog program for Half Substractor
Verilog program for Full Substractor
Verilog program for 4bit Substractor
Verilog program for Carry Look Ahead Adder
Verilog program for 3:8 Decoder
Verilog program for 8:3 Encoder
Verilog program for 1:8 Demultiplxer
Verilog program for 8:1 Multiplexer
Verilog program for 8bit D Flipflop
Verilog program for T Flipflop
Verilog program for JK Flipflop
Verilog program for Equality Comparator
Verilog program for 8bit Up down counter
Verilog program for 8bit Shift Register (SIPO,PISO,PIPO)
Verilog program for Random Access Memory(RAM)
Verilog program for Programmable clock Generator
Verilog program for Finite State Machine (mealy)
Verilog program for Finite State Machine (moore)