YEAH a brand new CIF driver !!!
CIF is a text format CIF can be directly read by cadence -> we should be able to script multi layout generation / load into cadence / drc check
This commit is contained in:
parent
e5a423fbd7
commit
b23964b8c3
|
@ -7,5 +7,6 @@ SET(CMAKE_MODULE_PATH "${IO_SOURCE_DIR}/cmake_modules/")
|
||||||
FIND_PACKAGE(LibXml2 REQUIRED)
|
FIND_PACKAGE(LibXml2 REQUIRED)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(agds)
|
ADD_SUBDIRECTORY(agds)
|
||||||
|
ADD_SUBDIRECTORY(cif)
|
||||||
ADD_SUBDIRECTORY(openChams)
|
ADD_SUBDIRECTORY(openChams)
|
||||||
ADD_SUBDIRECTORY(cmake_modules)
|
ADD_SUBDIRECTORY(cmake_modules)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
INCLUDE_DIRECTORIES(${CHAMS_SOURCE_DIR}/cif)
|
||||||
|
|
||||||
|
SET ( includes CifCircuit.h CifPolygon.h )
|
||||||
|
SET ( cpps CifCircuit.cpp CifPolygon.cpp )
|
||||||
|
|
||||||
|
ADD_LIBRARY(cif ${cpps})
|
||||||
|
INSTALL(TARGETS cif DESTINATION /lib)
|
||||||
|
|
||||||
|
INSTALL(FILES ${includes} DESTINATION /include/io/cif)
|
|
@ -0,0 +1,53 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <ctime>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "CifCircuit.h"
|
||||||
|
#include "CifPolygon.h"
|
||||||
|
|
||||||
|
namespace IO {
|
||||||
|
|
||||||
|
CifCircuit::CifCircuit(string name) : _name(name) {}
|
||||||
|
|
||||||
|
|
||||||
|
bool CifCircuit::addPolygon(CifPolygon* polygon) {
|
||||||
|
if(polygon)
|
||||||
|
_polygons.push_back(polygon);
|
||||||
|
else {
|
||||||
|
cerr << "[CIF DRIVE ERROR]: cannot add invalid polygon." << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CifCircuit::write(string filename) {
|
||||||
|
time_t curtime = time(0);
|
||||||
|
tm now = *localtime(&curtime);
|
||||||
|
char date[BUFSIZ]={0};
|
||||||
|
const char format[]="%d-%b-%Y %H:%M:%S";
|
||||||
|
if (!strftime(date, sizeof(date)-1, format, &now)>0)
|
||||||
|
cerr << "[CIF DRIVE ERROR]: cannot build current date." << endl;
|
||||||
|
|
||||||
|
ofstream file;
|
||||||
|
file.open(filename.c_str(), ios::out);
|
||||||
|
// Header
|
||||||
|
file << "(CIF file written on " << date << " by IO_CIF_DRIVER);" << endl
|
||||||
|
<< "DS 1 1 1;" << endl
|
||||||
|
<< "9 " << _name << ";" << endl;
|
||||||
|
|
||||||
|
// For each Polygon : write polygon.
|
||||||
|
for ( vector<CifPolygon*>::iterator it = _polygons.begin() ; it < _polygons.end() ; it++ ) {
|
||||||
|
(*it)->write(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Footer
|
||||||
|
file << "DF;" << endl
|
||||||
|
<< "C 1;" << endl
|
||||||
|
<< "E" << endl;
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef __CIF_CIRCUIT_H
|
||||||
|
#define __CIF_CIRCUIT_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace IO {
|
||||||
|
class CifPolygon;
|
||||||
|
class CifCircuit {
|
||||||
|
public:
|
||||||
|
CifCircuit(string);
|
||||||
|
|
||||||
|
bool addPolygon ( CifPolygon* );
|
||||||
|
bool write ( string );
|
||||||
|
|
||||||
|
private:
|
||||||
|
string _name;
|
||||||
|
|
||||||
|
std::vector<CifPolygon*> _polygons;
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
#endif
|
|
@ -0,0 +1,29 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <ctime>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "CifPolygon.h"
|
||||||
|
|
||||||
|
namespace IO {
|
||||||
|
|
||||||
|
CifPolygon::CifPolygon(long layer) : _layer(layer) {}
|
||||||
|
|
||||||
|
|
||||||
|
void CifPolygon::addPoint(long x, long y) {
|
||||||
|
_points.push_back(pair<long,long>(x,y));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CifPolygon::write(ofstream& file) {
|
||||||
|
file << "L " << _layer << "; P";
|
||||||
|
|
||||||
|
// For each point : write point.
|
||||||
|
for ( vector<pair<long,long> >::iterator it = _points.begin() ; it < _points.end() ; it++ ) {
|
||||||
|
file << " " << (*it).first << "," << (*it).second;
|
||||||
|
}
|
||||||
|
|
||||||
|
file << ";" << endl;
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef __CIF_POLYGON_H
|
||||||
|
#define __CIF_POLYGON_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
namespace IO {
|
||||||
|
class CifPolygon {
|
||||||
|
public:
|
||||||
|
CifPolygon(long);
|
||||||
|
|
||||||
|
void addPoint (long, long);
|
||||||
|
void write ( ofstream& );
|
||||||
|
|
||||||
|
private:
|
||||||
|
long _layer;
|
||||||
|
std::vector<std::pair<long,long> > _points;
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
#endif
|
|
@ -28,6 +28,23 @@ ELSE(AGDS_INCLUDE_DIR AND AGDS_LIBRARY)
|
||||||
# SET(IO_LIBRARIES)
|
# SET(IO_LIBRARIES)
|
||||||
ENDIF(AGDS_INCLUDE_DIR AND AGDS_LIBRARY)
|
ENDIF(AGDS_INCLUDE_DIR AND AGDS_LIBRARY)
|
||||||
|
|
||||||
|
# CIF
|
||||||
|
FIND_PATH(CIF_INCLUDE_DIR
|
||||||
|
NAMES io/cif/CifCircuit.h
|
||||||
|
PATHS ${IO_DIR_SEARCH}
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(CIF_LIBRARY
|
||||||
|
NAMES cif
|
||||||
|
PATHS ${IO_DIR_SEARCH}
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
)
|
||||||
|
IF(CIF_INCLUDE_DIR AND CIF_LIBRARY)
|
||||||
|
SET(CIF_FOUND TRUE)
|
||||||
|
ELSE(CIF_INCLUDE_DIR AND CIF_LIBRARY)
|
||||||
|
SET(CIF_FOUND FALSE)
|
||||||
|
ENDIF(CIF_INCLUDE_DIR AND CIF_LIBRARY)
|
||||||
|
|
||||||
# OPENCHAMS
|
# OPENCHAMS
|
||||||
FIND_PATH(OPENCHAMS_INCLUDE_DIR
|
FIND_PATH(OPENCHAMS_INCLUDE_DIR
|
||||||
NAMES io/openChams/Circuit.h
|
NAMES io/openChams/Circuit.h
|
||||||
|
@ -41,18 +58,15 @@ FIND_LIBRARY(OPENCHAMS_LIBRARY
|
||||||
)
|
)
|
||||||
IF(OPENCHAMS_INCLUDE_DIR AND OPENCHAMS_LIBRARY)
|
IF(OPENCHAMS_INCLUDE_DIR AND OPENCHAMS_LIBRARY)
|
||||||
SET(OPENCHAMS_FOUND TRUE)
|
SET(OPENCHAMS_FOUND TRUE)
|
||||||
#SET(IO_FOUND TRUE)
|
|
||||||
# SET(IO_LIBRARIES ${OPENCHAMS_LIBRARY})
|
|
||||||
ELSE(OPENCHAMS_INCLUDE_DIR AND OPENCHAMS_LIBRARY)
|
ELSE(OPENCHAMS_INCLUDE_DIR AND OPENCHAMS_LIBRARY)
|
||||||
SET(OPENCHAMS_FOUND FALSE)
|
SET(OPENCHAMS_FOUND FALSE)
|
||||||
# SET(IO_LIBRARIES)
|
|
||||||
ENDIF(OPENCHAMS_INCLUDE_DIR AND OPENCHAMS_LIBRARY)
|
ENDIF(OPENCHAMS_INCLUDE_DIR AND OPENCHAMS_LIBRARY)
|
||||||
|
|
||||||
IF(AGDS_FOUND AND OPENCHAMS_FOUND)
|
IF(AGDS_FOUND AND CIF_FOUND AND OPENCHAMS_FOUND)
|
||||||
SET(IO_FOUND TRUE)
|
SET(IO_FOUND TRUE)
|
||||||
ELSE(AGDS_FOUND AND OPENCHAMS_FOUND)
|
ELSE(AGDS_FOUND AND CIF_FOUND AND OPENCHAMS_FOUND)
|
||||||
SET(IO_FOUND FALSE)
|
SET(IO_FOUND FALSE)
|
||||||
ENDIF(AGDS_FOUND AND OPENCHAMS_FOUND)
|
ENDIF(AGDS_FOUND AND CIF_FOUND AND OPENCHAMS_FOUND)
|
||||||
|
|
||||||
IF (NOT IO_FOUND)
|
IF (NOT IO_FOUND)
|
||||||
SET(IO_MESSAGE
|
SET(IO_MESSAGE
|
||||||
|
|
Loading…
Reference in New Issue