* ./unicorn:

- New: Adds graphic support for Import/Export files (ACM/SIGDA, ISPD04,
        ICCAD04 and LEF/DEF).
    - New: To avoid buggy database deletion, and also to speed up, now exits
        with a system exit. Previous behavior could be acticated with the
        "--delete-db" boolean switch.
This commit is contained in:
Jean-Paul Chaput 2010-08-22 12:39:05 +00:00
parent 551adf4213
commit f17bbf567d
8 changed files with 512 additions and 3 deletions

View File

@ -2,7 +2,8 @@
include ( ${QT_USE_FILE} ) include ( ${QT_USE_FILE} )
include_directories ( ${HURRICANE_INCLUDE_DIR} include_directories ( ${UNICORN_SOURCE_DIR}/src
${HURRICANE_INCLUDE_DIR}
${CORIOLIS_INCLUDE_DIR} ${CORIOLIS_INCLUDE_DIR}
${BOOKSHELF_INCLUDE_DIR} ${BOOKSHELF_INCLUDE_DIR}
${CONFIGURATION_INCLUDE_DIR} ${CONFIGURATION_INCLUDE_DIR}
@ -15,9 +16,13 @@
set ( mocincludes unicorn/UnicornGui.h set ( mocincludes unicorn/UnicornGui.h
unicorn/OpenCellDialog.h unicorn/OpenCellDialog.h
unicorn/SaveCellDialog.h unicorn/SaveCellDialog.h
unicorn/ImportCellDialog.h
unicorn/ExportCellDialog.h
) )
set ( cpps OpenCellDialog.cpp set ( cpps OpenCellDialog.cpp
SaveCellDialog.cpp SaveCellDialog.cpp
ImportCellDialog.cpp
ExportCellDialog.cpp
UnicornGui.cpp UnicornGui.cpp
) )
set ( cgtcpp CgtMain.cpp ) set ( cgtcpp CgtMain.cpp )

View File

@ -102,6 +102,7 @@ int main ( int argc, char *argv[] )
try { try {
bfs::path::default_name_check ( bfs::portable_posix_name ); bfs::path::default_name_check ( bfs::portable_posix_name );
bool destroyDatabase;
float edgeCapacity; float edgeCapacity;
float expandStep; float expandStep;
unsigned long eventsLimit; unsigned long eventsLimit;
@ -121,6 +122,8 @@ int main ( int argc, char *argv[] )
boptions::options_description options ("Command line arguments & options"); boptions::options_description options ("Command line arguments & options");
options.add_options() options.add_options()
( "help,h" , "Print this help." ) ( "help,h" , "Print this help." )
( "destroy-db" , boptions::bool_switch(&destroyDatabase)->default_value(false)
, "Perform a complete deletion of the database (may be buggy).")
( "trace-level,l" , boptions::value<unsigned int>(&traceLevel) ( "trace-level,l" , boptions::value<unsigned int>(&traceLevel)
, "Set the level of trace, trace messages with a level superior to " , "Set the level of trace, trace messages with a level superior to "
"<arg> will be printed on <stderr>." ) "<arg> will be printed on <stderr>." )
@ -385,6 +388,8 @@ int main ( int argc, char *argv[] )
//DebugSession::addToTrace ( cell, "NET2530" ); //DebugSession::addToTrace ( cell, "NET2530" );
//DebugSession::addToTrace ( cell, "NET8464" ); //DebugSession::addToTrace ( cell, "NET8464" );
//DebugSession::addToTrace ( cell, "NET8242" ); //DebugSession::addToTrace ( cell, "NET8242" );
// ibm02.
//DebugSession::addToTrace ( cell, "net18015" );
// Python Script test. // Python Script test.
@ -506,6 +511,9 @@ int main ( int argc, char *argv[] )
returnCode = (kiteSuccess) ? 0 : 1; returnCode = (kiteSuccess) ? 0 : 1;
} }
} }
if ( not destroyDatabase ) exit ( 0 );
cmess1 << " o Full database deletion (may be buggy)." << endl;
} }
catch ( Error& e ) { catch ( Error& e ) {
cerr << e.what() << endl; cerr << e.what() << endl;

View File

@ -0,0 +1,138 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, 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++ Module : "./ExportCellDialog.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <iostream>
using namespace std;
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QComboBox>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "hurricane/Warning.h"
#include "hurricane/viewer/Graphics.h"
#include "unicorn/ExportCellDialog.h"
namespace Unicorn {
using Hurricane::Warning;
using Hurricane::Graphics;
// -------------------------------------------------------------------
// Class : "ExportCellDialog".
ExportCellDialog::ExportCellDialog ( QWidget* parent )
: QDialog (parent)
, _lineEdit (new QLineEdit())
, _formatComboBox(new QComboBox())
{
setWindowTitle ( tr("Export Cell") );
QLabel* label = new QLabel ();
label->setText ( tr("Enter Cell name (without extention)") );
label->setFont ( Graphics::getNormalFont(true) );
QPushButton* okButton = new QPushButton ();
okButton->setText ( "OK" );
okButton->setDefault ( true );
QPushButton* cancelButton = new QPushButton ();
cancelButton->setText ( "Cancel" );
QHBoxLayout* hLayout1 = new QHBoxLayout ();
hLayout1->addStretch ();
hLayout1->addWidget ( okButton );
hLayout1->addStretch ();
hLayout1->addWidget ( cancelButton );
hLayout1->addStretch ();
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
QHBoxLayout* hLayout2 = new QHBoxLayout ();
QLabel* formatLabel = new QLabel ();
formatLabel->setText ( tr("Export Format") );
formatLabel->setFont ( Graphics::getNormalFont(true) );
hLayout2->addWidget ( formatLabel );
_formatComboBox->addItem ( tr("Alliance compliant DEF") , AllianceDef );
hLayout2->addWidget ( _formatComboBox );
QVBoxLayout* vLayout = new QVBoxLayout ();
vLayout->setSizeConstraint ( QLayout::SetFixedSize );
vLayout->addWidget ( label );
vLayout->addWidget ( _lineEdit );
vLayout->addLayout ( hLayout2 );
vLayout->addWidget ( separator );
vLayout->addLayout ( hLayout1 );
setLayout ( vLayout );
//setModal ( true );
connect ( okButton, SIGNAL(clicked()), this, SLOT(accept()) );
connect ( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) );
}
const QString ExportCellDialog::getCellName () const
{ return _lineEdit->text(); }
void ExportCellDialog::setCellName ( const QString& name )
{ _lineEdit->setText ( name ); }
bool ExportCellDialog::runDialog ( QString& name, int& format )
{
setCellName ( name );
bool dialogResult = (exec() == Accepted);
name = getCellName ();
format = getFormat ();
return dialogResult;
}
int ExportCellDialog::getFormat () const
{
int index = _formatComboBox->currentIndex();
if ( index < 0 ) return 0;
return _formatComboBox->itemData(index).toInt();
}
} // End of Unicorn namespace.

View File

@ -0,0 +1,146 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, 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++ Module : "./ImportCellDialog.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <iostream>
using namespace std;
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QComboBox>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "hurricane/Warning.h"
#include "hurricane/viewer/Graphics.h"
#include "unicorn/ImportCellDialog.h"
namespace Unicorn {
using Hurricane::Warning;
using Hurricane::Graphics;
// -------------------------------------------------------------------
// Class : "ImportCellDialog".
ImportCellDialog::ImportCellDialog ( QWidget* parent )
: QDialog (parent)
, _lineEdit (new QLineEdit())
, _viewerCheckBox(new QCheckBox())
, _formatComboBox(new QComboBox())
{
setWindowTitle ( tr("Import Cell") );
QLabel* label = new QLabel ();
label->setText ( tr("Enter Cell name (without extention)") );
label->setFont ( Graphics::getNormalFont(true) );
_lineEdit->setMinimumWidth ( 400 );
_viewerCheckBox->setText ( tr("Import in new Viewer") );
QPushButton* okButton = new QPushButton ();
okButton->setText ( "OK" );
okButton->setDefault ( true );
QPushButton* cancelButton = new QPushButton ();
cancelButton->setText ( "Cancel" );
QHBoxLayout* hLayout1 = new QHBoxLayout ();
hLayout1->addStretch ();
hLayout1->addWidget ( okButton );
hLayout1->addStretch ();
hLayout1->addWidget ( cancelButton );
hLayout1->addStretch ();
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
QHBoxLayout* hLayout2 = new QHBoxLayout ();
QLabel* formatLabel = new QLabel ();
formatLabel->setText ( tr("Import Format") );
formatLabel->setFont ( Graphics::getNormalFont(true) );
hLayout2->addWidget ( formatLabel );
_formatComboBox->addItem ( tr("ACM/SIGDA (aka MCNC, .bench)"), AcmSigda );
_formatComboBox->addItem ( tr("ISPD'04 (Bookshelf)") , Ispd04 );
_formatComboBox->addItem ( tr("ICCAD'04 (LEF/DEF)") , Iccad04 );
_formatComboBox->addItem ( tr("Alliance compliant DEF") , AllianceDef );
hLayout2->addWidget ( _formatComboBox );
QVBoxLayout* vLayout = new QVBoxLayout ();
vLayout->setSizeConstraint ( QLayout::SetFixedSize );
vLayout->addWidget ( label );
vLayout->addWidget ( _lineEdit );
vLayout->addLayout ( hLayout2 );
vLayout->addWidget ( _viewerCheckBox );
vLayout->addWidget ( separator );
vLayout->addLayout ( hLayout1 );
setLayout ( vLayout );
//setModal ( true );
connect ( okButton, SIGNAL(clicked()), this, SLOT(accept()) );
connect ( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) );
}
const QString ImportCellDialog::getCellName () const
{ return _lineEdit->text(); }
bool ImportCellDialog::useNewViewer () const
{ return _viewerCheckBox->isChecked(); }
bool ImportCellDialog::runDialog ( QString& name, int& format, bool& newViewerRequest )
{
bool dialogResult = (exec() == Accepted);
name = getCellName ();
newViewerRequest = useNewViewer ();
format = getFormat ();
return dialogResult;
}
int ImportCellDialog::getFormat () const
{
int index = _formatComboBox->currentIndex();
if ( index < 0 ) return 0;
return _formatComboBox->itemData(index).toInt();
}
} // End of Unicorn namespace.

