aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ecp5/alu.v
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ecp5/alu.v')
-rw-r--r--tests/ecp5/alu.v19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ecp5/alu.v b/tests/ecp5/alu.v
new file mode 100644
index 000000000..f82cc2e21
--- /dev/null
+++ b/tests/ecp5/alu.v
@@ -0,0 +1,19 @@
+module top (
+ input clock,
+ input [31:0] dinA, dinB,
+ input [2:0] opcode,
+ output reg [31:0] dout
+);
+ always @(posedge clock) begin
+ case (opcode)
+ 0: dout <= dinA + dinB;
+ 1: dout <= dinA - dinB;
+ 2: dout <= dinA >> dinB;
+ 3: dout <= $signed(dinA) >>> dinB;
+ 4: dout <= dinA << dinB;
+ 5: dout <= dinA & dinB;
+ 6: dout <= dinA | dinB;
+ 7: dout <= dinA ^ dinB;
+ endcase
+ end
+endmodule