Prev Problem
Next Problem

66. Demultiplexer

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

module demux1to4 (
    input       d,
    input [1:0] s,
    output [3:0] y
);
    // One-hot mask (1 << s), then gate with d replicated across 4 bits.
    assign y = ({4{d}}) & (4'b0001 << s);
endmodule

 

Was this helpful?
Upvote
Downvote