Previous

ADDER/SUBTRACTER

The Adder/Subtracter module adds or subtracts two data inputs and a Carry Input. You can use this module as an adder, as a subtracter, or both. The Adder/Subtracter provides a Carry Output and an Overflow output to indicate the status of the current arithmetic operation.

There are two types of Adders/Subtracters: those that add or subtract the values applied via two bus-pins, and those that add a constant to or subtract a constant from a value applied to one bus-pin.

The Adder/Subtracter module permits the user to register any or all of its outputs.

Figure 4.2 The Adder/Subtracter Module (Unregistered)

Figure 4.3 The Adder/Subtracter Module (Registered)

Input Pins

A

The data on the A input port, along with the Carry Input port, is added to or subtracted from the data on the B input port (A+B + C_IN or A - B - C_IN).

Connections: Pin A is required.

Add/Sub (ADD_SUB)

The input on this pin determines whether the module should operate as an adder or as a subtracter. If the input is High, the module performs an addition. If the input is Low, the module performs a subtraction.

Connections: This pin is available only if you set the Operation attribute to Add/Subtract. If you select either of the individual Add or Subtract operation modes, the Add/Sub input pin is removed from the module.

Carry Input (C_IN)

The Carry Input port, together with the data on the B input port, is added to or subtracted from the value on port A (A + B + C_IN or A - B - C_IN).

Connections: Carry Input is optional. Its value depends on whether the Operation mode is Add or Subtract. If Carry Input is not specified, the default values are 0 for Add and 1 for Subtract.

B

The data on the B input port, along with the Carry Input port, is added to or subtracted from the data on the A input port (A + B + C_IN or A - B - C_IN).

Connections: The B input is present if a Constant value is not specified. If you set the Constant Value attribute, you generate a schematic symbol with a Constant input instead of the B input.

Additional Input Pins for Registered Modules

Load (LOAD)

When the Asynchronous Control and the Synchronous Control pins are Low, the data on the B port is loaded directly into the register on the next active Clock transition.

Connections: Load is optional. If Load is High, the data on the B port is loaded directly into the register. If Load is Low, the output of Adder/Subtracter is registered instead.

Clock Enable (CLK_EN)

Whenever the Clock Enable input is High, either the data on the B input port, the output of the adder/subtracter, or the value assigned to the Synchronous Value attribute is loaded into the register on the next active Clock transition.

If the Clock Enable input is Low, the register contents are unaffected by the Clock and the register holds its current value. This input does not affect an asynchronous load operation, which occurs when the Asynchronous Control pin is asserted.

Connections: Clock Enable is optional. Use this input when you need to disable the clock temporarily. If you do not use the Clock Enable input, the Clock is always enabled.

Clock (CLOCK)

If the Clock Enable input is High, the rising clock edge loads the selected data into the Adder/Subtracter register. The falling (negative) clock edge can be used for loading data by connecting an inverter to the Clock input.

Connections: The Clock pin is always specified when any of the Adder/Subtracter modules outputs are registered.

Async. Control (ASYNC_CTRL)

The Asynchronous Control input is a level-sensitive input. When this input is High, it loads the value assigned to the Asynchronous Value attribute into the Adder/Subtracter register independently of the Clock and Clock Enable.

Connections: If you specify the Asynchronous Control pin, you can assign a value to the Asynchronous Value attribute. By default, the Asynchronous Value is assigned a value of zero if it is not specified. The Asynchronous Value attribute may also be specified to define the Adder/Subtracter register's power-on value.

Sync. Control (SYNC_CTRL)

Whenever the Synchronous Control and Clock Enable inputs are High, the value assigned to the Synchronous Value attribute is loaded into the Adder/Subtracter register on the next active clock transition. This input has priority over the Load input if both pins are High at the same time.

Connections: If you specify the Synchronous Control pin and do not assign a value to the Synchronous Value attribute, a default value of 0 is used and a warning is issued.


NOTE

Asserting either Asynchronous Control or Synchronous Control affects all registered elements - the Adder/Subtracter register and potentially the Carry Output and Overflow registers. The Asynchronous Value and Synchronous Value fields may contain data for all three registered elements. See the “Synchronous and Asynchronous Control” section of the “Understanding Attributes” chapter for more information about specifying the synchronous and asynchronous value of these elements.


Output Pins

One or more of the following output pins must be specified:

Sum (SUM)

Sum contains the result of the arithmetic operation performed on the Adder/Subtracter's inputs. The output is called Sum if the module is not registered. For a registered module, the output is Q_OUT.

Connections: The Sum bus is the output of the Adder/Subtracter and is required if no other output pin is specified.

Overflow (OVFL)

Overflow is the overflow output from the adder/subtracter. The overflow output is High when the result of the operation exceeds the maximum allowed value of the adder/subtracter.

Connections: Overflow is optional. Either the Overflow or the Registered Overflow output can be specified, but not both.

Carry Output (C_OUT)

Carry Output is the carry out from the most significant bit of the adder/subtracter.

Connections: Carry Output is optional. Either the Carry Output or the Registered Carry Output can be specified, but not both.

Additional Output Pins for Registered Modules

Q_OUT

Q_OUT always reflects the current contents of the Adder/Subtracter register.

Connections: Q_OUT is always specified for registered modules.

Reg'd Overflow (OVFL)

Registered Overflow is the overflow from the Adder/Subtracter register. The overflow output is High when the result of the operation exceeds the maximum allowed value of the adder/subtracter.

Connections: Registered Overflow is optional. Either the Overflow or the Registered Overflow output can be specified, but not both.

Reg'd Carry Output (C_OUT)

Registered Carry Output is the carry out from the most significant bit of the Adder/Subtracter register.

Connections: Registered Carry Output is optional. Either the Carry Output or the Registered Carry Output can be specified, but not both.

Attributes

C Value (C_VALUE)

Use the Constant Value attribute to replace the B input port with a constant value. If you do not define this attribute, the B pin is present.

Operation (OPTYPE)

Use the Operation attribute to specify one of the three possible arithmetic operation modes: Add, Subtract, or Add/Subtract. If you select Add/Subtract, an Add/Sub pin is automatically added to the module.

Style (STYLE)

Style defines the implementation style (area or speed preference).

Usage: For more information, see the “Implementation Styles” section of the “Understanding Attributes” chapter.

Encoding (ENCODING)

Encoding defines the encoding scheme assumed in the generation of the overflow output logic. Valid values are Signed and Unsigned.

Additional Attributes for Registered Modules

Async. Val (ASYNC_VAL)

The value of the Asynchronous Value attribute defines the power-on contents of the register. It also determines the data values assigned to the three registered elements: the Adder/Subtracter register, the Registered Carry Out register, and the Registered Overflow register. On assertion of the Asynchronous Control pin, the data values for the specified pins are extracted from the value assigned to the Asynchronous Value attribute.

Usage: Asynchronous Value is always available. You can define it whether or not you use the Asynchronous Control pin. If you do not specify a value, the default value is zero.

Sync. Val (SYNC_VAL)

The Synchronous Value attribute defines the value to which the register returns on assertion of the Synchronous Control pin. It also determines the data values assigned to the three registered elements: the Accumulator register, the Registered Carry Out register, and the Registered Overflow register. On assertion of the Synchronous Control pin, the data values for the specified pins are extracted from the value assigned to the Synchronous Value attribute.

Usage: Synchronous Value is available only if you specify the Synchronous Control pin. The default value is zero.

Next