# Example
Keywords: stratus

Subsections

- The addaccu circuit
- The data-path
- Description of the circuit with Stratus : file addaccu.py
- Creation of the circuit : file test.py
- How to execute the file
- The editor
- Function Param
- How to instanciate your generator in another generator
- See Also

##
Example

### The addaccu circuit

### The data-path

### Description of the circuit with Stratus : file addaccu.py

### Creation of the circuit : file test.py

### How to execute the file

    python test.py -n 4

or :

    chmod u+x test.py
    ./test -n 4

### The editor

The method `View` permits to open an editor in which one can see the cell being created as shown in the picture below.

### Function Param

This function allows the user to give parameters when creating a cell.
When one wants to give values to two parameters, one can type on the shell :

    python test.py -n 4 -w 8

The file `test.py` has then to contain :

    nbit, nword = Param ( "n", "w" )

The letters typed on the shell must be the ones given as parameters of function `Param`.

### How to instanciate your generator in another generator

One can create a generator and instantiate it in another generator.
To do that, the model name of the generator must have the form : "file_name.class_name".
Note that if the two generators are not in the same directory, the directory of the generator to be instantiated has to be added in the CRL_CATA_LIB environment variable.

For example, in order to instanciate the addaccu created above in a cell :

    n = 4
    Generate ( "addaccu.addaccu", "my_addaccu_%dbits" % n
             , param = { 'nbit' : n } )

    Inst ( "my_addaccu_%dbits" % n
         , map = { 'a'    : self.netA
                 , 'b'    : self.netB
                 , 'c'    : self.netC
                 , 'v'    : self.netV
                 , 'cmd'  : self.netCmd
                 , 'cout' : self.netCout
                 , 's'    : self.netS
                 , 'vdd'  : self.vdd
                 , 'vss'  : self.vss
                 }
         )

### See Also

Introduction Netlist Layout Place and Route Virtual libraty Instanciation facilities