RISC-V_Verilog/tb/tb_alu.v

33 lines
629 B
Coq
Raw Normal View History

`timescale 1ns / 1ps
2023-10-23 08:34:37 +00:00
`include "tb_tools.vh"
module tb_alu ();
2023-10-23 05:15:21 +00:00
reg [31:0] in_a;
reg [31:0] in_b;
2023-10-23 08:34:37 +00:00
reg [3:0] op_code;
2023-10-23 05:15:21 +00:00
wire [31:0] out;
2023-10-23 05:15:21 +00:00
alu alu (
.in_a(in_a),
.in_b(in_b),
.op_code(op_code),
.out(out)
);
2023-10-23 05:15:21 +00:00
initial begin
2023-10-23 08:34:37 +00:00
in_a = 32'b0;
in_b = 32'b0;
op_code = 4'b0000;
`assert("alu : 0 + 0", out, 0)
in_a = 32'b1;
`assert("alu : 1 + 0", out, 1)
in_b = 32'b1;
`assert("alu : 1 + 1", out, 2)
op_code = 4'b0001;
`assert("alu : 1 - 1", out, 0)
2023-10-23 08:34:37 +00:00
`end_message
2023-10-23 05:15:21 +00:00
end
endmodule : tb_alu