From e01f943367831841350106e6f2eac29be9a89f1a Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 31 Jul 2014 19:40:23 +0200 Subject: [PATCH] Added ASCII/GDSII export capability in Unicorn. * New: In Unicorn, in ExportCellDialog and UnicornGui add an entry to call the ASCII/GDSII export driver. * New: In CRL Core, in AgdsDriver, checks for off-grid coordinates (that is non-integer one) and round them with a warning. This is most likely that the layout is flawed but it will at leat generate a readable ASCII/GDSII file. --- crlcore/src/ccore/RoutingLayerGauge.cpp | 15 +++-------- crlcore/src/ccore/agds/AgdsDriver.cpp | 34 +++++++++++++++++++++---- crlcore/src/ccore/crlcore/GdsDriver.h | 3 +-- unicorn/src/ExportCellDialog.cpp | 18 ++++--------- unicorn/src/UnicornGui.cpp | 6 +++++ unicorn/src/unicorn/ExportCellDialog.h | 21 +++++---------- unicorn/src/unicorn/SaveCellDialog.h | 30 +++++++--------------- 7 files changed, 59 insertions(+), 68 deletions(-) diff --git a/crlcore/src/ccore/RoutingLayerGauge.cpp b/crlcore/src/ccore/RoutingLayerGauge.cpp index b7062c12..e0b4ece3 100644 --- a/crlcore/src/ccore/RoutingLayerGauge.cpp +++ b/crlcore/src/ccore/RoutingLayerGauge.cpp @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// Copyright (c) UPMC 2008-2014, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | C o r e L i b r a r y | // | | @@ -17,10 +11,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./RoutingLayerGauge.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ diff --git a/crlcore/src/ccore/agds/AgdsDriver.cpp b/crlcore/src/ccore/agds/AgdsDriver.cpp index 34a410c5..e84365eb 100644 --- a/crlcore/src/ccore/agds/AgdsDriver.cpp +++ b/crlcore/src/ccore/agds/AgdsDriver.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2009-2013, All Rights Reserved +// Copyright (c) UPMC 2009-2014, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -14,12 +14,14 @@ // +-----------------------------------------------------------------+ +#include #include #include #include #include using namespace std; +#include "hurricane/Warning.h" #include "hurricane/DataBase.h" #include "hurricane/Technology.h" #include "hurricane/Library.h" @@ -44,6 +46,21 @@ using namespace Hurricane; namespace { + void isInteger ( double& value, Go* go, Path path ) + { + double rounded = round( value ); + if (abs(value - rounded) > 0.01) { + cerr << Warning( "agdsDriver(): Coordinate is not on grid %.2f, rounded to %.2f\n" + " On %s (%s)" + , value, rounded + , getString(go).c_str() + , getString(path).c_str() + ) << endl; + value = rounded; + } + } + + class AgdsQuery : public Query { public: AgdsQuery ( Cell* ); @@ -91,12 +108,19 @@ namespace { else return; + double xmin = DbU::getPhysical(b.getXMin(), DbU::Nano); + double ymin = DbU::getPhysical(b.getYMin(), DbU::Nano); + double xmax = DbU::getPhysical(b.getXMax(), DbU::Nano); + double ymax = DbU::getPhysical(b.getYMax(), DbU::Nano); + + isInteger( xmin, go, getPath() ); + isInteger( ymin, go, getPath() ); + isInteger( xmax, go, getPath() ); + isInteger( ymax, go, getPath() ); + getTransformation().applyOn( b ); AGDS::Rectangle* rect = new AGDS::Rectangle ( getBasicLayer()->getExtractNumber() - , DbU::getPhysical(b.getXMin(), DbU::Nano) - , DbU::getPhysical(b.getYMin(), DbU::Nano) - , DbU::getPhysical(b.getXMax(), DbU::Nano) - , DbU::getPhysical(b.getYMax(), DbU::Nano)); + , xmin, ymin, xmax, ymax ); _str->addElement( rect ); } diff --git a/crlcore/src/ccore/crlcore/GdsDriver.h b/crlcore/src/ccore/crlcore/GdsDriver.h index a2a6e91a..a0ae76ec 100644 --- a/crlcore/src/ccore/crlcore/GdsDriver.h +++ b/crlcore/src/ccore/crlcore/GdsDriver.h @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2009-2013, All Rights Reserved +// Copyright (c) UPMC 2009-2014, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/unicorn/src/ExportCellDialog.cpp b/unicorn/src/ExportCellDialog.cpp index 69e4564a..b142c072 100644 --- a/unicorn/src/ExportCellDialog.cpp +++ b/unicorn/src/ExportCellDialog.cpp @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC 2008-2014, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | U n i c o r n - M a i n G U I | // | | @@ -17,10 +11,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./ExportCellDialog.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include @@ -87,7 +78,8 @@ namespace Unicorn { formatLabel->setFont ( Graphics::getNormalFont(true) ); hLayout2->addWidget ( formatLabel ); - _formatComboBox->addItem ( tr("Alliance compliant DEF") , AllianceDef ); + _formatComboBox->addItem ( tr("Alliance compliant DEF"), AllianceDef ); + _formatComboBox->addItem ( tr("ASCII/GDSII (AGDS)") , AsciiGds ); hLayout2->addWidget ( _formatComboBox ); QVBoxLayout* vLayout = new QVBoxLayout (); diff --git a/unicorn/src/UnicornGui.cpp b/unicorn/src/UnicornGui.cpp index 21387a98..8d1cc86b 100644 --- a/unicorn/src/UnicornGui.cpp +++ b/unicorn/src/UnicornGui.cpp @@ -25,6 +25,7 @@ #include "crlcore/AllianceFramework.h" #include "crlcore/GraphicToolEngine.h" #include "crlcore/DefExport.h" +#include "crlcore/GdsDriver.h" #include "unicorn/ImportCell.h" #include "unicorn/OpenCellDialog.h" #include "unicorn/SaveCellDialog.h" @@ -42,6 +43,7 @@ namespace Unicorn { using CRL::Catalog; using CRL::AllianceFramework; using CRL::DefExport; + using CRL::GdsDriver; // ------------------------------------------------------------------- @@ -241,6 +243,10 @@ namespace Unicorn { case ExportCellDialog::AllianceDef: DefExport::drive ( cell, DefExport::WithLEF ); break; + case ExportCellDialog::AsciiGds: + GdsDriver gdsDriver ( cell ); + gdsDriver.save( getString(cell->getName())+".agds" ); + break; } } } diff --git a/unicorn/src/unicorn/ExportCellDialog.h b/unicorn/src/unicorn/ExportCellDialog.h index ac235265..acb9bf24 100644 --- a/unicorn/src/unicorn/ExportCellDialog.h +++ b/unicorn/src/unicorn/ExportCellDialog.h @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC 2008-2014, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | U n i c o r n - M a i n G U I | // | | @@ -17,14 +11,11 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Header : "./ExportCellDialog.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __UNICORN_EXPORT_CELL_DIALOG_H__ -#define __UNICORN_EXPORT_CELL_DIALOG_H__ +#ifndef UNICORN_EXPORT_CELL_DIALOG_H +#define UNICORN_EXPORT_CELL_DIALOG_H #include @@ -40,7 +31,7 @@ namespace Unicorn { Q_OBJECT; public: - enum Formats { AllianceDef=1 }; + enum Formats { AllianceDef=1, AsciiGds=2 }; public: ExportCellDialog ( QWidget* parent=NULL ); bool runDialog ( QString& name, int& format ); diff --git a/unicorn/src/unicorn/SaveCellDialog.h b/unicorn/src/unicorn/SaveCellDialog.h index 9ae087f1..e50ec6cc 100644 --- a/unicorn/src/unicorn/SaveCellDialog.h +++ b/unicorn/src/unicorn/SaveCellDialog.h @@ -1,32 +1,23 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC 2008-2014, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | U n i c o r n - M a i n G U I | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./SaveCellDialog.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./unicorn/SaveCellDialog.h" | +// +-----------------------------------------------------------------+ -#ifndef __UNICORN_SAVE_CELL_DIALOG_H__ -#define __UNICORN_SAVE_CELL_DIALOG_H__ +#ifndef UNICORN_SAVE_CELL_DIALOG_H +#define UNICORN_SAVE_CELL_DIALOG_H -#include +#include class QCheckBox; class QLineEdit; @@ -50,9 +41,6 @@ namespace Unicorn { }; +} // Unicorn namespace. - -} // End of Unicorn namespace. - - -#endif +#endif // UNICORN_SAVE_CELL_DIALOG_H