# VLSI SAPD Documentation

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

DTR Format

# Presentation

The Design Technology Rules (DTR) format was developped as a part of the Chams Project (http://www-soc.lip6.fr/recherche/cian/chams/). It aims at offering a generic description of layout design rules for CMOS technologies.

## Author

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

## Limitations

Only simple rules are supported at the moment. For example the minimum width of a metal layer has only one value, although it should depends on the length of the wire drawned.

# Stand alone database structure

The database contains four object :

- DTR::Techno contains generic informations such as the name of the technology and the unit used, and the list of all technologic rules.
- DTR::Rule & DTR::ARule respectively describe a symmetrical and an asymmetrical rule.

The library also use the DTR::DTRException class to throw excptions.

## Using the parser

Simply load a technology with static function DTR::Techno::readFromFile() and then get rules (DTR::Techno::getRule()) or directly values (DTR::Techno::getValue()).

## Using the driver

Using the driver is very simple, user has to create a DTR::Techno object and simply add DTR::Rule or DTR::ARule to it. The adding methods return the newly created Rule so user can set the rule type (DTR::Rule::setType()) if necessary. Finally use the DTR::Techno::writeToFile() method to dump 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 simple code examples to parse and drive a DTR file using C++ or Python. The DTR file considered is the same for all examples: `example.dtr.xml`

<technology name="example" unit="micro" version="rev.A">
<physical_rules>
<!-- transistor -->
<rule name="transistorMinL" value="0.10" ref="ref1"/>
<rule name="transistorMinW" value="0.20" ref="ref2"/>
<!-- minWidth -->
<rule name="minWidth" layer="metal1" value="0.15" ref="ref3"/>
<!-- minSpacing -->
<rule name="minSpacing" layer="metal1" value="0.20" ref="ref4"/>
<rule name="minSpacing" layer1="active" layer2="poly" value="0.10" ref="ref5"/>
<!-- minExtension -->
<arule name="minExtension" layer1="poly" layer2="active" value="0.20" ref="ref6"/>
<!-- minArea -->
<rule name="minArea" type="area" layer="metal1" value="0.100" ref="ref7"/>
</physical_rules>
</technology>

All source codes are available in the `examples` directory.

## C++

### Parser

The following code (`parseDtr.cpp`) is an example of how to parse a DTR file using C++ library.

#include <iostream>
#include <string>
using namespace std;
#include "vlsisapd/dtr/Techno.h"
int main(int argc, char * argv[]) {
DTR::Techno* techno = DTR::Techno::readFromFile("./example.dtr.xml");
cerr << "+-----------------------------+" << endl
<< "| technology: " << techno->getName() << " |" << endl
<< "| units: " << techno->getUnit() << " |" << endl
<< "| version: " << techno->getVersion() << " |" << endl
<< "+-----------------------------+" << endl << endl;
cerr << "transistorMinL = " << techno->getValue("transistorMinL") << endl
<< "transistorMinW = " << techno->getValueAsString("transistorMinW") << endl
<< "minWidth of metal1 = " << techno->getValue("minWidth", "metal1") << endl
<< "minSpacing of metal1 = " << techno->getValue("minWidth", "metal1") << endl
<< "minSpacing of active vs poly = " << techno->getValue("minSpacing", "active", "poly") << endl
<< "minExtension active over poly = " << techno->getValue("minExtension", "poly", "active") << endl
<< "minArea of metal1 = " << techno->getValue("minArea", "metal1") << endl;
return 0;
}

### Driver

This C++ code (`driveDtr.cpp`) generates a out.dtr.xml file equivalent to the previous example.dtr.xml.

#include <string>
using namespace std;
#include "vlsisapd/dtr/Techno.h"
#include "vlsisapd/dtr/Rules.h"
int main(int argc, char * argv[]) {
DTR::Techno* techno = new DTR::Techno("MyTech", "micro", "rev.A");
techno->addRule ("transistorMinL", 0.1 , "ref1");
techno->addRule ("transistorMinW", 0.2 , "ref2");
techno->addRule ("minWidth" , 0.15, "ref3", "metal1");
techno->addRule ("minSpacing" , 0.2 , "ref4", "metal1");
techno->addRule ("minSpacing" , 0.1 , "ref5", "active", "poly");
techno->addARule("minExtension" , 0.2 , "ref6", "poly" , "active");
DTR::Rule* rule = techno->addRule("minArea", 0.1, "ref7", "metal1");
rule->setType("area");
techno->writeToFile("./out.dtr.xml");
return 0;
}

Note
  In order to compile these codes, 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

### Parser

The following python script (`parseDtr.py`) is an example of how to parse a DTR file using python module.

from DTR import *
from decimal import Decimal
techno = Techno.readFromFile("./example.dtr.xml")
print "+-----------------------------+"
print "| technology: "+techno.get) + " |"
print "| units: "+techno.getUnit() +" |"
print "| version: "+techno.getVersion()+" |"
print "+-----------------------------+\n\n"
print "transistorMinL = %s"%techno.getValue("transistorMinL")
print "transistorMinW = %s"%Decimal(techno.getValueAsString("transistorMinW"))
print "minWidth of metal1 = %s"%techno.getValue("minWidth", "metal1")
print "minSpacing of metal1 = %s"%techno.getValue("minWidth", "metal1")
print "minSpacing of active vs poly = %s"%techno.getValue("minSpacing", "active", "poly")
print "minExtension active over poly = %s"%techno.getValue("minExtension", "poly", "active")
print "minArea of metal1 = %s"%techno.getValue("minArea", "metal1")
# an example of why it is important to use Decimal in python:
print techno.getValue("minArea", "metal1")*3-0.3 # returns 5.55111512313e-17
print Decimal(techno.getValueAsString("minArea", "metal1"))*3-Decimal('0.3') # returns 0.000

### Driver

This python script (`driveDtr.py`) generates a out.dtr.xml file equivalent to the previous example.dtr.xml.

from DTR import *
techno = Techno("myTech", "micro", "rev.A")
techno.addRule ("transistorMinL", 0.1 , "ref1")
techno.addRule ("transistorMinW", 0.2 , "ref2")
techno.addRule ("minWidth" , 0.15, "ref3", "metal1")
techno.addRule ("minSpacing" , 0.2 , "ref4", "metal1")
techno.addRule ("minSpacing" , 0.1 , "ref5", "active", "poly")
techno.addARule("minExtension" , 0.2 , "ref6", "poly", "active")
rule = techno.addRule("minArea", 0.1, "ref7", "metal1")
rule.setType("area")
techno.writeToFile("./out.dtr.xml")

Note
  In order to run these two scripts (`parseDtr.py` & driveDtr.py), user must ensure that $PYTHONPATH variable points to the directory containing DTR.so module.

Generated by doxygen 1.8.14 on Mon Apr 27 2020 | Return to top of page

VLSI SAPD Documentation | Copyright © 2010 - 2011 UPMC All rights reserved