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
);

integer i;
always @(*) begin
    for (i=0; i<4; i=i+1) begin
        if (s == i) begin
            y[i] = d ;
        end else begin
            y[i] = 1'b0;
        end
    end
end

endmodule

 

Was this helpful?
Upvote
Downvote