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 reg [3:0] y
);
    always @ (d or s)
        case (s)
            2'b00: y = {3'b000, d};
            2'b01: y = {2'b00, d, 1'b0};
            2'b10: y = {1'b0, d, 2'b00};
            2'b11: y = {d, 3'b00};
        endcase
endmodule

 

Was this helpful?
Upvote
Downvote