Heading2 - parameters, Table - table 5-2: parameters, Heading3 - invert_b – Achronix Speedster22i User Macro Guide User Manual
Page 104: Heading3 - verilog instantiation template, Parameters

Arithmetic Functions
ALU
Speedster Macro Cell Library
PAGE 87
Parameters
Table 5-2: Parameters
Parameter
Defined Values
Default Value
invert_b
1’b0
invert_b
The invert_b parameter defines if the ALU functions as an adder or a subtractor. Setting the
invert_b parameter to 1’b0 configures the ALU to perform two’s complement addition of a[1:0]
+ b[1:0] + cin. Setting the invert_b parameter to 1’b1 configures the ALU to invert the b[1:0]
input so that the two’s complement subtraction of a[1:0] ‐ b[1:0] is performed. Note that when
subtractions is desired, the cin input must be tied high. When multiple ALUs are connected to
perform higher resolution subtractors, only the cin of the LSB of the subtractor is to be tied
high.
Table 5-3: Function Table When invert_b = 1’b0.
load
cin
s[1:0]
Note
1
X
d[1:0]
Load
0
-
a[1:0] + b[1:0] + cin
Add
Table 5-4: Function Table When invert_b = 1’b1.
load
cin
s[1:0]
Note
1
X
d[1:0]
Load
0
1
a[1:0] - b[1:0]
Subtract
0
0
a[1:0] - b[1:0] - 1
Subtract - 1
Verilog Instantiation Template
ALU #(.invert_b(1’b0))
instance_name(.a(user_a),
.b(user_b),
.d(user_load_value),
.load(user_load),
.cin(user_carry_in),
.s(user_sum),
.cout(user_cout));
1’b0, 1’b1