From 59d89428d6160fb672c2b6a41339505cc69344d0 Mon Sep 17 00:00:00 2001 From: Michael Abed Date: Fri, 17 Feb 2012 12:10:31 -0500 Subject: finish it --- ALU.v | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ALU.v') diff --git a/ALU.v b/ALU.v index 86c0372..af9b1a8 100755 --- a/ALU.v +++ b/ALU.v @@ -29,10 +29,10 @@ 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; + 2'b00 : o = a; + 2'b01 : o = (a != 4'b1000 ) ? (~a)+1 : 4'b0111; + 2'b10 : o = (a[3] != 1'b1 ) ? a >> 1 : ~(((~a)+4'b0001) >> 1)+4'b0001; + 2'b11 : o = (a[3] != 1'b1 ) ? a % 3 : ~(((~a)+4'b0001) % 3)+1; endcase end endmodule -- cgit v1.2.3-54-g00ecf