Add tests

This commit is contained in:
Mario Romero 2022-12-02 21:22:28 -03:00
parent 7fca64f35e
commit f3a6fe64c7
2 changed files with 43 additions and 0 deletions

11
test/Test_CPU.sv Normal file
View File

@ -0,0 +1,11 @@
`timescale 1ns / 1ps
module Test_CPU();
logic clk, reset;
CPU cpu(clk, reset);
always #1 clk = ~clk;
initial begin
reset = 1;
#5
reset = 0;
end
endmodule

32
test/Test_RegisterFile.sv Normal file
View File

@ -0,0 +1,32 @@
`timescale 1ns / 1ps
module Test_RegisterFile();
logic clk;
logic[31:0] addr_1, addr_2, addr_3;
logic write_enable_3;
logic[31:0] write_data_3;
logic[31:0] read_data_1, read_data_2;
RegisterFile register_file(
clk,
addr_1,
addr_2,
addr_3,
write_enable_3,
write_data_3,
read_data_1,
read_data_2
);
always #1 clk = ~clk;
initial begin
write_enable_3 = 1;
addr_3 = 'd10;
write_data_3 = 'd21;
#5
write_enable_3 = 0;
addr_1 = 'd10;
end
endmodule