From b6701ec1a604ea503211cc82d03f12d84f3221ea Mon Sep 17 00:00:00 2001 From: Stephanie Youssef Date: Mon, 21 Jul 2008 14:15:10 +0000 Subject: [PATCH] Capacitor Layout in progress --- chamsin/src/analogic/Capacitor.cpp | 39 +++++++++++++++++++++++++++++- chamsin/src/analogic/Capacitor.h | 8 ++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/chamsin/src/analogic/Capacitor.cpp b/chamsin/src/analogic/Capacitor.cpp index a2794249..3b775143 100644 --- a/chamsin/src/analogic/Capacitor.cpp +++ b/chamsin/src/analogic/Capacitor.cpp @@ -1,10 +1,38 @@ +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/Pad.h" #include "hurricane/UpdateSession.h" using namespace Hurricane; #include "Capacitor.h" +namespace { + +Layer* getLayer(Technology* technology, const string& layerStr) { + Layer* layer = technology->getLayer(layerStr); + if (!layer) { + throw Error("Unknown Layer : " + layerStr); + } + return layer; +} + +Pad* createPad(Technology* technology, Net* net, const string& layerName) { + static Box emptyBox(0, 0, 0, 0); + Layer* layer = getLayer(technology, layerName); + Pad* pad = Pad::create(net, layer, emptyBox); + return pad; +} + + +} + +const Name Capacitor::BottomPlateName("BOTTOMPLATE"); +const Name Capacitor::TopPlateName("TOPPLATE"); + Capacitor::Capacitor(Library* library, const Name& name): - AnalogComponent(library, name) + AnalogComponent(library, name), + _bottomPlate(NULL), _topPlate(NULL), + _l(0), _w(0) {} Capacitor* Capacitor::create(Library* library, const Name& name) { @@ -18,4 +46,13 @@ Capacitor* Capacitor::create(Library* library, const Name& name) { void Capacitor::_postCreate() { Inherit::_postCreate(); + DataBase* db = DataBase::getDB(); + Technology* technology = db->getTechnology(); + + _bottomPlate = Net::create(this, BottomPlateName); + _bottomPlate->setExternal(true); + _topPlate = Net::create(this, TopPlateName); + _topPlate->setExternal(true); + + _topPlate20 = createPad(technology, _topPlate, "cut6"); } diff --git a/chamsin/src/analogic/Capacitor.h b/chamsin/src/analogic/Capacitor.h index 4406c105..c2e52030 100644 --- a/chamsin/src/analogic/Capacitor.h +++ b/chamsin/src/analogic/Capacitor.h @@ -5,12 +5,20 @@ class Capacitor : public AnalogComponent { public: + static const Name BottomPlateName; + static const Name TopPlateName; + static Capacitor* create(Library* library, const Name& name); protected: void _postCreate(); private: + Net* _bottomPlate; + Net* _topPlate; + DbU::Unit _l; + DbU::Unit _w; + Pad *_topPlate20; Capacitor(Library* library, const Name& name); };