From 17f5cbe781ae761d86d55fec7d46ba3172167894 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Sun, 8 Jan 2017 21:58:16 -0600 Subject: Add carry input to ALU --- alu_tb.v | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'alu_tb.v') diff --git a/alu_tb.v b/alu_tb.v index 31141ce..bfe3e8a 100644 --- a/alu_tb.v +++ b/alu_tb.v @@ -11,6 +11,7 @@ module alu_tb (); reg expected_zero; wire carry; reg expected_carry; + reg carry_in; reg [3*8:0] opstr; integer file, r; @@ -24,9 +25,12 @@ module alu_tb (); while (!$feof(file)) begin r = $fscanf(file, " 0x%x %3s 0x%x = 0x%x Z=%x C=%x\n", x, opstr, y, expected_result, expected_zero, expected_carry); + carry_in = opstr == "++" || opstr == "--"; case (opstr) - "+" : op = 0; - "-" : op = 1; + "+" : op = 0; + "++" : op = 0; + "-" : op = 1; + "--" : op = 1; "*" : op = 2; "/" : op = 3; "&" : op = 4; @@ -59,6 +63,7 @@ module alu_tb (); .op(op), .x(x), .y(y), + .carry_in(carry_in), .result(result), .zero(zero), .carry(carry) -- cgit v1.2.3