[Benchmark] Add a micro benchmark to test pipelined architecture

This commit is contained in:
tangxifan 2021-01-10 10:21:30 -07:00
parent 0c808bec41
commit 4412bbd084
3 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,7 @@
a 0.5 0.2
b 0.5 0.2
c 0.25 0.1
a_reg 0.5 0.2
b_reg 0.5 0.2
c_reg 0.25 0.1
clk 0.500000 2.000000

View File

@ -0,0 +1,12 @@
.model and2_pipelined
.inputs clk a b
.outputs c
.latch a a_reg re clk 0
.latch b b_reg re clk 0
.latch c_reg c re clk 0
.names a_reg b_reg c_reg
11 1
.end

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////
// Functionality: a pipelined 2-input AND
// where inputs and outputs are registered
// Author: Xifan Tang
////////////////////////////////////////
`timescale 1ns / 1ps
module and2_pipelined(
clk,
a,
b,
c);
input wire clk;
input wire a;
input wire b;
output wire c;
reg a_reg;
reg b_reg;
reg c_reg;
always @(posedge clk) begin
a_reg <= a;
b_reg <= a;
end
always @(posedge clk) begin
c_reg <= a_reg & b_reg;
end
assign c = c_reg;
endmodule