Skip to content

Instantly share code, notes, and snippets.

@unixb0y
Created February 19, 2018 15:53
Show Gist options
  • Save unixb0y/6a5a49b2afbe33d750cab0d9cddad8d5 to your computer and use it in GitHub Desktop.
Save unixb0y/6a5a49b2afbe33d750cab0d9cddad8d5 to your computer and use it in GitHub Desktop.
ALU start
module alu(input logic [31:0] A, B, input logic [2:0] OPC, output logic [31:0] Y);
logic [31:0] temp;
Shifter shift(.A(A), .B(B), .Y(temp));
always_comb
case(OPC)
0: Y = temp;
default: Y = 32'd0;
endcase
endmodule
module Shifter(input logic [31:0] A, B, output logic [31:0] Y);
assign Y = A << B;
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment