From 0bdf2f0b18f7e2986336f8afc67fe18b8b382e7a Mon Sep 17 00:00:00 2001 From: Michael Abed Date: Thu, 16 Feb 2012 15:46:55 -0500 Subject: initial commit --- ALU.v | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 ALU.v (limited to 'ALU.v') 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 -- cgit v1.2.3