# Constants
Keywords: stratus

Subsections

- Name
- Synopsys
- Description
- Parameters
- Example
- Errors
- See Also

##
Constants

### Name

Constant - Easy way to instantiate constants

### Synopsys

    netOne  <=  One ( 2 )

    net8    <= "8"

### Description

These functions simplify the way to instanciate constants.

- The functions `One` and`Zero` permits to initialise all the bits of a net to 'one' or 'zero'.
- The instanciation of a constant thanks to a string can be done in decimal, hecadecimal or binary.

### Parameters

- For `One` and `Zero` :
  - `n` : the arity of the net
- For the instanciation of a constant :
  - the constant given must be a string representing :
    - A decimal number
    - A binary number : the string must begin with "0b"
    - An hexadecimal number : the string must begin with "0x"

### Example

    class essai ( Model ) :

      def Interface ( self ) :
        self.Ones   = SignalOut (   "ones", 2 )
        self.Zeros  = SignalOut (  "zeros", 4 )

        self.Eight  = SignalOut (  "eight", 4 )
        self.Twentu = SignalOut ( "twenty", 5 )
        self.Two    = SignalOut (    "two", 5 )

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

      def Netlist ( self ) :

        self.Ones  <=  One ( 2 )
        self.Zero  <= Zero ( 4 )

        self.Eight   <= "8"
        self.Twenty  <= "0x14"
        self.Two     <= "0b10"

### Errors

Some errors may occur :

- `[Stratus ERROR] Const :`
  `the argument must be a string representing a number in decimal,`
  `binary (0b) or hexa (0x).`
  The string given as argument does not have the right form.

### See Also

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