# Comparison operations
Keywords: stratus

Subsections

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

##
Comparison operations

### Name

Eq/Ne : Easy way to test the value of the nets

### Synopsys

    netOut <= net.Eq ( "n" )

### Description

Comparaison functions are listed below :

- `Eq` : returns `true` if the value of the net is equal to `n`.
- `Ne` : returns `true` if the value of the net is different from `n`.

Note that it is possible to change the generator instanciated with the `SetComp` method.

### Parameters

The constant given as argument 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.A = SignalIn  ( "a", 4 )

        self.S = SignalOut ( "s", 1 )
        self.T = SignalOut ( "t", 1 )

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

      def Netlist ( self ) :

        self.S <= self.A.Eq ( "4" )

        self.T <= self.A.Ne ( "1" )

### Errors

Some errors may occur :

- `[Stratus ERROR] Eq :`
  `the number does not match with the net's lenght.`
  When one uses comparaison functions on one net, one has to check that the number corresponds to the size of the net.
- `[Stratus ERROR] Eq :`
  `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 Instanciation of constants Boolean operations Arithmetical operations