View File

@ -32,9 +32,16 @@
#include "crlcore/Catalog.h" #include "crlcore/Catalog.h"
#include "crlcore/AllianceFramework.h" #include "crlcore/AllianceFramework.h"
#include "crlcore/GraphicToolEngine.h" #include "crlcore/GraphicToolEngine.h"
#include "crlcore/AcmSigda.h"
#include "crlcore/Ispd04Bookshelf.h"
#include "crlcore/Iccad04Lefdef.h"
#include "crlcore/DefImport.h"
#include "crlcore/DefExport.h"
#include "unicorn/OpenCellDialog.h" #include "unicorn/OpenCellDialog.h"
#include "unicorn/SaveCellDialog.h" #include "unicorn/SaveCellDialog.h"
#include "unicorn/ImportCellDialog.h"
#include "unicorn/ExportCellDialog.h"
#include "unicorn/UnicornGui.h" #include "unicorn/UnicornGui.h"
@ -44,6 +51,11 @@ namespace Unicorn {
using Hurricane::Warning; using Hurricane::Warning;
using CRL::Catalog; using CRL::Catalog;
using CRL::AllianceFramework; using CRL::AllianceFramework;
using CRL::AcmSigda;
using CRL::Ispd04;
using CRL::Iccad04Lefdef;
using CRL::DefImport;
using CRL::DefExport;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -62,6 +74,8 @@ namespace Unicorn {
UnicornGui::UnicornGui ( QWidget* parent ) UnicornGui::UnicornGui ( QWidget* parent )
: CellViewer (parent) : CellViewer (parent)
, _tools () , _tools ()
, _importDialog(new ImportCellDialog(this))
, _exportDialog(new ExportCellDialog(this))
{ } { }
@ -101,6 +115,16 @@ namespace Unicorn {
saveAction->setVisible ( true ); saveAction->setVisible ( true );
connect ( saveAction, SIGNAL(triggered()), this, SLOT(saveCell()) ); connect ( saveAction, SIGNAL(triggered()), this, SLOT(saveCell()) );
} }
QAction* importAction = findChild<QAction*>("viewer.menuBar.file.importCell");
if ( importAction ) {
connect ( importAction, SIGNAL(triggered()), this, SLOT(importCell()) );
}
QAction* exportAction = findChild<QAction*>("viewer.menuBar.file.exportCell");
if ( exportAction ) {
connect ( exportAction, SIGNAL(triggered()), this, SLOT(exportCell()) );
}
} }
@ -163,6 +187,68 @@ namespace Unicorn {
} }
void UnicornGui::importCell ()
{
QString cellName;
bool newViewer;
int format;
if ( _importDialog->runDialog ( cellName, format, newViewer ) ) {
Cell* cell = NULL;
switch ( format ) {
case ImportCellDialog::AcmSigda:
cell = AcmSigda::load ( cellName.toStdString() );
break;
case ImportCellDialog::Ispd04:
cell = Ispd04::load ( cellName.toStdString() );
break;
case ImportCellDialog::Iccad04:
cell = Iccad04Lefdef::load ( cellName.toStdString() , 0 );
break;
case ImportCellDialog::AllianceDef:
cell = DefImport::load ( cellName.toStdString().c_str() , DefImport::FitAbOnCells );
break;
}
if ( cell ) {
UnicornGui* viewer = this;
if ( newViewer ) {
viewer = UnicornGui::create ();
viewer->show ();
}
viewer->setCell ( cell );
} else
cerr << "[ERROR] Cell not found: " << cellName.toStdString() << endl;
}
}
void UnicornGui::exportCell ()
{
Cell* cell = getCell();
if ( cell == NULL ) return;
QString cellName= getString(cell->getName()).c_str();
int format;
if ( _exportDialog->runDialog ( cellName, format ) ) {
renameCell ( cellName.toStdString().c_str() );
switch ( format ) {
// case ImportCellDialog::AcmSigda:
// break;
// case ImportCellDialog::Ispd04:
// break;
// case ImportCellDialog::Iccad04:
// break;
case ExportCellDialog::AllianceDef:
DefExport::drive ( cell, DefExport::WithLEF );
break;
}
}
}
void UnicornGui::saveCell () void UnicornGui::saveCell ()
{ {
Cell* cell = getCell(); Cell* cell = getCell();

View File

@ -0,0 +1,59 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, 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 : "./ExportCellDialog.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __UNICORN_EXPORT_CELL_DIALOG_H__
#define __UNICORN_EXPORT_CELL_DIALOG_H__
#include <QDialog>
class QCheckBox;
class QComboBox;
class QLineEdit;
namespace Unicorn {
class ExportCellDialog : public QDialog {
Q_OBJECT;
public:
enum Formats { AllianceDef=1 };
public:
ExportCellDialog ( QWidget* parent=NULL );
bool runDialog ( QString& name, int& format );
const QString getCellName () const;
int getFormat () const;
void setCellName ( const QString& );
protected:
QLineEdit* _lineEdit;
QComboBox* _formatComboBox;
};
} // End of Unicorn namespace.
#endif

View File

@ -0,0 +1,60 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, 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 : "./ImportCellDialog.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __UNICORN_IMPORT_CELL_DIALOG_H__
#define __UNICORN_IMPORT_CELL_DIALOG_H__
#include <QDialog>
class QCheckBox;
class QComboBox;
class QLineEdit;
namespace Unicorn {
class ImportCellDialog : public QDialog {
Q_OBJECT;
public:
enum Formats { AcmSigda=1, Ispd04, Iccad04, AllianceDef };
public:
ImportCellDialog ( QWidget* parent=NULL );
bool runDialog ( QString& name, int& format, bool& newViewerRequest );
const QString getCellName () const;
bool useNewViewer () const;
int getFormat () const;
protected:
QLineEdit* _lineEdit;
QCheckBox* _viewerCheckBox;
QComboBox* _formatComboBox;
};
} // End of Unicorn namespace.
#endif

View File

@ -49,6 +49,9 @@ namespace Unicorn {
using CRL::Banner; using CRL::Banner;
using CRL::GraphicTool; using CRL::GraphicTool;
class ImportCellDialog;
class ExportCellDialog;
class UnicornGui : public CellViewer { class UnicornGui : public CellViewer {
Q_OBJECT; Q_OBJECT;
@ -61,6 +64,8 @@ namespace Unicorn {
public slots: public slots:
void openCell (); void openCell ();
void saveCell (); void saveCell ();
void importCell ();
void exportCell ();
protected: protected:
UnicornGui ( QWidget* parent ); UnicornGui ( QWidget* parent );
virtual ~UnicornGui (); virtual ~UnicornGui ();
@ -69,6 +74,8 @@ namespace Unicorn {
protected: protected:
static Banner _banner; static Banner _banner;
set<GraphicTool*> _tools; set<GraphicTool*> _tools;
ImportCellDialog* _importDialog;
ExportCellDialog* _exportDialog;
}; };