From ebb050c99bae0da4369552e6ff61d8fdfb16400d Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Thu, 24 Jul 2008 14:29:55 +0000 Subject: [PATCH] adding device MetaCapacitor TransistorViewer is now a MetaTransistorViewer --- chamsin/src/analogic/CMakeLists.txt | 2 +- chamsin/src/analogic/Capacitor.cpp | 2 + chamsin/src/analogic/MetaCapacitor.cpp | 23 ++++++++++++ chamsin/src/analogic/MetaCapacitor.h | 20 ++++++++++ chamsin/src/analogic/Transistor.cpp | 32 ++++++++-------- chamsin/src/analogic/Transistor.h | 4 +- chamsin/src/tests/CapacitorViewer.cpp | 52 ++++++++++++++++++++++++++ chamsin/src/tests/CapacitorViewer.h | 17 +++++++++ chamsin/src/tests/TransistorViewer.cpp | 24 +++++++++--- chamsin/src/tests/TransistorViewer.h | 5 ++- 10 files changed, 155 insertions(+), 26 deletions(-) create mode 100644 chamsin/src/analogic/MetaCapacitor.cpp create mode 100644 chamsin/src/analogic/MetaCapacitor.h diff --git a/chamsin/src/analogic/CMakeLists.txt b/chamsin/src/analogic/CMakeLists.txt index f7bf4c52..9c2f6474 100644 --- a/chamsin/src/analogic/CMakeLists.txt +++ b/chamsin/src/analogic/CMakeLists.txt @@ -1,7 +1,7 @@ INCLUDE_DIRECTORIES(${CHAMSIN_SOURCE_DIR}/src/technology ${HURRICANE_INCLUDE_DIR}) ADD_LIBRARY(analogic SHARED Transistor.cpp Capacitor.cpp Resistor.cpp Device.cpp - MetaTransistor.cpp) + MetaTransistor.cpp MetaCapacitor.cpp) TARGET_LINK_LIBRARIES(analogic atechnology ${HURRICANE_LIBRARIES}) diff --git a/chamsin/src/analogic/Capacitor.cpp b/chamsin/src/analogic/Capacitor.cpp index 0304bc7c..e14f4822 100644 --- a/chamsin/src/analogic/Capacitor.cpp +++ b/chamsin/src/analogic/Capacitor.cpp @@ -249,6 +249,7 @@ void Capacitor::updateLayout() { Box box00(x00, y00, x00 + dx00, y00 + dy00); _bottomPlate00->setBoundingBox(box00); +#if 0 //emboitement->anonymous01: //************************ @@ -258,6 +259,7 @@ void Capacitor::updateLayout() { DbU::Unit dy01 = _w + (2 * enclosureByBotmimTopmim) + (2 * spacingTopmim); Box box01(x01, y01, x01 + dx01, y01 + dy01); _anonymous01->setBoundingBox(box01); +#endif UpdateSession::close(); } diff --git a/chamsin/src/analogic/MetaCapacitor.cpp b/chamsin/src/analogic/MetaCapacitor.cpp new file mode 100644 index 00000000..40e7eace --- /dev/null +++ b/chamsin/src/analogic/MetaCapacitor.cpp @@ -0,0 +1,23 @@ +#include "hurricane/UpdateSession.h" +using namespace Hurricane; + +#include "Capacitor.h" +#include "MetaCapacitor.h" + +MetaCapacitor::MetaCapacitor(Library* library, const Name& name): + Device(library, name) +{} + +MetaCapacitor* MetaCapacitor::create(Library* library, const Name& name) { + MetaCapacitor* mCapacitor = new MetaCapacitor(library, name); + + mCapacitor->_postCreate(); + + return mCapacitor; +} + +void MetaCapacitor::_postCreate() { + Inherit::_postCreate(); + + setTerminal(false); +} diff --git a/chamsin/src/analogic/MetaCapacitor.h b/chamsin/src/analogic/MetaCapacitor.h new file mode 100644 index 00000000..659e38a9 --- /dev/null +++ b/chamsin/src/analogic/MetaCapacitor.h @@ -0,0 +1,20 @@ +#ifndef METACAPACITOR_H +#define METACAPACITOR_H + +#include "Device.h" + +class Capacitor; + +class MetaCapacitor : public Device { + public: + static MetaCapacitor* create(Library* library, const Name& name); + + protected: + void _postCreate(); + + private: + MetaCapacitor(Library* library, const Name& name); +}; + + +#endif // METACAPACITOR_H diff --git a/chamsin/src/analogic/Transistor.cpp b/chamsin/src/analogic/Transistor.cpp index 4aeb68f7..3b5e278d 100644 --- a/chamsin/src/analogic/Transistor.cpp +++ b/chamsin/src/analogic/Transistor.cpp @@ -57,8 +57,10 @@ Transistor::Transistor(Library* library, const Name& name): _type(), _l(0), _w(0), - _source20(NULL), _source22(NULL), - _drain40(NULL), _drain42(NULL), + //_source20(NULL), + _source22(NULL), + //_drain40(NULL), + _drain42(NULL), _grid00(NULL), _grid01(NULL), _grid30(NULL), _grid31(NULL), _anonymous10(NULL), _anonymous11(NULL), _anonymous12(NULL), _anonymous50(NULL) {} @@ -91,9 +93,9 @@ void Transistor::_postCreate() { _bulk = Net::create(this, BulkName); _bulk->setExternal(true); _anonymous = Net::create(this, AnonymousName); - _source20 = createPad(technology, _source, "cut0"); + //_source20 = createPad(technology, _source, "cut0"); _source22 = createPad(technology, _source, "cut1"); - _drain40 = createPad(technology, _drain, "cut0"); + //_drain40 = createPad(technology, _drain, "cut0"); _drain42 = createPad(technology, _drain, "cut1"); _grid00 = createPad(technology, _grid, "poly"); _grid01 = createPad(technology, _grid, "poly"); @@ -240,24 +242,24 @@ void Transistor::updateLayout() { Box box12(x12, y12, x12 + dx12, y12 + dy12); _anonymous12->setBoundingBox(box12); - //_source20 + ////_source20 DbU::Unit y20 = extActiveCut0; DbU::Unit dy20 = _w - 2 * extActiveCut0; unsigned sourceColumnNumber = 1; DbU::Unit dx20 = sourceColumnNumber * widthCut0 + (sourceColumnNumber - 1) * spacingCut0; DbU::Unit x20 = -(dx20 + spacingGateCut0); - Box box20(x20, y20, x20 + dx20, y20 + dy20); - _source20->setBoundingBox(box20); + //Box box20(x20, y20, x20 + dx20, y20 + dy20); + ////_source20->setBoundingBox(box20); - //_drain40 - DbU::Unit y40 = y20; + ////_drain40 + //DbU::Unit y40 = y20; DbU::Unit x40 = x00 + dx00 + spacingGateCut0; unsigned drainColumnNumber = 1; DbU::Unit dx40 = drainColumnNumber * widthCut0 + (drainColumnNumber - 1) * (spacingCut0); - DbU::Unit dy40 = dy20; + //DbU::Unit dy40 = dy20; - Box box40(x40, y40, x40 + dx40, y40 + dy40); - _drain40->setBoundingBox(box40); + //Box box40(x40, y40, x40 + dx40, y40 + dy40); + //_drain40->setBoundingBox(box40); //_anonymous10 DbU::Unit y10 = 0; @@ -316,7 +318,7 @@ void Transistor::updateLayout() { } } - //setAbutmentBox(getAbutmentBox()); + setAbutmentBox(box12); UpdateSession::close(); } @@ -329,9 +331,9 @@ Record* Transistor::_getRecord() const { record->add(getSlot("Bulk", _bulk)); record->add(getSlot("L", &_l)); record->add(getSlot("W", &_w)); - record->add(getSlot("Source20", _source20)); + //record->add(getSlot("Source20", _source20)); record->add(getSlot("Source22", _source22)); - record->add(getSlot("Drain40", _drain40)); + //record->add(getSlot("Drain40", _drain40)); record->add(getSlot("Drain42", _drain42)); record->add(getSlot("Grid00", _grid00)); record->add(getSlot("Grid01", _grid01)); diff --git a/chamsin/src/analogic/Transistor.h b/chamsin/src/analogic/Transistor.h index 92ab87f2..66a1b238 100644 --- a/chamsin/src/analogic/Transistor.h +++ b/chamsin/src/analogic/Transistor.h @@ -48,8 +48,8 @@ class Transistor : public AnalogComponent { Type _type; DbU::Unit _l; DbU::Unit _w; - Pad *_source20, *_source22; - Pad *_drain40, *_drain42; + Pad *_source22; + Pad *_drain42; Pad *_grid00, *_grid01, *_grid30, *_grid31; Pad *_anonymous10, *_anonymous11, *_anonymous12, *_anonymous50; diff --git a/chamsin/src/tests/CapacitorViewer.cpp b/chamsin/src/tests/CapacitorViewer.cpp index 5d21c22e..e5dcf5f4 100644 --- a/chamsin/src/tests/CapacitorViewer.cpp +++ b/chamsin/src/tests/CapacitorViewer.cpp @@ -4,7 +4,10 @@ #include #include "Capacitor.h" +#include "hurricane/DataBase.h" #include "hurricane/viewer/CellWidget.h" +#include "hurricane/viewer/HInspectorWidget.h" +#include "hurricane/viewer/HPalette.h" #include "AEnv.h" #include "ATechnology.h" @@ -27,6 +30,8 @@ CapacitorViewer::CapacitorViewer(Library* library) { _capacitor->setL(capacitorMinL); _capacitor->setW(capacitorMinW); _cellWidget = new CellWidget; + _palette = new HPalette (); + _cellWidget->bindToPalette ( _palette ); _cellWidget->setCell(_capacitor); _cellWidget->fitToContents(); setCentralWidget(_cellWidget); @@ -51,8 +56,31 @@ CapacitorViewer::CapacitorViewer(Library* library) { dockWidget->setWidget(slidersWidget); addDockWidget(Qt::LeftDockWidgetArea, dockWidget); + + QDockWidget* layerMapDock = new QDockWidget ( tr("Layers") ); + layerMapDock->setFeatures ( QDockWidget::DockWidgetVerticalTitleBar + | QDockWidget::DockWidgetMovable + | QDockWidget::DockWidgetFloatable + ); + layerMapDock->setObjectName ( "HPalette" ); + layerMapDock->setWidget ( _palette ); + layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); + addDockWidget ( Qt::RightDockWidgetArea, layerMapDock ); + + _runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this ); + _runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") ); + + _runInspectorOnCell= new QAction ( tr("Inspect &Cell"), this ); + _runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") ); + connect(wSlider, SIGNAL(valueChanged(int)), this, SLOT(wvalueChanged(int))); connect(lSlider, SIGNAL(valueChanged(int)), this, SLOT(lvalueChanged(int))); + connect(_runInspectorOnDataBase, SIGNAL(triggered()) , this, SLOT(runInspectorOnDataBase())); + connect(_runInspectorOnCell , SIGNAL(triggered()) , this, SLOT(runInspectorOnCell ())); + + QMenu* toolsMenu = menuBar()->addMenu(tr("Tool")); + toolsMenu->addAction(_runInspectorOnDataBase); + toolsMenu->addAction(_runInspectorOnCell); } void CapacitorViewer::wvalueChanged(int value) { @@ -64,3 +92,27 @@ void CapacitorViewer::lvalueChanged(int value) { _capacitor->setL(value); _cellWidget->redraw(); } + +void CapacitorViewer::runInspectorOnDataBase() { + runInspector(getRecord(DataBase::getDB())); +} + +void CapacitorViewer::runInspectorOnCell() { + Cell* cell = _cellWidget->getCell(); + if (cell) { + runInspector(getRecord(cell)); + } +} + +void CapacitorViewer::runInspector(Record* record) { + static HInspectorWidget* inspector = NULL; + + if (record) { + inspector = new HInspectorWidget (); + + inspector->setRootRecord ( record ); + inspector->show (); + } else { + cerr << "[ERROR] Attempt to run Inspector on NULL record." << endl; + } +} diff --git a/chamsin/src/tests/CapacitorViewer.h b/chamsin/src/tests/CapacitorViewer.h index 7320a588..c1b06b9d 100644 --- a/chamsin/src/tests/CapacitorViewer.h +++ b/chamsin/src/tests/CapacitorViewer.h @@ -5,7 +5,10 @@ namespace Hurricane { class Library; + class Record; class CellWidget; + class HPalette; + class HMousePosition; } using namespace Hurricane; @@ -15,14 +18,28 @@ class CapacitorViewer : public QMainWindow { Q_OBJECT public: CapacitorViewer(Library* library); + private slots: void lvalueChanged(int value); void wvalueChanged(int value); + void runInspectorOnDataBase(); + void runInspectorOnCell(); private: CapacitorViewer(); + void createActions(); + void createMenus(); + void createLayout(); + void runInspector(Record* record); + CellWidget* _cellWidget; Capacitor* _capacitor; + QAction* _runInspectorOnDataBase; + QAction* _runInspectorOnCell; + QMenu* _viewMenu; + QMenu* _toolsMenu; + HPalette* _palette; + HMousePosition* _mousePosition; }; diff --git a/chamsin/src/tests/TransistorViewer.cpp b/chamsin/src/tests/TransistorViewer.cpp index 48f1625a..bea9f815 100644 --- a/chamsin/src/tests/TransistorViewer.cpp +++ b/chamsin/src/tests/TransistorViewer.cpp @@ -3,7 +3,7 @@ #include #include -#include "Transistor.h" +#include "MetaTransistor.h" #include "hurricane/viewer/CellWidget.h" #include "AEnv.h" #include "ATechnology.h" @@ -23,10 +23,11 @@ TransistorViewer::TransistorViewer(Library* library) { DbU::Unit transistorMinW = aTechnology->getPhysicalRule("transistorMinW")->getValue(); DbU::Unit transistorMaxW = aTechnology->getPhysicalRule("transistorMaxW")->getValue(); - _transistor = Transistor::create(library, Name("TEST")); - _transistor->setType(Transistor::Type::NMOS); + _transistor = MetaTransistor::create(library, Name("TEST")); + _transistor->setType(MetaTransistor::Type::NMOS); _transistor->setL(transistorMinL); _transistor->setW(transistorMinW); + _transistor->setM(1); _cellWidget = new CellWidget; _cellWidget->setCell(_transistor); _cellWidget->fitToContents(); @@ -39,6 +40,10 @@ TransistorViewer::TransistorViewer(Library* library) { lSlider->setRange(transistorMinL, 4 * transistorMinL); lSlider->setPageStep(DbU::grid(1)); lSlider->setSliderPosition(transistorMinL); + QSlider* mSlider = new QSlider(Qt::Horizontal); + mSlider->setRange(1, 5); + mSlider->setPageStep(1); + mSlider->setSliderPosition(1); QStringList choices; choices << "NMOS" << "PMOS"; QComboBox* choiceBox = new QComboBox; @@ -48,7 +53,8 @@ TransistorViewer::TransistorViewer(Library* library) { QGridLayout* layout = new QGridLayout; layout->addWidget(wSlider, 0, 0); layout->addWidget(lSlider, 1, 0); - layout->addWidget(choiceBox, 2, 0); + layout->addWidget(mSlider, 2, 0); + layout->addWidget(choiceBox, 3, 0); slidersWidget->setLayout(layout); QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this); @@ -59,6 +65,7 @@ TransistorViewer::TransistorViewer(Library* library) { connect(wSlider, SIGNAL(valueChanged(int)), this, SLOT(wvalueChanged(int))); connect(lSlider, SIGNAL(valueChanged(int)), this, SLOT(lvalueChanged(int))); + connect(mSlider, SIGNAL(valueChanged(int)), this, SLOT(mvalueChanged(int))); connect(choiceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(transistorTypeChanged(int))); } @@ -72,12 +79,17 @@ void TransistorViewer::lvalueChanged(int value) { _cellWidget->redraw(); } +void TransistorViewer::mvalueChanged(int value) { + _transistor->setM(value); + _cellWidget->redraw(); +} + void TransistorViewer::transistorTypeChanged(int value) { if (value == 0) { - _transistor->setType(Transistor::Type::NMOS); + _transistor->setType(MetaTransistor::Type::NMOS); _cellWidget->redraw(); } else if (value == 1) { - _transistor->setType(Transistor::Type::PMOS); + _transistor->setType(MetaTransistor::Type::PMOS); _cellWidget->redraw(); } } diff --git a/chamsin/src/tests/TransistorViewer.h b/chamsin/src/tests/TransistorViewer.h index 4076d49a..765a677e 100644 --- a/chamsin/src/tests/TransistorViewer.h +++ b/chamsin/src/tests/TransistorViewer.h @@ -9,7 +9,7 @@ namespace Hurricane { } using namespace Hurricane; -class Transistor; +class MetaTransistor; class TransistorViewer : public QMainWindow { Q_OBJECT @@ -19,11 +19,12 @@ class TransistorViewer : public QMainWindow { void lvalueChanged(int value); void wvalueChanged(int value); void transistorTypeChanged(int value); + void mvalueChanged(int value); private: TransistorViewer(); CellWidget* _cellWidget; - Transistor* _transistor; + MetaTransistor* _transistor; };