Prev Problem
Next Problem

66. Demultiplexer

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

/*Write your code here*/
module demux1to4(
    input d,
    input [1:0]s,
    output reg [3:0]y
);
  always@(*)begin
    y = 4'd0;
    case(s)
     2'd0 : y[0] = d;
     2'd1 : y[1] = d;
     2'd2 : y[2] = d;
     2'd3 : y[3] = d;
     default: y[s] = 1'b0;
    endcase
  end
endmodule

 

Was this helpful?
Upvote
Downvote