# Stratus

Subsections

- Name
- Description
- Configuration
- Description of a cell
- Creation of the cell
- Syntax
- Syntax highlighting
- Example
- See Also

##
Stratus

### Name

Stratus - Procedural design language based upon Python

### Description

Stratus is a set of Python methods/functions dedicated to procedural generation purposes. From a user point of view, Stratus is a circuit's description language that allows Python programming flow control, variable use, and specialized functions in order to handle vlsi objects.

Based upon the Hurricane data structures, the Stratus language gives the user the ability to describe netlist and layout views.

### Configuration

A configuration file can be used to direct the generation process of Stratus. With this file, the user can choose the output format (vst, vhdl...), the simulator (asimut, ghdl...), the standard cell library... This configuration file named `.st_config.py` must be placed either in the HOME directory or in the current directory. This file contains a set of variables used in the process generation of Stratus, as for example :

    format = 'vhdl'
    simulator = 'ghdl'

The default configuration of Stratus uses the Alliance CAD system, ie `'vst'` as `format` and `'asimut'` as `simulator`.

### Description of a cell

A cell is a hierachical structural description of a circuit in terms of ports (I/Os), signals (nets) and instances.

The description of a cell is done by creating a new class, derivating for class `Model`, with different methods :

- Method `Interface` : Description of the external ports of the cell :
  - SignalIn, SignalOut, ...
- Method `Netlist` : Description of the netlist of the cell :
  - Inst, Signal
- Method `Layout` : Description of the layout of the cell :
  - Place, PlaceTop, PlaceBottom, PlaceRight, PlaceLeft ...
- Method `Stimuli` : Description of the simulation stimuli of the cell :
  - affect, addd ...

### Creation of the cell

After the description of a cell as a sub-class of `Model`, the cell has to be instantiated. The different methods described before have to be called.

Then different methods are provided :

- Method `View` : Opens/Refreshes the editor in order to see the created layout
- Method `Save` : Saves the created cell in the desired format thanks to the configuration file
  - no argument : creation of a netlist file
  - PHYSICAL : creation of a netlist file AND a layout file
  - STRATUS : creation of a python/stratus file
    - FileName : optionnal argument when using Save(STRATUS) in order to choose the name of the file to be generated
    - Be careful : if one wants to create a stratus file AND a netlist, always use Save(STRATUS) before Save() !
- Method `Testbench` : Creates the testbench of the cell using the `Stimuli` method to compute the stimuli. The output format depends of the `format` variable given in the configuration file
- Method `Simul` : Runs the simulation using the simulator named in the configuration file

### Syntax

A Stratus file must have a .py extension and must begin as follow :

    #!/usr/bin/env python

    from stratus import *

The description of a cell as a sub-class of `Model` is done as follow :

    class myClass ( Model ) :
        ...

The creation of the cell is done by instantiating the previous class as follow :

    exemple = myClass ( name, param )

After the different methods can be called as follow :

    exemple.Interface()
    exemple.Netlist()
    exemple.Save()
        ...

In order to execute a Stratus file (named `file` for example), one has two choices :

    python file.py

Or :

    chmod u+x file.py
    ./file.py

The names used in Stratus, as arguments to Stratus functions, should be alphanumerical, including the underscore. The arguments of Stratus are case sensitive, so VDD is not equivalent to VDD.

Vectorized connectors or signal can be used using the [N:M] construct.

### Syntax highlighting

When using vi, it's possible to have the right syntax highlighting :

- Commands to do when you want to change once the coloration of your file :

    :syntax off
    :source /asim/coriolis/share/etc/stratus.vim

- Modification of your .vimrc in order to have the syntax highlighting each time you open a file :

    syntax off
    autocmd BufRead,BufNewfile *.py so /asim/coriolis/share/etc/stratus.vim
    syntax on

### Example

You can see a concrete example at : Example

### See Also

Netlist Layout Stimuli Place and Route Virtual librayy Instanciation facilities