output reg [7:0] obail, ocuriter);
wire [14:0] r2, i2, ri, diff;
+ wire [15:0] twocdiff;
wire r2sign, i2sign, risign, dsign;
wire [16:0] bigsum;
wire bigsum_ovf, rin_ovf, iin_ovf, throwaway;
assign bigsum_ovf = bigsum[16] | bigsum[15] | bigsum[14];
assign rin_ovf = rd;
assign iin_ovf = id;
- assign diff = (r2 > i2) ? r2 - i2 : i2 - r2;
- assign dsign = (r2 > i2) ? 0 : 1;
+ assign twocdiff = r2 - i2;
+ assign diff = twocdiff[15] ? -twocdiff : twocdiff;
+ assign dsign = twocdiff[15];
always @ (posedge clk)
begin