From 37db52dbd66db1fd43337082249c469eda39f776 Mon Sep 17 00:00:00 2001 From: Nick McKinney Date: Thu, 1 Dec 2016 21:36:51 -0600 Subject: initial commit --- regFile_tb.v | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 regFile_tb.v (limited to 'regFile_tb.v') diff --git a/regFile_tb.v b/regFile_tb.v new file mode 100644 index 0000000..10839d0 --- /dev/null +++ b/regFile_tb.v @@ -0,0 +1,83 @@ +`timescale 1 ns / 100 ps + +module regFile_tb (); + + reg clk; + reg [2:0] regA; + reg [2:0] regB; + reg [2:0] regDest; + reg [15:0] dataIn; + reg we, hb, lb; + wire [15:0] dataA; + wire [15:0] dataB; + + initial begin + clk = 1'b0; + + regA = 3'h0; + regB = 3'h0; + regDest = 3'h0; + we = 1'b0; + hb = 1'b0; + lb = 1'b0; + dataIn = 16'h0; + + #2 + regA = 3'h1; + regDest = 3'h1; + dataIn = 16'hDEAD; + we = 1'b1; + hb = 1'b1; + lb = 1'b1; + + #2 + regB = 3'h1; + regA = 3'h2; + dataIn = 16'hBEEF; + lb = 1'b0; + + #2 + lb = 1'b1; + + #2 + regDest = 3'h2; + hb = 1'b0; + dataIn = 16'h9876; + + #2 + hb = 1'b1; + lb = 1'b0; + dataIn = 16'h2345; + + #2 + regB = 3'h7; + regDest = 3'h7; + lb = 1'b0; + hb = 1'b0; + we = 1'b1; + dataIn = 16'hFFCC; + + #2 + lb = 1'b1; + hb = 1'b1; + we = 1'b0; + + #5 + $stop; + end + + always #1 clk = !clk; + + regFile regFile_inst ( + .clk(clk), + .regA(regA), + .regB(regB), + .regDest(regDest), + .dataIn(dataIn), + .we(we), + .hb(hb), + .lb(lb), + .dataA(dataA), + .dataB(dataB) + ); +endmodule -- cgit v1.2.3