Question

Instantiate four copies of the mux2_1b in mux2_4b file. Connect the 1-bit muxes (4 mux2_1b instances)...

Instantiate four copies of the mux2_1b in mux2_4b file. Connect the 1-bit muxes (4

mux2_1b instances) with ports of mux2_4b to produce 4-bit wide 2:1 multiplexer. This is

an example of hierarchical design with reusable modules.

The mux2_4b module receives input signals a[3:0], b[3:0], sel, and generates an output

signals y[3:0].

I already have a 2_1bit mux verilog coded out but I am not getting correct results intended by what the question is asking.

//multiplexer using copies of a mux2:1

module mux2_4b(c,d,sel,y);

       input [3:0]c;
       input [3:0]d;
       input sel;
       output reg [3:0]y;
      
      
       mux2 f1(.a(c[0]),.b(d[0]),.sel(sel),.x(y[0]));
       mux2 f2(.a(c[1]),.b(d[1]),.sel(sel),.x(y[1]));
       mux2 f3(.a(c[2]),.b(d[2]),.sel(sel),.x(y[2]));
       mux2 f4(.a(c[3]),.b(d[3]),.sel(sel),.x(y[3]));


       // always @(sel, c , d)
       //       if (sel == 0)
       //   //       y <= c;
           //   else
       //           y <= d;
                      
       endmodule

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Instantiate four copies of the mux2_1b in mux2_4b file. Connect the 1-bit muxes (4 mux2_1b instances)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • 3. From the slides and the reference materials, we see that there are two methods for...

    3. From the slides and the reference materials, we see that there are two methods for implementing logic in Verilog HDL. The circuit can be described using "Structural Verilog or "Behavioral Verilog." In Structural Verilog the structure of the circuit is defined using Boolean algebra statements. In Behavioral Verilog the circuit is defined by its behavior. Below are examples of a 2x1 multiplexer implemented using structural and behavioral Verilog. STRUCTRAL 2x1 MULTIPLEXER CODE: // Example 5a: 2-to-1 MUX using logic...

  • 2. Let’s create a module that defines a 4:1 mux by instantiating three 2:1 muxes. Assume the modu...

    2. Let’s create a module that defines a 4:1 mux by instantiating three 2:1 muxes. Assume the module we are going to instantiate has the interface definition: (a) First, write the code that would go inside the module defined above. (b) Now define the interface for your 4:1 mux. You can call the module anything you want and use any variable names you want. But think about how many inputs you’ll need. (c) Now instantiate three instances of the 2:1...

  • A specific type of bit-level manipulation consists in setting or clearing one single bit in a...

    A specific type of bit-level manipulation consists in setting or clearing one single bit in a multi-bit value, given its index and its new value. This operation can be implemented in hardware by a BitSet circuit with the following interface: Input x is a 4-bit value representing the original value. Output y is a 4-bit value representing the modified value, after the bit-set operation. Input index is a 2-bit value, ranging from 0 to 3, indicating the index of the...

  • Please code the following in Verilog: Write the HDL gate-level hierarchical description of a four-bit adder-subtractor...

    Please code the following in Verilog: Write the HDL gate-level hierarchical description of a four-bit adder-subtractor for unsigned binary numbers similar to the following circuit. You can instantiate the four-bit full adder described in the following example code Figure 4.13a, 4-Bit adder-subtractor without overflow Inputs: 4-Bit A, 4-Bit B, and Mode M (0-add/1-subtract) Interfaces: Carry Bits C1, C2, C3 Outputs: Carry C (1 Bit, C4), Sum S (4 bit) Bo A FA FA FA FA module Add half (input a,...

  • 2. Let's create a module that defines a 4:1 mux by instantiating three 2:1 muxes. Assume the modu...

    2. Let's create a module that defines a 4:1 mux by instantiating three 2:1 muxes. Assume the module we are going to instantiate has the interface definition: module mux2tol (wO,wl,s,f); input w0, wl, s; output f (a) First, write the code that would go inside the module defined above. (b) Now define the interface for your 4:1 mux. You can call the le anything you wa But think about how many inputs you'll need. 2. Let's create a module that...

  • Building and testing basic combinational circuits using Verilog HDL Description: Build and test the following circuits using gate-level modeling in Verilog HDL 1.3-input majority function 2.Condition...

    Building and testing basic combinational circuits using Verilog HDL Description: Build and test the following circuits using gate-level modeling in Verilog HDL 1.3-input majority function 2.Conditional inverter (see the table below: x - control input, y -data input). Do NOT use XOR gates for the implementation. Output 3. Two-input multiplexer (see the table below: x.y -data inputs, z- control input) Output 4. 1-bit half adder. 5. 1-bit full adder by cascading two half adders 6.1-bit full adder directly (as in...

  • Question 3 (3 marks) Identify at least 3 errors in the Verilog modules below. module simpleALU(mput...

    Question 3 (3 marks) Identify at least 3 errors in the Verilog modules below. module simpleALU(mput [31:0) A, B, input [2:0) F, output reg [31:0) Y) endmodule module alu simpleTestbenchO; wire [10:0] inA, inB wire [2:0] sel; reg [31-0] outY simpleALU dut(sel, outY, inA, inB) initial (sel, inA, inB)-: #10 sei 3.6010; (inA, inB) - 16h0000 0000 0000 0000; #10 sel 3bl 10; finA, inB)- 16h0000 0000 FFFF_FFFF: endmodule

  • why its 4-to-1 mux behavioral? What does the logic circuit represented by the following Verilog module...

    why its 4-to-1 mux behavioral? What does the logic circuit represented by the following Verilog module do, and what Verilog description style does it use? // My Verilog module #1 module mymodl ( x, d, q) input[1:0] x;input[3:0] d;output q; reg q; wire [1:0] x; wire [3:0] d; always ( x or d) begin case ( x ) 1 : q=d[1]; 2 : g=d[2]; 3 q d[3]; endcase end endmodule

  • Building and testing basic combinational circuits using Verilog HDL Description: Build and test t...

    Building and testing basic combinational circuits using Verilog HDL Description: Build and test the following circuits using gate-level modeling in Verilog HDL. 1. 3-input majority function. 2. Conditional inverter (see the table below: x - control input, y - data input). Do NOT use XOR gates for the implementation.    x y Output 0   y 1   y' 3. Two-input multiplexer (see the table below: x,y - data inputs, z - control input).     z Output 0 x 1 y 4. 1-bit half...

  • Consider the circuit in Figure 1. It is a 4-bit (QQ2Q3) synchronous counter which uses four T-typ...

    Consider the circuit in Figure 1. It is a 4-bit (QQ2Q3) synchronous counter which uses four T-type flip-flops. The counter increases its value on each positive edge of the clock if the Enable signal is asserted. The counter is reset to 0 by setting the Clear signal low. You are to implement an 8-bit counter of this type Enable T Q Clock Clear Figure 1. 4-bit synchronous counter (but you need to implement 8-bit counter in this lab) Specific notes:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT