BitFlow

1-to-4 Demultiplexer

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

1-to-4 Demultiplexer Input: 1-bit `in`, 2-bit select `s[1:0]`. Outputs: `y[3:0]`. The selected output gets `in`; all others are 0. - `s=00 → y[0]=in, y[3:1]=0` - `s=01 → y[1]=in, y[3:2]=0, y[0]=0` - `s=10 → y[2]=in, others=0` - `s=11 → y[3]=in, y[2:0]=0` Use `always @(*)` with `case`. Default all outputs to 0 first, then set the active one.

Constraints

  • Use case inside always @(*).
  • Default y=4'b0000 at top of always block to prevent latches.
  • Declare y as output reg [3:0].

Examples

Input: in=1, s=2'b10

Output: y=4'b0100

Input: in=0, s=2'b10

Output: y=4'b0000

Common questions

What does the 1-to-4 Demultiplexer problem ask you to build?
1-to-4 Demultiplexer Input: 1-bit `in`, 2-bit select `s[1:0]`. Outputs: `y[3:0]`. The selected output gets `in`; all others are 0. - `s=00 → y[0]=in, y[3:1]=0` - `s=01 → y[1]=in, y[3:2]=0, y[0]=0` - `s=10 → y[2]=in, others=0` - `s=11 → y[3]=in, y[2:0]=0` Use `always @(*)` with `case`.
What constraints does 1-to-4 Demultiplexer have?
Use case inside always @(*).; Default y=4'b0000 at top of always block to prevent latches.; Declare y as output reg [3:0].
What is an example input and output for 1-to-4 Demultiplexer?
Input in=1, s=2'b10 gives output y=4'b0100.
Which Verilog concepts does 1-to-4 Demultiplexer practise?
combinational, demux, case, always.