adding device MetaCapacitor

TransistorViewer is now a MetaTransistorViewer
This commit is contained in:
Christophe Alexandre 2008-07-24 14:29:55 +00:00
parent 6dac4660ca
commit ebb050c99b
10 changed files with 155 additions and 26 deletions

View File

@ -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})

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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

View File

@ -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));

View File

@ -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;

View File

@ -4,7 +4,10 @@
#include <QComboBox>
#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;
}
}

View File

@ -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;
};

View File

@ -3,7 +3,7 @@
#include <QDockWidget>
#include <QComboBox>
#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();
}
}

View File

@ -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;
};