Test Fixture Program :-
module tf_up_down_counter;
// Inputs
reg up_down;
reg clk;
reg reset;
// Outputs
wire [7:0] out;
// Instantiate the Unit Under Test (UUT)
up_down_counter uut (
.out(out),
.up_down(up_down),
.clk(clk),
.reset(reset)
);
initial begin
clk=1'b1;
forever #5 clk=~clk;
end
initial begin
up_down = 0;reset = 1;#10;
reset = 0;#30;
up_down = 1;#10;
up_down = 0;
end
--------------------------------------------------------------------------------------------------------------------------
Program for Up / Down Counter ( VERILOG ) :-
module up_down_counter (
out , // Output of the counter
up_down , // up_down control for counter
clk , // clock input
reset // reset input
);
//----------Output Ports--------------
output [7:0] out;
//------------Input Ports--------------
input up_down, clk, reset;
//------------Internal Variables--------
reg [7:0] out;
//-------------Code Starts Here-------
always @(posedge clk)
if (reset) begin // active high reset
out <= 7'b0 ;
end else if (up_down) begin
out <= out + 1;
end else begin
out <= out - 1;
end
endmodule
Nice article , thanks for sharing , very informative and presented nice , keep updating morered hat linux administration training in chennai|red hat training in chennai|RHCE training in chennai|red hat training center in chennai|red hat training partner in chennai|red hat linux certification training in chennai
ReplyDelete