Prev Problem
Next Problem

50. 3-Way Selector

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

 

Code

/*Write solution code here*/
module selector3(
    input [7:0]a,
    input [7:0]b,
    input [7:0]c,
    input [7:0]d,
    input [1:0]sel,
    output reg[7:0]y
);

always @(*)begin
    case(sel)
    2'b00 : y[7:0]<=a[7:0];
    2'b01 : y[7:0]<=b[7:0];
    2'b10 : y[7:0]<=c[7:0];
    default : y[7:0] <=8'h00;
    endcase
end
endmodule

 

Was this helpful?
Upvote
Downvote