Created
July 4, 2016 23:00
-
-
Save szboynono/1978e7ba473bb78b207fbb400e6ba3d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module alu4bits; | |
input [8:0]a,b; | |
input [3:0]sel; | |
output [8:0]z; | |
reg [8:0]z; | |
always @(sel,a,b) | |
begin | |
case(sel) | |
4'b0000: z = a + b; | |
4'b0000: z = a - b; | |
4'b0000: z = b - 1; | |
4'b0000: z = a * b; | |
4'b0000: z = a && b; | |
4'b0000: z = a || b; | |
4'b0000: z = !a; | |
4'b0000: z = ~a; | |
4'b0000: z = a & b; | |
4'b0000: z = a | b; | |
4'b0000: z = a ^ b; | |
4'b0000: z = a << 1; | |
4'b0000: z = a >> 1; | |
4'b0000: z = a + 1; | |
4'b0000: z = a - 1; | |
4'b0000: z = b; | |
endcase | |
end | |
endmodule | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment