4-to-1 MUX with case
beginner · combinational · 45 XP
Sign in to write your solution, run it in the simulator and submit it for grading.
Sign in or create a free account →Problem
4-to-1 MUX with case
4 data inputs `d[3:0]` (each 1 bit), 2-bit select `s[1:0]`, 1-bit output `y`.
Implement using `case(s)` inside `always @(*)`. Must include a `default` branch.
**Truth Table**
| s | y |
|---|---|
| 00 | d[0] |
| 01 | d[1] |
| 10 | d[2] |
| 11 | d[3] |
**Important:** Declare `y` as `reg` when used in an always block.
Constraints
- Use always @(*) with a case statement.
- Include a default branch (y = 1'b0).
- No latches — default prevents them.
Examples
Input: d=4'b1010, s=2'b01
Output: y=1 (d[1])
Input: d=4'b1010, s=2'b10
Output: y=0 (d[2])
Common questions
- What does the 4-to-1 MUX with case problem ask you to build?
- 4-to-1 MUX with case 4 data inputs `d[3:0]` (each 1 bit), 2-bit select `s[1:0]`, 1-bit output `y`. Implement using `case(s)` inside `always @(*)`. Must include a `default` branch.
- What constraints does 4-to-1 MUX with case have?
- Use always @(*) with a case statement.; Include a default branch (y = 1'b0).; No latches — default prevents them.
- What is an example input and output for 4-to-1 MUX with case?
- Input d=4'b1010, s=2'b01 gives output y=1 (d[1]).
- Which Verilog concepts does 4-to-1 MUX with case practise?
- combinational, case, mux, always.