# VLSI SAPD Documentation

Presentation | AGDS | CIF | DTR | OPENCHAMS | SPICE | Links & Contact

CIF Format

# Presentation

The Caltech Intermediate Format (CIF) consists in a limited set of graphic primitives used to describe the shapes on each layer of an integrated circuit (see http://en.wikipedia.org/wiki/Caltech_Intermediate_Form for more informations).

## Author

Damien Dupuis: damien.dupuis(at)lip6(.)fr

## Limitations

Although the CIF format allows hierarchical description and supports several shapes, in this driver, we do not use hierarchy and only use Polygons.

# Stand alone database structure

The database consists in two simple objects :

- CIF::Circuit contains all CIF circuit informations such as the name, the unit used, the scale and the list of all Polygons.
- CIF::Polygon describes a Polygon (a set of points).

## Using the driver

To drive a CIF file, user has to create one CIF::Circuit and as many CIF::Polygon as the number of shapes of the layout. The CIF::Polygon objects can be created independently from for the CIF::Circuit but must be finally added to the CIF::Circuit using CIF::Circuit::addPolygon().
Once the CIF::Circuit is complete, simply call the CIF::Circuit::writeToFile() method to drive the database to file.

# Examples

As said is the global presentation, VLSI SAPD project provides C++ libraries and Python modules for each supported format. In this section we present two simple code examples to drive a CIF file using C++ or Python. These two examples drive the same file `transistor.cif:`

(CIF file written on 11-Jun-2010 13:49:44 by VLSISAPD_CIF_DRIVER);
(Units: micro - UU/DB Scale: 0.001);
DS 1 1 1;
9 Transistor;
L 6; P 130,290 540,290 540,690 130,690;
L 17; P 305,150 365,150 365,830 305,830;
DF;
C 1;
E
CIF example layout

## C++

Here is the C++ code (`driveCif.cpp`) used to generate the transistor.cif file. (Source is available in examples directory).

#include <string>
using namespace std;
#include "vlsisapd/cif/Circuit.h"
#include "vlsisapd/cif/Polygon.h"
int main(int argc, char * argv[]) {
CIF::Circuit* circuit = new CIF::Circuit(string("Transistor"), string("micro"), 0.001);
// Layer #6 corresponds to active
CIF::Polygon* poly = new CIF::Polygon(6);
poly->addPoint(130, 290);
poly->addPoint(540, 290);
poly->addPoint(540, 690);
poly->addPoint(130, 690);
circuit->addPolygon(poly);
// Layer #17 corresponds to polysilicium
poly = new CIF::Polygon(17);
poly->addPoint(305, 150);
poly->addPoint(365, 150);
poly->addPoint(365, 830);
poly->addPoint(305, 830);
circuit->addPolygon(poly);
circuit->writeToFile("./transistor.cif");
return 0;
}

Note
  In order to compile this code, a CMakeLists.txt file is provided. User must set the $VLSISAPD_TOP variable before running these commands in the directory containing the CMakeLists.txt file:
  %> mkdir build; cd build
  %> cmake ..
  %> make

## Python

Here is the Python code (`driveCif.py`) used to generate the transistor.cif file. (Source is available in examples directory).

import CIF
circuit = CIF.Circuit("Transistor", "micro", 0.001)
poly1 = CIF.Polygon(6)
poly1.addPoint(130, 290)
poly1.addPoint(540, 290)
poly1.addPoint(540, 690)
poly1.addPoint(130, 690)
circuit.addPolygon(poly1)
poly2 = CIF.Polygon(17)
poly2.addPoint(305, 150);
poly2.addPoint(365, 150);
poly2.addPoint(365, 830);
poly2.addPoint(305, 830);
circuit.addPolygon(poly2)
circuit.writeToFile("./transistor.cif")

Note
  In order to run the `driveCif.py` script, user must ensure that $PYTHONPATH variable points to the directory containing CIF.so module.