Test Fixture Program :-
module tf_ring_vlog_new;
// Inputs
reg clk;
reg reset;
// Outputs
wire [3:0] out;
// Instantiate the Unit Under Test (UUT)
ring_vlog_new uut (
.out(out),
.clk(clk),
.reset(reset)
);
initial begin
clk=1'b1;
forever #5 clk=~clk;
end
initial begin
reset = 1;#10;
reset = 0;#40;
end
endmodule
--------------------------------------------------------------------------------------------------------------------------
Program for Ring Counter ( VERILOG ) using another idea :-
module ring_vlog_new(
out , // Output of the counter
clk , // clock input
reset // reset input
);
//----------Output Ports--------------
output [3:0] out;
//------------Input Ports--------------
input clk, reset;
//------------Internal Variables--------
reg [3:0] out;
//-------------Code Starts Here-------
always @(posedge clk)
if (reset)
begin // active high reset
out <= 4'b0001 ;
end
else
begin
out <= {out[2:0],out[3]};
end
endmodule
No comments:
Post a Comment