Bug fixes in Blif parser (no VHDL enforcement) & GDS driver.

* Bug: In Hurricane::DrawingQuery::drawGo(), forgot to apply translation
    on Polygon and Rectilinear.
* Bug: In Hurricane::Rectilinear, forgot implementation of getContour().
    Add a new accessor getPoints().
* Bug: In CRL::Blif::load(), do not always enforce translation towards
    VHDL names. When loading LEF+gds it may change the Cell names between
    the two stages so the gds layout do not get added to the LEF Cell
    phantom.
      Now add a boolean enforceVhdl argument (may be a flag in the future).
* Bug: In ::GdsStream::operator<<(Cell*), forgot to drive the Rectilinear.
This commit is contained in:
Jean-Paul Chaput 2019-03-07 20:14:08 +01:00
parent 9a872b10af
commit 0b605000ed
9 changed files with 62 additions and 44 deletions

View File

@ -103,7 +103,7 @@ namespace CRL {
, "BLIF (Yosys/ABC)"
, CellLoader::Importer|CellLoader::MultiCell
, Catalog::State::Logical
, std::bind( &Blif::load, placeholders::_1 ) ) );
, std::bind( &Blif::load, placeholders::_1, true ) ) );
}
}

View File

@ -667,7 +667,7 @@ namespace CRL {
{ if (library) _libraries.push_back( library ); }
Cell* Blif::load ( string cellPath )
Cell* Blif::load ( string cellPath, bool enforceVhdl )
{
using namespace std;
@ -824,7 +824,7 @@ namespace CRL {
Model::orderModels();
Model::connectModels();
Model::toVhdlModels();
if (enforceVhdl) Model::toVhdlModels();
Model::clearStatic();
UpdateSession::close();

View File

@ -56,7 +56,7 @@ namespace CRL {
class Blif {
public:
static Cell* load ( std::string netlist );
static Cell* load ( std::string netlist, bool enforceVhdl=true );
static void add ( Library* );
static inline const std::vector<Library*>& getLibraries ();
private:

View File

@ -608,23 +608,33 @@ namespace {
}
}
} else {
Diagonal* diagonal = dynamic_cast<Diagonal*>(component);
if (diagonal) {
Rectilinear* rectilinear = dynamic_cast<Rectilinear*>(component);
if (rectilinear) {
for ( const BasicLayer* layer : component->getLayer()->getBasicLayers() ) {
(*this) << BOUNDARY;
(*this) << layer;
(*this) << diagonal->getContour();
(*this) << rectilinear->getPoints();
(*this) << ENDEL;
}
} else if ( dynamic_cast<Horizontal*>(component)
or dynamic_cast<Vertical *>(component)
or dynamic_cast<Contact *>(component)
or dynamic_cast<Pad *>(component)) {
for ( const BasicLayer* layer : component->getLayer()->getBasicLayers() ) {
(*this) << BOUNDARY;
(*this) << layer;
(*this) << component->getBoundingBox(layer);
(*this) << ENDEL;
} else {
Diagonal* diagonal = dynamic_cast<Diagonal*>(component);
if (diagonal) {
for ( const BasicLayer* layer : component->getLayer()->getBasicLayers() ) {
(*this) << BOUNDARY;
(*this) << layer;
(*this) << diagonal->getContour();
(*this) << ENDEL;
}
} else if ( dynamic_cast<Horizontal*>(component)
or dynamic_cast<Vertical *>(component)
or dynamic_cast<Contact *>(component)
or dynamic_cast<Pad *>(component)) {
for ( const BasicLayer* layer : component->getLayer()->getBasicLayers() ) {
(*this) << BOUNDARY;
(*this) << layer;
(*this) << component->getBoundingBox(layer);
(*this) << ENDEL;
}
}
}
}

View File

@ -87,10 +87,13 @@ extern "C" {
Cell* cell = NULL;
HTRY
char* benchName = NULL;
char* benchName = NULL;
PyObject* pyEnforceVhdl = NULL;
if (PyArg_ParseTuple( args, "s:Blif.load", &benchName )) {
cell = Blif::load( benchName );
if (PyArg_ParseTuple( args, "s|O:Blif.load", &benchName, &pyEnforceVhdl )) {
bool enforceVhdl = true;
if (pyEnforceVhdl and (PyObject_IsTrue(pyEnforceVhdl) == 0)) enforceVhdl = false;
cell = Blif::load( benchName, enforceVhdl );
} else {
PyErr_SetString ( ConstructorError, "Blif.load(): Bad type or bad number of parameters." );
return NULL;

View File

@ -89,7 +89,7 @@ extern "C" {
HTRY
PyObject* arg0;
if (not ParseOneArg("Etesian.get", args, CELL_ARG, &arg0)) return NULL;
if (not ParseOneArg("Etesian.create", args, CELL_ARG, &arg0)) return NULL;
Cell* cell = PYCELL_O(arg0);
etesian = EtesianEngine::get(cell);

View File

@ -48,35 +48,40 @@ namespace Hurricane {
typedef Component Super;
public:
static Rectilinear* create ( Net*, const Layer*, const vector<Point>& );
static Rectilinear* create ( Net*, const Layer*, const vector<Point>& );
// Accessors.
virtual bool isNonRectangle () const;
virtual DbU::Unit getX () const;
virtual DbU::Unit getY () const;
virtual Box getBoundingBox () const;
virtual Box getBoundingBox ( const BasicLayer* ) const;
virtual size_t getPointsSize () const;
virtual Point getPoint ( size_t i ) const;
virtual const Layer* getLayer () const;
inline Points getContour () const;
virtual bool isNonRectangle () const;
virtual DbU::Unit getX () const;
virtual DbU::Unit getY () const;
virtual Box getBoundingBox () const;
virtual Box getBoundingBox ( const BasicLayer* ) const;
virtual size_t getPointsSize () const;
virtual Point getPoint ( size_t i ) const;
virtual const Layer* getLayer () const;
inline Points getContour () const;
inline const vector<Point>& getPoints () const;
// Mutators.
void setLayer ( const Layer* );
virtual void translate ( const DbU::Unit& dx, const DbU::Unit& dy );
void setPoints ( const vector<Point>& );
void setLayer ( const Layer* );
virtual void translate ( const DbU::Unit& dx, const DbU::Unit& dy );
void setPoints ( const vector<Point>& );
// Hurricane management.
virtual void _toJson ( JsonWriter* ) const;
static JsonObject* getJsonObject ( unsigned long flags );
virtual string _getTypeName () const;
virtual string _getString () const;
virtual Record* _getRecord () const;
virtual void _toJson ( JsonWriter* ) const;
static JsonObject* getJsonObject ( unsigned long flags );
virtual string _getTypeName () const;
virtual string _getString () const;
virtual Record* _getRecord () const;
protected:
Rectilinear ( Net*, const Layer*, const vector<Point>& );
Rectilinear ( Net*, const Layer*, const vector<Point>& );
private:
const Layer* _layer;
vector<Point> _points;
};
inline Points Rectilinear::getContour () const { return new VectorCollection<Point>(_points); }
inline const vector<Point>& Rectilinear::getPoints () const { return _points; }
// -------------------------------------------------------------------
// Class : "JsonRoutingRectilinear".

View File

@ -677,13 +677,13 @@ namespace Hurricane {
if ( (rectangle.width() > 4) and (rectangle.height() > 4) ) {
QPolygon contour;
for ( Point point : component->getContour() )
contour << _cellWidget->dbuToScreenPoint( point );
contour << _cellWidget->dbuToScreenPoint( transformation.getPoint(point) );
_cellWidget->drawScreenPolygon( contour );
if ( component->isManhattanized()
and (_cellWidget->dbuToScreenLength(DbU::getPolygonStep()) > 4) ) {
for ( Point point : component->getMContour() )
contour << _cellWidget->dbuToScreenPoint( point );
contour << _cellWidget->dbuToScreenPoint( transformation.getPoint(point) );
_cellWidget->drawScreenPolygon( contour );
// const Polygon* polygon = dynamic_cast<const Polygon*>( component );

View File

@ -98,7 +98,7 @@ namespace Unicorn {
_importCell.setDialog( _importDialog );
_importCell.addImporter<Cell*> ( "JSON (experimental)" , std::bind( &Cell::fromJson , placeholders::_1 ) );
_importCell.addImporter<Cell*> ( "BLIF (Yosys/ABC)" , std::bind( &Blif::load , placeholders::_1 ) );
_importCell.addImporter<Cell*> ( "BLIF (Yosys/ABC)" , std::bind( &Blif::load , placeholders::_1, true ) );
_importCell.addImporter<Cell*> ( "ACM/SIGDA (aka MCNC, .bench)", std::bind( &AcmSigda::load , placeholders::_1 ) );
_importCell.addImporter<Cell*> ( "ISPD'04 (Bookshelf)" , std::bind( &Ispd04::load , placeholders::_1 ) );
_importCell.addImporter<Cell*> ( "ISPD'05 (Bookshelf)" , std::bind( &Ispd05::load , placeholders::_1 ) );