[Benchmark] Reorganize counter benchmarks. Move them to a directory and give specific naming regarding their functionality
This commit is contained in:
parent
3906497ef5
commit
0b6a9b06f5
|
@ -0,0 +1,25 @@
|
|||
///////////////////////////////////////////
|
||||
// Functionality: Counter with asynchronous reset
|
||||
// Author: Xifan Tang
|
||||
////////////////////////////////////////
|
||||
|
||||
module counter (
|
||||
clk,
|
||||
resetb,
|
||||
result
|
||||
);
|
||||
|
||||
input clk;
|
||||
input resetb;
|
||||
output [7:0] result;
|
||||
|
||||
reg [7:0] result;
|
||||
|
||||
always @(posedge clk or negedge resetb)
|
||||
begin
|
||||
if (!resetb)
|
||||
result = 0;
|
||||
else
|
||||
result = result + 1;
|
||||
end
|
||||
endmodule
|
|
@ -0,0 +1,25 @@
|
|||
module counter_tb;
|
||||
|
||||
reg clk, resetb;
|
||||
wire [7:0] result;
|
||||
|
||||
counter DUT(
|
||||
.clk(clk),
|
||||
.resetb(resetb),
|
||||
.result(result)
|
||||
);
|
||||
|
||||
initial begin
|
||||
#0 resetb = 1'b0; clk = 1'b0;
|
||||
#100 resetb = 1'b1;
|
||||
end
|
||||
|
||||
always begin
|
||||
#10 clk = ~clk;
|
||||
end
|
||||
|
||||
initial begin
|
||||
#5000 $stop;
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue