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)
            // Write solution here
            'b00: alu_op = 'b0001;
            'b01: alu_op = 'b0010;
            'b10: alu_op = 'b0100;
            'b11: alu_op = 'b1000;
            default: alu_op = 0;
        endcase
    end
endmodule

 

Was this helpful?
Upvote
Downvote