2004-06-06 14:13:59 +00:00
|
|
|
/***************************************************************************
|
2005-10-24 06:10:35 +00:00
|
|
|
mosfet.cpp
|
|
|
|
------------
|
2004-06-06 14:13:59 +00:00
|
|
|
begin : Fri Jun 4 2004
|
|
|
|
copyright : (C) 2003 by Michael Margraf
|
2004-06-16 17:41:33 +00:00
|
|
|
email : michael.margraf@alumni.tu-berlin.de
|
2004-06-06 14:13:59 +00:00
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "mosfet.h"
|
2007-02-19 07:07:50 +00:00
|
|
|
#include "node.h"
|
2004-06-06 14:13:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
MOSFET::MOSFET()
|
|
|
|
{
|
2007-02-27 07:04:18 +00:00
|
|
|
// properties obtained from "Basic_MOSFET" in mosfet_sub.cpp
|
2004-06-06 14:13:59 +00:00
|
|
|
Description = QObject::tr("MOS field-effect transistor");
|
2006-04-28 06:04:44 +00:00
|
|
|
createSymbol();
|
|
|
|
tx = x2+4;
|
|
|
|
ty = y1+4;
|
|
|
|
Model = "_MOSFET";
|
2004-06-06 14:13:59 +00:00
|
|
|
}
|
|
|
|
|
2006-04-28 06:04:44 +00:00
|
|
|
// -------------------------------------------------------
|
2004-06-06 14:13:59 +00:00
|
|
|
Component* MOSFET::newOne()
|
|
|
|
{
|
|
|
|
MOSFET* p = new MOSFET();
|
2004-08-08 17:52:32 +00:00
|
|
|
p->Props.first()->Value = Props.first()->Value;
|
|
|
|
p->Props.next()->Value = Props.next()->Value;
|
2005-10-24 06:10:35 +00:00
|
|
|
p->recreate(0);
|
2004-06-06 14:13:59 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2006-04-28 06:04:44 +00:00
|
|
|
// -------------------------------------------------------
|
2005-06-23 06:06:40 +00:00
|
|
|
Element* MOSFET::info(QString& Name, char* &BitmapFile, bool getNewOne)
|
2004-06-06 14:13:59 +00:00
|
|
|
{
|
|
|
|
Name = QObject::tr("n-MOSFET");
|
|
|
|
BitmapFile = "nmosfet";
|
|
|
|
|
|
|
|
if(getNewOne) return new MOSFET();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-28 06:04:44 +00:00
|
|
|
// -------------------------------------------------------
|
2005-06-23 06:06:40 +00:00
|
|
|
Element* MOSFET::info_p(QString& Name, char* &BitmapFile, bool getNewOne)
|
2004-06-06 14:13:59 +00:00
|
|
|
{
|
|
|
|
Name = QObject::tr("p-MOSFET");
|
|
|
|
BitmapFile = "pmosfet";
|
|
|
|
|
|
|
|
if(getNewOne) {
|
|
|
|
MOSFET* p = new MOSFET();
|
2004-10-13 19:51:59 +00:00
|
|
|
p->Props.first()->Value = "pfet";
|
|
|
|
p->Props.next()->Value = "-1.0 V";
|
2005-10-24 06:10:35 +00:00
|
|
|
p->recreate(0);
|
2004-06-06 14:13:59 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-28 06:04:44 +00:00
|
|
|
// -------------------------------------------------------
|
2005-06-23 06:06:40 +00:00
|
|
|
Element* MOSFET::info_depl(QString& Name, char* &BitmapFile, bool getNewOne)
|
2004-08-08 17:52:32 +00:00
|
|
|
{
|
|
|
|
Name = QObject::tr("depletion MOSFET");
|
|
|
|
BitmapFile = "dmosfet";
|
|
|
|
|
|
|
|
if(getNewOne) {
|
|
|
|
MOSFET* p = new MOSFET();
|
|
|
|
p->Props.first();
|
|
|
|
p->Props.next()->Value = "-1.0 V";
|
2005-10-24 06:10:35 +00:00
|
|
|
p->recreate(0);
|
2004-08-08 17:52:32 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-28 06:04:44 +00:00
|
|
|
// -------------------------------------------------------
|
|
|
|
void MOSFET::createSymbol()
|
2004-06-06 14:13:59 +00:00
|
|
|
{
|
2006-04-28 06:04:44 +00:00
|
|
|
Lines.append(new Line(-14,-13,-14, 13,QPen(QPen::darkBlue,3)));
|
|
|
|
Lines.append(new Line(-30, 0,-14, 0,QPen(QPen::darkBlue,2)));
|
|
|
|
|
|
|
|
Lines.append(new Line(-10,-11, 0,-11,QPen(QPen::darkBlue,2)));
|
|
|
|
Lines.append(new Line( 0,-11, 0,-30,QPen(QPen::darkBlue,2)));
|
|
|
|
Lines.append(new Line(-10, 11, 0, 11,QPen(QPen::darkBlue,2)));
|
|
|
|
Lines.append(new Line( 0, 0, 0, 30,QPen(QPen::darkBlue,2)));
|
|
|
|
Lines.append(new Line(-10, 0, 0, 0,QPen(QPen::darkBlue,2)));
|
|
|
|
|
|
|
|
Lines.append(new Line(-10,-16,-10, -7,QPen(QPen::darkBlue,3)));
|
|
|
|
Lines.append(new Line(-10, 7,-10, 16,QPen(QPen::darkBlue,3)));
|
2004-06-06 14:13:59 +00:00
|
|
|
|
2004-08-08 17:52:32 +00:00
|
|
|
if(Props.first()->Value == "nfet") {
|
2006-04-28 06:04:44 +00:00
|
|
|
Lines.append(new Line( -9, 0, -4, -5,QPen(QPen::darkBlue,2)));
|
|
|
|
Lines.append(new Line( -9, 0, -4, 5,QPen(QPen::darkBlue,2)));
|
2004-06-06 14:13:59 +00:00
|
|
|
}
|
|
|
|
else {
|
2006-04-28 06:04:44 +00:00
|
|
|
Lines.append(new Line( -1, 0, -6, -5,QPen(QPen::darkBlue,2)));
|
|
|
|
Lines.append(new Line( -1, 0, -6, 5,QPen(QPen::darkBlue,2)));
|
2004-06-06 14:13:59 +00:00
|
|
|
}
|
|
|
|
|
2004-08-15 16:24:35 +00:00
|
|
|
if((Props.next()->Value.stripWhiteSpace().at(0) == '-') ==
|
2006-04-28 06:04:44 +00:00
|
|
|
(Props.first()->Value == "nfet"))
|
|
|
|
Lines.append(new Line(-10, -8,-10, 8,QPen(QPen::darkBlue,3)));
|
|
|
|
else
|
|
|
|
Lines.append(new Line(-10, -4,-10, 4,QPen(QPen::darkBlue,3)));
|
|
|
|
|
|
|
|
Ports.append(new Port(-30, 0));
|
|
|
|
Ports.append(new Port( 0,-30));
|
|
|
|
Ports.append(new Port( 0, 30));
|
2004-08-08 17:52:32 +00:00
|
|
|
|
2006-04-28 06:04:44 +00:00
|
|
|
x1 = -30; y1 = -30;
|
|
|
|
x2 = 4; y2 = 30;
|
2004-06-06 14:13:59 +00:00
|
|
|
}
|
2007-02-19 07:07:50 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------
|
|
|
|
QString MOSFET::netlist()
|
|
|
|
{
|
|
|
|
QString s = "MOSFET:"+Name;
|
|
|
|
|
|
|
|
// output all node names
|
|
|
|
for(Port *p1 = Ports.first(); p1 != 0; p1 = Ports.next())
|
|
|
|
s += " "+p1->Connection->Name; // node names
|
|
|
|
s += " "+Ports.at(2)->Connection->Name; // connect substrate to source
|
|
|
|
|
|
|
|
// output all properties
|
|
|
|
for(Property *p2 = Props.first(); p2 != 0; p2 = Props.next())
|
|
|
|
s += " "+p2->Name+"=\""+p2->Value+"\"";
|
|
|
|
|
|
|
|
return s + '\n';
|
|
|
|
}
|