Prev Problem
Next Problem

67. Decoder

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

module decoder3to8 (
    input [2:0]s,
    output reg [7:0]y
);
always@(*) begin
    case(s)
    3'b000 : begin y = 8'b00000001 ; end
    3'b001 : begin y = 8'b00000010 ; end
    3'b010 : begin y = 8'b00000100 ; end
    3'b011 : begin y = 8'b00001000 ; end
    3'b100 : begin y = 8'b00010000 ; end
    3'b101 : begin y = 8'b00100000 ; end
    3'b110 : begin y = 8'b01000000 ; end
    3'b111 : begin y = 8'b10000000 ; end
    endcase
end
endmodule

 

Was this helpful?
Upvote
Downvote