[Benchmark] Add 8-bit counter benchmark using asynchronous reset to test fracff architectures
This commit is contained in:
parent
b11d03f9c5
commit
bbdc0e53af
|
@ -0,0 +1,25 @@
|
|||
///////////////////////////////////////////
|
||||
// Functionality: Counter with asynchronous reset
|
||||
// Author: Xifan Tang
|
||||
////////////////////////////////////////
|
||||
|
||||
module counter (
|
||||
clk,
|
||||
reset,
|
||||
result
|
||||
);
|
||||
|
||||
input clk;
|
||||
input reset;
|
||||
output [7:0] result;
|
||||
|
||||
reg [7:0] result;
|
||||
|
||||
always @(posedge clk or posedge reset)
|
||||
begin
|
||||
if (reset)
|
||||
result = 0;
|
||||
else
|
||||
result = result + 1;
|
||||
end
|
||||
endmodule
|
|
@ -0,0 +1,25 @@
|
|||
module counter_tb;
|
||||
|
||||
reg clk, reset;
|
||||
wire [7:0] result;
|
||||
|
||||
counter DUT(
|
||||
.clk(clk),
|
||||
.reset(reset),
|
||||
.result(result)
|
||||
);
|
||||
|
||||
initial begin
|
||||
#0 reset = 1'b1; clk = 1'b0;
|
||||
#100 reset = 1'b0;
|
||||
end
|
||||
|
||||
always begin
|
||||
#10 clk = ~clk;
|
||||
end
|
||||
|
||||
initial begin
|
||||
#5000 $stop;
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue