summaryrefslogtreecommitdiff
path: root/ALU.v
diff options
context:
space:
mode:
authorMichael Abed <michaelabed@gmail.com>2012-02-16 15:46:55 -0500
committerMichael Abed <michaelabed@gmail.com>2012-02-16 15:46:55 -0500
commit0bdf2f0b18f7e2986336f8afc67fe18b8b382e7a (patch)
tree0546ba14ba410a565b6bff722a23b26860744825 /ALU.v
downloadec311-lab2-0bdf2f0b18f7e2986336f8afc67fe18b8b382e7a.tar.gz
ec311-lab2-0bdf2f0b18f7e2986336f8afc67fe18b8b382e7a.tar.bz2
ec311-lab2-0bdf2f0b18f7e2986336f8afc67fe18b8b382e7a.zip
initial commit
Diffstat (limited to 'ALU.v')
-rwxr-xr-xALU.v38
1 files changed, 38 insertions, 0 deletions
diff --git a/ALU.v b/ALU.v
new file mode 100755
index 0000000..86c0372
--- /dev/null
+++ b/ALU.v
@@ -0,0 +1,38 @@
+`timescale 1ns / 1ps
+//////////////////////////////////////////////////////////////////////////////////
+// Company:
+// Engineer:
+//
+// Create Date: 15:30:47 02/15/2012
+// Design Name:
+// Module Name: ALU
+// Project Name:
+// Target Devices:
+// Tool versions:
+// Description:
+//
+// Dependencies:
+//
+// Revision:
+// Revision 0.01 - File Created
+// Additional Comments:
+//
+//////////////////////////////////////////////////////////////////////////////////
+module ALU(
+ input [1:0] s,
+ input [3:0] a,
+ output [3:0] o
+ );
+
+reg [3:0] o;
+
+always @ ( * )
+begin
+ case ( s )
+ 2'd0 : o = a;
+ 2'd1 : o = ~a+1;
+ 2'd2 : o = a >> 1;
+ 2'd3 : o = a % 3;
+ endcase
+end
+endmodule