adding examples for DTR format

This commit is contained in:
Damien Dupuis 2010-06-15 08:58:29 +00:00
parent 688af29e22
commit 5fc116f4b7
10 changed files with 142 additions and 0 deletions

View File

@ -1,2 +1,3 @@
ADD_SUBDIRECTORY(cif)
ADD_SUBDIRECTORY(agds)
ADD_SUBDIRECTORY(dtr)

View File

@ -0,0 +1,4 @@
ADD_SUBDIRECTORY(cplusplus)
ADD_SUBDIRECTORY(python)
INSTALL ( FILES example.dtr.xml DESTINATION share/doc/coriolis2/examples/vlsisapd/dtr )

View File

@ -0,0 +1,8 @@
INCLUDE_DIRECTORIES ( ${VLSISAPD_SOURCE_DIR}/src/dtr/src ${LIBXML2_INCLUDE_DIR})
ADD_EXECUTABLE ( driveDtr driveDtr.cpp )
ADD_EXECUTABLE ( parseDtr parseDtr.cpp )
TARGET_LINK_LIBRARIES ( driveDtr dtr ${LIBXML_LIBRARIES}) # 'driveDtr' is the name of the executable and 'dtr' the name of the target library in dtr/src/CMakeLists.txt
TARGET_LINK_LIBRARIES ( parseDtr dtr ${LIBXML_LIBRARIES})
INSTALL ( TARGETS driveDtr parseDtr DESTINATION share/doc/coriolis2/examples/vlsisapd/dtr )
INSTALL ( FILES driveDtr.cpp parseDtr.cpp DESTINATION share/doc/coriolis2/examples/vlsisapd/dtr )
INSTALL ( FILES cmake.ex DESTINATION share/doc/coriolis2/examples/vlsisapd/dtr RENAME CMakeLists.txt )

View File

@ -0,0 +1,19 @@
PROJECT(PARSEDRIVEDTR)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
SET(CMAKE_MODULE_PATH "$ENV{VLSISAPD_USER_TOP}/share/cmake/Modules"
"$ENV{VLSISAPD_TOP}/share/cmake/Modules"
)
FIND_PACKAGE(VLSISAPD REQUIRED)
FIND_PACKAGE(Libxml2 REQUIRED)
IF(DTR_FOUND)
INCLUDE_DIRECTORIES(${DTR_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})
ADD_EXECUTABLE(driveDtr driveDtr.cpp)
ADD_EXECUTABLE(parseDtr parseDtr.cpp)
TARGET_LINK_LIBRARIES(driveDtr ${DTR_LIBRARY} ${LIBXML2_LIBRARIES})
TARGET_LINK_LIBRARIES(parseDtr ${DTR_LIBRARY} ${LIBXML2_LIBRARIES})
INSTALL(TARGETS driveDtr parseDtr DESTINATION .)
ENDIF(DTR_FOUND)

View File

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

View File

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

View File

@ -0,0 +1,21 @@
<technology name="example" unit="micro">
<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>

View File

@ -0,0 +1 @@
INSTALL ( FILES driveDtr.py parseDtr.py DESTINATION share/doc/coriolis2/examples/vlsisapd/dtr )

View File

@ -0,0 +1,16 @@
from pyDTR import *
import sys
techno = Techno(Name("myTech"), Name("micro"))
techno.addRule (Name("transistorMinL"), 0.1 , Name("0.10"), Name("ref1"))
techno.addRule (Name("transistorMinW"), 0.2 , Name("0.20"), Name("ref2"))
techno.addRule (Name("minWidth") , 0.15, Name("0.15"), Name("ref3"), Name("metal1"))
techno.addRule (Name("minSpacing") , 0.2 , Name("0.20"), Name("ref4"), Name("metal1"))
techno.addRule (Name("minSpacing") , 0.1 , Name("0.10"), Name("ref5"), Name("active"), Name("poly"))
techno.addARule(Name("minExtension") , 0.2 , Name("0.20"), Name("ref6"), Name("poly"), Name("active"))
rule = techno.addRule(Name("minArea"), 0.1, Name("0.10"), Name("ref7"), Name("metal1"))
rule.setType(Name("area"))
techno.writeToFile("./out.dtr.xml")

View File

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