Verilog Code and Testbench
Verilog Code and Testbench
module mux4(i,s,o);
input[3:0] i;
input[1:0] s;
output o;
reg o;
always @(i or s)
begin
case(s)
2'b00:o=i[0];
2'b01:o=i[1];
2'b10:o=i[2];
2'b11:o=i[3];
default:o=0;
endcase
end
endmodule
VERILOG TESTBENCH:
module mux_tb;
reg[3:0] i;
reg[1:0] s;
wire o;
initial begin
end
endmodule