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
            2'd0:
            alu_op= 4'b0001 << opcode;
            2'd1:
            alu_op= 4'b0001 << opcode;
            2'd2:
            alu_op= 4'b0001 << opcode;
            2'd3:
            alu_op= 4'b0001 << opcode;

            default:
            alu_op= 4'b0000;

            
        endcase
    end
endmodule

 

Was this helpful?
Upvote
Downvote