Subsections

- Description
- List
- Generators to instantiate
- Example
- Errors
- See Also

##
Arithmetical operations

### Description

Most common arithmetic operators can be instantiated without the `Inst` constructor.

### List

Arithmetical operators are listed below :

- `Addition` : `q <= i0 + i1`
- `Substraction` : `q <= i0` - `i1`
- `Multiplication` : `q <= i0 * i1`
- `Division` : `q <= i0 / i1`

### Generators to instantiate

One can choose the generator to be used. Some methods are applied to the cell and set the generator used when using overloard. Methods are :

- `SetAdd` (for addition and substraction)
- `SetMult`
- `SetDiv`

The generators used by default are :

- `Addition` : Slansky adder
- `Substraction` : Slansky adder + inversor + cin = '1'
- `Multiplication` : CA2 multiplier (signed, modified booth/Wallace tree)
- `Division` : not available yet

### Example

    class essai ( Model ) :

      def Interface ( self ) :
        self.A = SignalIn  ( "a", 4 )
        self.B = SignalIn  ( "b", 4 )

        self.S = SignalOut ( "s", 4 )

        self.T = SignalOut ( "t", 8 )

        self.vdd = VddIn  ( "vdd" )
        self.vss = VssIn  ( "vss" )

      def Netlist ( self ) :

        self.S <= self.A + self.B

        self.T <= self.A * self.B

### Errors

Some errors may occur :

- `[Stratus ERROR] + : the nets must have the same lenght.`
  When one uses arithmetic expressions, one has to check that the sizes of both nets are equivalent.
- `[Stratus ERROR] : there is no alim.`
  The cell being created does not have the alimentation nets. The instanciation is impossible.

### See Also

Introduction Netlist Instanciation of a multiplexor Instanciation of a shifter Instanciation of a register Instanciation of constants Boolean operations Comparison operations