aboutsummaryrefslogtreecommitdiffstats
path: root/ee4363/mp1/mp11/MIPSALU.v
diff options
context:
space:
mode:
authorRossTheRoss <mstrapp@protonmail.com>2020-12-03 09:50:18 -0600
committerRossTheRoss <mstrapp@protonmail.com>2020-12-03 09:50:18 -0600
commit8486478a788896848fd1d90448d41bb5ebbbe059 (patch)
tree382e16fac6ad1dbaaf12929891efd5255cbce02d /ee4363/mp1/mp11/MIPSALU.v
parentaaaaaaaaaaaaaaaa (diff)
downloadhomework-8486478a788896848fd1d90448d41bb5ebbbe059.tar
homework-8486478a788896848fd1d90448d41bb5ebbbe059.tar.gz
homework-8486478a788896848fd1d90448d41bb5ebbbe059.tar.bz2
homework-8486478a788896848fd1d90448d41bb5ebbbe059.tar.lz
homework-8486478a788896848fd1d90448d41bb5ebbbe059.tar.xz
homework-8486478a788896848fd1d90448d41bb5ebbbe059.tar.zst
homework-8486478a788896848fd1d90448d41bb5ebbbe059.zip
do machine problem
Diffstat (limited to 'ee4363/mp1/mp11/MIPSALU.v')
-rw-r--r--ee4363/mp1/mp11/MIPSALU.v18
1 files changed, 18 insertions, 0 deletions
diff --git a/ee4363/mp1/mp11/MIPSALU.v b/ee4363/mp1/mp11/MIPSALU.v
new file mode 100644
index 0000000..096aff5
--- /dev/null
+++ b/ee4363/mp1/mp11/MIPSALU.v
@@ -0,0 +1,18 @@
+module MIPSALU (ALUctl, A, B, ALUOut, Zero);
+ input [3:0] ALUctl;
+ input [31:0] A,B;
+ output reg [31:0] ALUOut;
+ output Zero;
+ assign Zero = (ALUOut==0);
+ always @(ALUctl, A, B)
+ case (ALUctl)
+ 0: ALUOut <= A & B;
+ 1: ALUOut <= A | B;
+ 2: ALUOut <= A + B;
+ 6: ALUOut <= A - B;
+ 7: ALUOut <= A < B ? 1:0;
+ 12: ALUOut <= ~(A | B);
+ default: ALUOut <= 0;
+ endcase
+endmodule
+