Mux using 2*1 Mux

Problem Description

Multiplexers are fundamental building blocks in digital systems used for signal selection and routing. Instead of designing large multiplexers directly, hardware engineers often construct them hierarchically using smaller, reusable modules.

In this challenge, you are given a working 2:1 multiplexer module named mux_2to1. Your task is to design a 4:1 multiplexer named mux_4_to_1 using only this provided module.

Requirements:

  • Reuse the given mux_2to1 module.

  • Implement the 4:1 MUX using structural modeling (module instantiation).

  • Do not use assign statements, case, if, or behavioral logic to directly create the 4:1 selection.

  • The select input is 2-bit wide.

  • The output must match standard 4:1 MUX behavior.

Functional Behavior:

  • sel = 2'b00 → output = i0

  • sel = 2'b01 → output = i1

  • sel = 2'b10 → output = i2

  • sel = 2'b11 → output = i3

Verilog

Code Editor Access

Log in to write, run and submit your solution to this interview question. It's free.

Output

Output goes here...