Provide the structural and behavioral Verilog design of the following circuit O
ID: 3566706 • Letter: P
Question
Provide the structural and behavioral Verilog design of the following circuit O = S
Provide the structural and behavioral Verilog design of the following circuit 0 = S'DO + SD1. Write testbenches and verify from the waveform that they have the same output. Write testbenches for the code modules provided in section C.4 of Appendix C (Figure C.4.1-C.4.3). For simplicity, you can use a 4-bit version of those hardware circuits. Also, feel free to modify the design if you think some component/signal is unnecessary.Explanation / Answer
Structural Modeling:
module mux2( S, D0,D1 q );
input S;
input D1,D0;
output O;
wire q, q1, NOTS;
wire[1:0] S;
wire[3:0] d;
not n1( NOTS, S);
and a1(q, NOTS0, D0 );
and a2( q2, S, D1 );
or o1(O, q, q1, );
endmodule
behavioral model:
moDule mux2( S, D, O );
input S;
input D0,D1;
output O;
reg O;
wire S;
wire D0,D1;
always @( S or D0 or D1 )
begin
if( S== 0)
O = D0;
if( select == 1)
O = D1;
end
endmodule
TEST BENCH:
module mux2_tb;
// Inputs
reg s;
reg D0;
reg D1;
// Outputs
wire O;
// Instantiate the Unit Under Test (UUT)
mux uut (
.s(s),
.D0(D0),
.D1(D1),
.O(O)
);
initial begin
// Initialize Inputs
s = 0;
D0 = 0;
D1 = 0;
// Wait 100 us for global reset to finish
#10;
s = 1;
D0 = 0;
D1 = 1;
#10;
#10;
s = 0;
D0 = 1;
D1 = 0;
#10;
s = 1;
D0 = 0;
D1 = 0;
// Add stimulus here
end
endmodule
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.