Skip to content

Commit

Permalink
Add alu
Browse files Browse the repository at this point in the history
  • Loading branch information
t2shashwat committed Feb 27, 2024
1 parent 3fe33ba commit 6fd2183
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion part_1_combinational/Alu.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ typedef enum {
} InstructionType deriving (Eq,FShow, Bits);

function Bit#(32) alu (InstructionType ins, Bit#(32) v1, Bit#(32) v2);
return 0;
Bit#(32) result = case (ins) matches
Add : (v1+v2);
ShiftL : (v1 << v2);
And : (v1 & v2);
Not : (~v1);
endcase;
return result;
endfunction

0 comments on commit 6fd2183

Please sign in to comment.