Prev Problem
Next Problem

51. Opcode Decoder

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

 

Code

module alu_decoder (
    input  [1:0] opcode,
    output reg [3:0] alu_op
);
    always @* begin
        case (opcode)
            2'b0: alu_op = 4'b01;
            2'b1: alu_op = 4'b10;
            2'b10: alu_op = 4'b100;
            2'b11 : alu_op = 4'b1000;
        endcase
    end
endmodule

 

Was this helpful?
Upvote
Downvote