Question

In: Electrical Engineering

Try designing a 4 bit Multiplexer using two 2-bit multiplexer design given below and verify the...

Try designing a 4 bit Multiplexer using two 2-bit multiplexer design given below and verify the design by simulating it.


module Mux2x1(In0,In1,sel,out);
input In0,In1,sel;
output out;
assign out = (sel)?In1:In0;
endmodule

Pls include the verilog design module,testbench, waveform

Solutions

Expert Solution

// verilog code for 2*1 mux

module Mux2x1(In0,In1,sel,out);

input In0,In1,sel;

output out;

assign out = (sel)?In1:In0;

endmodule

// verilog code for 4*1 mux using 2*1 muxes

module Mux4x1 (

// input port declarations

input In0,In1,In2,In3,sel1,sel0,

output out);

  

// internal signal declaration

wire t,u ;

  

// instantiate 2*1 mux modules

  

  

Mux2x1 U0 (.In0(In0),.In1(In1),.sel(sel0),. out (t));

  

Mux2x1 U1 (.In0(In2),.In1(In3),.sel(sel0),. out (u));

  

Mux2x1 U2 (.In0(t),.In1(u),.sel(sel1),. out (out));

  

  

endmodule

  

  

// testbench code for 4*1 mux

module test;

  

reg In0,In1,In2,In3,sel1,sel0;

  

wire out;

  

// instantiate DUT

Mux4x1 A0 (.In0(In0),.In1(In1),.In2(In2),.In3(In3),.sel1(sel1),.sel0(sel0),.out(out));

  

  

// input stimulus

  

initial begin

$dumpfile("dump.vcd");

$dumpvars;

  

In0 =1'b1; In1 = 1'b0;In2 = 1'b1; In3 = 1'b0;

  

sel1 = 1'b0; sel0 = 1'b0; #20;

sel1 = 1'b1; sel0 = 1'b0; #20;

sel1 = 1'b0; sel0 = 1'b1; #20;

sel1 = 1'b1; sel0 = 1'b1; #20 $finish;

  

end

  

endmodule

  

  

  

  

// Simulation waveforms


Related Solutions

For this lab, design, synthesize, and functionally verify a 5x1 one-bit multiplexer circuit that is controlled by switches and drives an LED
 For this lab, design, synthesize, and functionally verify a 5x1 one-bit multiplexer circuit that is controlled by switches and drives an LED. In the design, use the switches and LED as indicated below . SW9-SW5 for the five data inputs with SW5 corresponding to select input "000" . SW3-SW1 for the select inputs . LEDS for the output of the multiplexer The value of each input must be indicated by the LED being ON or OFF. The corresponding output must be controlled by the...
With being given two n-bit binary strings, verify if the strings are identical or not. Design...
With being given two n-bit binary strings, verify if the strings are identical or not. Design a procedure showing all steps and write a pseudo-code. What is the complexity of the procedure? If it can tolerate some error, is there a better than linear time solution? If so, write the pseudo-code.
VHDL Code: Design a 16-bit 4-to-1 multiplexer using data-flow implementation style. Data inputs and output should...
VHDL Code: Design a 16-bit 4-to-1 multiplexer using data-flow implementation style. Data inputs and output should be 16-bit vectors. In your test bench, you should include enough number of test cases to show the correctness of your design.
Design a 32 bit after using a single 4 bit using verilog code
Design a 32 bit after using a single 4 bit using verilog code
Design and Test an 8-bit Adder using 4-bit adder. Use 4-bit adder coded in class using...
Design and Test an 8-bit Adder using 4-bit adder. Use 4-bit adder coded in class using full adder that is coded using data flow model. Use test bench to test 8-bit adder and consider at least five different test vectors to test it.
Design a 4-bit multiplier by using 4 bit full adder and write a verilog code.
Design a 4-bit multiplier by using 4 bit full adder and write a verilog code.
Design a 32 bit adder using a single 4 bit adder using verilog code
Design a 32 bit adder using a single 4 bit adder using verilog code
Using Behavorial VHDL, design a 4-bit up/down counter.
Using Behavorial VHDL, design a 4-bit up/down counter.
design a 4 bit comparator that compares two numbers of 4 bits. the output should be...
design a 4 bit comparator that compares two numbers of 4 bits. the output should be < > or =. however you're only limited to using multiplexers or full adders. any help on how to draw this will be appreciated
Design and implementation of 4 bit ALU (74181) using behavioral style of modeling
Design and implementation of 4 bit ALU (74181) using behavioral style of modeling
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT