RISC-V_Verilog/tb/tb_mux2_1.v

40 lines
907 B
Coq
Raw Permalink Normal View History

`timescale 1ns / 1ps
2023-10-23 08:34:37 +00:00
`include "tb_tools.vh"
module tb_mux2_1 ();
2023-10-23 08:34:37 +00:00
reg sel;
reg [31:0] in_1;
reg [31:0] in_2;
2023-10-23 05:15:21 +00:00
wire [31:0] out;
mux2_1 mux (
2023-10-23 08:34:37 +00:00
.in_1(in_1),
.in_2(in_2),
.sel(sel),
.out(out)
2023-10-23 05:15:21 +00:00
);
initial begin
2023-10-23 08:34:37 +00:00
in_1 = 1'b0;
in_2 = 1'b0;
sel = 1'b0;
`assert("mux in_1: 0, in_2: 0, sel: 0", out, 0)
in_1 = 1'b1;
`assert("mux in_1: 1, in_2: 0, sel: 0", out, 1)
sel = 1'b1;
`assert("mux in_1: 1, in_2: 0, sel: 1", out, 0)
in_2 = 1'b1;
`assert("mux in_1: 1, in_2: 1, sel: 1", out, 1)
in_1 = 1'b0;
`assert("mux in_1: 0, in_2: 1, sel: 1", out, 1)
in_2 = 1'b0;
`assert("mux in_1: 0, in_2: 0, sel: 1", out, 0)
sel = 1'b0;
`assert("mux in_1: 0, in_2: 0, sel: 0", out, 0)
2023-10-23 05:15:21 +00:00
2023-10-23 08:34:37 +00:00
`end_message
2023-10-23 05:15:21 +00:00
end
endmodule : tb_mux2_1