diff options
author | dianshi <dianshi@main.lv> | 2022-01-19 22:03:50 +0000 |
---|---|---|
committer | dianshi <dianshi@main.lv> | 2022-01-19 22:03:50 +0000 |
commit | 8661ed2084e8d50ef19a2827484fefd07c4f20e1 (patch) | |
tree | 8a516be79571d1ef46ecabe676ffa7ce17c6ffab /gpr/v0.1/test_gpr_register.v | |
parent | f3a300ce5927cad9ecf02821b3be007f9d2af22b (diff) | |
download | cpu8_v-8661ed2084e8d50ef19a2827484fefd07c4f20e1.tar.gz cpu8_v-8661ed2084e8d50ef19a2827484fefd07c4f20e1.zip |
Added general purpose memory
Diffstat (limited to 'gpr/v0.1/test_gpr_register.v')
-rw-r--r-- | gpr/v0.1/test_gpr_register.v | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/gpr/v0.1/test_gpr_register.v b/gpr/v0.1/test_gpr_register.v new file mode 100644 index 0000000..bad146b --- /dev/null +++ b/gpr/v0.1/test_gpr_register.v @@ -0,0 +1,89 @@ +`timescale 1ns/1ps + +module test_gpr_register; + + reg clk; + + reg reg_write_en; + reg [2:0]reg_write_dest; + reg [15:0]reg_write_data; + + reg [2:0]reg_read_addr_1; + reg [15:0]reg_read_data_1; + + reg [2:0]reg_read_addr_2; + reg [15:0]reg_read_data_2; + + +gpr_register gpr( + .clk(clk), + .reg_write_en(reg_write_en), + .reg_write_dest(reg_write_dest), + .reg_write_data(reg_write_data), + .reg_read_addr_1(reg_read_addr_1), + .reg_read_data_1(reg_read_data_1), + .reg_read_addr_2(reg_read_addr_2), + .reg_read_data_2(reg_read_data_2) +); +initial begin + $display("Start testing register"); + $dumpfile("test_gpr_register.vcd"); + $dumpvars(0,test_gpr_register); + + clk=0; + reg_read_addr_1=0; + reg_read_addr_2=0; + reg_write_dest=0; + reg_write_en=0; + + #10 + clk=1; + reg_write_dest=1; + reg_write_data=16'hAA; + reg_write_en=1; + + #10 + clk=1; + + #10 + clk=0; + reg_write_dest=2; + reg_write_data=16'hBB; + reg_write_en=1; + + #10 + clk=1; + + #10 + clk=0; + reg_write_en=0; + reg_read_addr_1=0; + reg_read_addr_2=1; + + //#10 + //clk = 1; + + //#10 + //clk = 0; + + #10 + clk=1; + reg_read_addr_1=1; + reg_read_addr_2=2; + + #10 + clk = 0; + + #10 + clk = 1; + + #10 + clk = 0; + +end + +initial begin + $monitor("At time=%t",$time); +end + +endmodule
\ No newline at end of file |