summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex')
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex500
1 files changed, 458 insertions, 42 deletions
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex
index 73f1485b2b..0f193cedcc 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex
@@ -1343,6 +1343,10 @@
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
\pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
}
+ \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0
+ \pgf@y=0pt
+ \pgf@x=0pt
+ }
\anchor{text}{
\northeast
\pgf@y=.7\pgf@y
@@ -1409,6 +1413,16 @@
\left
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
}
+ \anchor{bulk}{ %added by Burak Kelleci
+ \northeast
+ \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
+ \right
+ \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
+ }
+ \anchor{nobulk}{ %added by Burak Kelleci
+ \left
+ \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
+ }
\anchor{G}{
\northeast
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
@@ -1537,7 +1551,16 @@
}
\long\def\declarebpt#1{
- \pgfcircdeclaretransistor{#1}{}{
+ \pgfcircdeclaretransistor{#1}{
+ \anchor{inner up}{
+ \northeast
+ \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
+ }
+ }{
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
@@ -1572,7 +1595,7 @@
\edef\@@anchor{center}
\ifpgf@circuit@trans@ntype
\ifpgf@circuit@trans@arrowatend
- \edef\@@anchor{tip}
+ \edef\@@anchor{btip}
\pgftransformlineattime{1.0}{%
\pgfpoint%
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
@@ -1591,7 +1614,7 @@
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
}
\fi
- \else
+ \else % p-type
\ifpgf@circuit@trans@arrowatend
\edef\@@anchor{tip}
\pgftransformlineattime{1.0}{%
@@ -1611,7 +1634,7 @@
}
\fi
\fi
- \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
\endpgfscope
\ifpgf@circuit@bpt@drawphoto
@@ -1650,9 +1673,327 @@
\declarebpt{npn}
\declarebpt{pnp}
+%
+% multi-emitter and multi-collector BJTs by Romano Giannetti
+%
+\def\pgf@circ@bjt@C@anchor#1{% #1: collector number
+ \pgfextractx{\pgf@circ@res@temp}{\basedimension}
+ \pgfextracty{\pgf@circ@res@other}{\basedimension}
+ \ifnum\cdir>0 % NPN, above
+ \pgfpoint{\pgf@circ@res@temp}{%
+ \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
+ \else % PNP, below
+ \pgfpoint{\pgf@circ@res@temp}{%
+ -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
+ \fi
+}
+\def\pgf@circ@bjt@E@anchor#1{% #1: collector number
+ \pgfextractx{\pgf@circ@res@temp}{\basedimension}
+ \pgfextracty{\pgf@circ@res@other}{\basedimension}
+ \ifnum\cdir<0 % PNP, above
+ \pgfpoint{\pgf@circ@res@temp}{%
+ \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
+ \else % PNP, below
+ \pgfpoint{\pgf@circ@res@temp}{%
+ -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
+ \fi
+}
+
+\long\def\declarebjt#1{
+ \pgfdeclareshape{bjt#1}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
+ % \cdir is 1 for npn, -1 for pnp
+ \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
+ \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
+ \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
+ % step up or down for the additional C/Es
+ \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
+ \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
+ \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
+ \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
+ \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
+ \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
+ \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
+ \pgf@y=.5\pgf@y
+ \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
+ \pgf@x=.5\pgf@x
+ }
+ \savedanchor\northeast{% upper right
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@circ@res@step}{%
+ \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
+ \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \ifnum\cdir> 0
+ \edef\numup{\numC}\edef\numdown{\numE}
+ \else
+ \edef\numup{\numE}\edef\numdown{\numC}
+ \fi
+ \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
+ + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
+ + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
+ \pgf@x=.5\pgf@x
+ }
+ \savedanchor\southeast{% lower right
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@circ@res@step}{%
+ \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
+ \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \ifnum\cdir> 0
+ \edef\numup{\numC}\edef\numdown{\numE}
+ \else
+ \edef\numup{\numE}\edef\numdown{\numC}
+ \fi
+ \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
+ - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
+ - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
+ \pgf@x=.5\pgf@x
+ }
+ \savedanchor\southwest{% lower left
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@circ@res@step}{%
+ \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
+ \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \ifnum\cdir> 0
+ \edef\numup{\numC}\edef\numdown{\numE}
+ \else
+ \edef\numup{\numE}\edef\numdown{\numC}
+ \fi
+ \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
+ - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
+ - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
+ - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ }
+ \anchor{center}{\pgfpointorigin}
+ \anchor{north}{\northeast\pgf@x=0cm\relax}
+ \anchor{east}{\northeast\pgf@y=0cm\relax}
+ \anchor{south}{\southwest\pgf@x=0cm\relax}
+ \anchor{west}{\southwest\pgf@y=0cm}
+ \anchor{north east}{\northeast}
+ \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
+ \anchor{south west}{\southwest}
+ \anchor{south east}{\southeast}
+
+ \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
+ \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
+ \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
+ \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
+ % center of the base "bar"
+ \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
+ \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
+ }
+ % geometrical centers
+ \anchor{vcenter}{\pgf@x=0cm\relax
+ \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
+ }
+ \anchor{gcenter}{%
+ \northeast\pgf@xa=0.5\pgf@x
+ \southwest\advance\pgf@xa by 0.5\pgf@x
+ \pgf@x=\pgf@xa
+ \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
+ }
+ % external connections
+ \anchor{E}{
+ \ifnum\cdir>0% npn, emitter down
+ \southeast
+ \else
+ \northeast
+ \fi
+ }% first emitter
+ \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
+ \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
+ \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
+
+ \backgroundpath{
+ \pgftransformationadjustments
+ \pgfsetcolor{\ctikzvalof{color}}
+ %
+ % set the type and up and down number of connections
+ %
+ \ifnum\cdir> 0
+ \pgf@circuit@trans@ntypetrue
+ \edef\numup{\numC}
+ \edef\numdown{\numE}
+ \else
+ \pgf@circuit@trans@ntypefalse
+ \edef\numup{\numE}
+ \edef\numdown{\numC}
+ \fi
+ \basedimension
+ \pgf@circ@res@up = \pgf@y
+ \pgf@circ@res@down = -\pgf@y
+ \pgf@circ@res@right = \pgf@x
+ \pgf@circ@res@left = -\pgf@x
+ \pgf@circ@scaled@Rlen=\scaledRlen
+ \pgf@circ@res@step=\multistep
+ %
+ % set arrow positions options
+ %
+ \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
+ \ifpgf@circuit@trans@arrowatend
+ \edef\@@pos{1.0}
+ \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
+ \edef\@@anchor{btip}
+ \else
+ \edef\@@anchor{tip}
+ \fi
+ \fi
+ %
+ % Drawing upper connections
+ %
+ \pgfscope
+ \pgf@circ@count@a=\numup\relax
+ \pgfmathloop%
+ \ifnum\pgf@circ@count@a>0
+ \advance\pgf@circ@count@a-1\relax
+ \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
+ \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
+ \pgfpathmoveto{\pgfpoint
+ {\pgf@circ@res@right}%
+ {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
+ \pgfpathlineto{\pgfpoint
+ {\pgf@circ@res@right}%
+ {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
+ \else
+ \pgfpathmoveto{\pgfpoint
+ {\pgf@circ@res@right}%
+ {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
+ \fi
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
+ {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
+ \pgfsetroundcap % better when connecting to sloped lines
+ \pgfusepath{draw}
+ \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint
+ {\pgf@circ@res@right}%
+ {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
+ }{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
+ {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
+ }
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+ \fi
+ \repeatpgfmathloop
+ \endpgfscope
+ %
+ % Drawing base
+ %
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
+ {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
+ \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfsetroundcap % I like it more...
+ \pgfusepath{draw}
+ \endpgfscope
+ %
+ % draw base external connection
+ %
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
+ \pgfusepath{draw}
+ %
+ % Drawing lower connections
+ %
+ \pgfscope
+ \pgf@circ@count@a=\numdown\relax
+ \pgfmathloop%
+ \ifnum\pgf@circ@count@a>0
+ \advance\pgf@circ@count@a-1\relax
+ \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
+ {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
+ \pgfpathlineto{\pgfpoint
+ {\pgf@circ@res@right}
+ {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
+ \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
+ \pgfpathlineto{\pgfpoint
+ {\pgf@circ@res@right}
+ {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
+ \fi
+ \pgfsetroundcap % better when connecting to sloped lines
+ \pgfusepath{draw}
+ \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
+ \pgfscope
+ \pgfslopedattimetrue
+ \pgfallowupsidedownattimetrue
+ \pgfresetnontranslationattimefalse
+ \pgftransformlineattime{\@@pos}{%
+ \pgfpoint
+ {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
+ {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
+ }{\pgfpoint
+ {\pgf@circ@res@right}%
+ {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
+ }
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \endpgfscope
+ \fi
+ \repeatpgfmathloop
+ \endpgfscope
+ }
+ % \pgf@sh@s@<name of the shape here> contains all the code for the shape
+ % and is executed just before a node is drawn.
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
+ % Start with the maximum collector number and go backwards.
+ \pgf@circ@count@a=\numC\relax
+ \pgfmathloop%
+ \ifnum\pgf@circ@count@a>0
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
+ \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
+ }
+ \advance\pgf@circ@count@a by -1\relax%
+ \repeatpgfmathloop%
+ % and emitters
+ \pgf@circ@count@a=\numE\relax
+ \pgfmathloop%
+ \ifnum\pgf@circ@count@a>0
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
+ \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
+ }
+ \advance\pgf@circ@count@a by -1\relax%
+ \repeatpgfmathloop%
+ }%
+ }
+}
+
+\declarebjt{npn}
+\declarebjt{pnp}
+
+% end of multi-bjts
\long\def\declareigbt#1{
- \pgfcircdeclaretransistor{#1}{}
+ \pgfcircdeclaretransistor{#1}{
+ \anchor{inner up}{
+ \northeast
+ \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
+ }
+ }
{
%draw upper connection
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
@@ -1694,7 +2035,11 @@
\pgfallowupsidedownattimetrue
\pgfresetnontranslationattimefalse
\ifpgf@circuit@trans@arrowatend
- \edef\@@anchor{tip}\edef\@@pos{1.0}
+ \ifpgf@circuit@trans@ntype
+ \edef\@@anchor{btip}\edef\@@pos{1.0}
+ \else
+ \edef\@@anchor{tip}\edef\@@pos{1.0}
+ \fi
\else
\edef\@@anchor{center}\edef\@@pos{0.5}
\fi
@@ -1716,7 +2061,7 @@
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
}
\fi
- \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
\endpgfscope
%draw gate
\ifpgf@circuit@trans@ntype
@@ -1741,7 +2086,16 @@
\declareigbt{Lnigbt}
\declareigbt{Lpigbt}
-\pgfcircdeclaretransistor{nmos}{}{%
+\pgfcircdeclaretransistor{nmos}{
+ \anchor{inner up}{
+ \northeast
+ \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
+ }
+ }{%
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
@@ -1780,7 +2134,7 @@
{\pgf@circ@res@right}%
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
}
- \pgfnode{currarrow}{tip}{}{}{\pgfusepath{stroke}}
+ \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
\else
\pgfslopedattimetrue
\pgfallowupsidedownattimetrue
@@ -1806,9 +2160,26 @@
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
\pgfusepath{draw}
\fi
+
+ \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
+ {\pgf@circ@res@up+\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
+ {\pgf@circ@res@up+\pgf@circ@res@down}}
+ \pgfusepath{draw}
+ \fi
}
-\pgfcircdeclaretransistor{pmos}{}{%
+\pgfcircdeclaretransistor{pmos}{
+ \anchor{inner up}{
+ \northeast
+ \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
+ }
+ }{%
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
@@ -1825,7 +2196,7 @@
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
}
\pgftransformrotate{180}
- \pgfnode{currarrow}{tip}{}{}{\pgfusepath{stroke}}
+ \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
\else
\pgfslopedattimetrue
\pgfallowupsidedownattimetrue
@@ -1877,7 +2248,16 @@
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
\pgfusepath{draw}
\fi
- \ifpgf@circuit@pmos@nocircle\else
+
+ \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
+ {\pgf@circ@res@up+\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
+ {\pgf@circ@res@up+\pgf@circ@res@down}}
+ \pgfusepath{draw}
+ \fi
+
+ \ifpgf@circuit@pmos@nocircle\else
% we are not scaling the circle with the MOS --- I think it's better to have it
% coherent with the poles/nodes of the rest of the circuit.
\pgfpathcircle{\pgfpoint
@@ -1891,7 +2271,16 @@
}
%% HEMT FET Transistor
-\pgfcircdeclaretransistor{hemt}{}{%
+\pgfcircdeclaretransistor{hemt}{
+ \anchor{inner up}{
+ \northeast
+ \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
+ }
+ }{%
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
{\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
@@ -1998,10 +2387,11 @@
\pgfallowupsidedownattimetrue
\pgfresetnontranslationattimefalse
\ifpgf@circuit@trans@arrowatend
- \edef\@@anchor{tip}
\ifpgf@circuit@trans@ntype
+ \edef\@@anchor{tip}
\edef\@@pos{1.0}
\else
+ \edef\@@anchor{btip}
\edef\@@pos{0.0}
\fi
\else
@@ -2020,7 +2410,7 @@
\else
\pgftransformrotate{180}
\fi
- \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
\endpgfscope
% GATE CONNECTION
@@ -2045,6 +2435,14 @@
{\pgfcircdeclaretransistor{#1}{
\anchor{bulk}{\left\pgf@x=0pt}
\anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
+ \anchor{inner up}{
+ \northeast
+ \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
+ }
#2
}
{#3}
@@ -2163,7 +2561,16 @@
\fi
}
-\pgfcircdeclaretransistor{njfet}{}{%
+\pgfcircdeclaretransistor{njfet}{
+ \anchor{inner up}{
+ \northeast
+ \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
+ }
+ }{%
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
{\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
@@ -2208,7 +2615,7 @@
{\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}%
{\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
}
- \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
\endpgfscope
\pgfpathmoveto{\pgfpoint
@@ -2219,7 +2626,16 @@
\pgfusepath{draw}
}
-\pgfcircdeclaretransistor{pjfet}{}{%
+\pgfcircdeclaretransistor{pjfet}{
+ \anchor{inner up}{
+ \northeast
+ \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
+ }
+ \anchor{inner down}{
+ \northeast
+ \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
+ }
+ }{%
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
{\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
@@ -2251,7 +2667,7 @@
\pgfallowupsidedownattimetrue
\pgfresetnontranslationattimefalse
\ifpgf@circuit@trans@arrowatend
- \edef\@@anchor{tip}\edef\@@pos{1.0}
+ \edef\@@anchor{btip}\edef\@@pos{1.0}
\else
\edef\@@anchor{center}\edef\@@pos{0.4}
\fi
@@ -2263,7 +2679,7 @@
\pgfpoint{\pgf@circ@res@left}%
{\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
}
- \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
\endpgfscope
\pgfpathmoveto{\pgfpoint
@@ -2342,7 +2758,7 @@
{\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
{\pgf@circ@res@up+\pgf@circ@res@down}%
}
- \pgfnode{currarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
+ \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
\endpgfscope
\pgfusepath{draw}
@@ -2856,33 +3272,33 @@
\pgf@circ@res@step=\pgf@circ@res@right
\advance\pgf@circ@res@step by -\pgf@circ@res@left
\pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
-
+
% Initial point (right vertex)
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
-
+
% Negative output terminal
\pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
\pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
-
+
% Top vertex
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
-
+
% Bottom vertex
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
-
+
% Positive output terminal
\pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
\pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
-
+
% Right vertex
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
-
+
\pgfpathclose
\pgf@circ@draworfill
\endpgfscope
-
+
% Negative input terminal
\pgfpathmoveto{\pgfpoint
{\pgf@circ@res@left}
@@ -3092,7 +3508,7 @@
\pgfscope
\newdimen\pgf@circ@res@right@double
\pgf@circ@res@right@double=2\pgf@circ@res@right
-
+
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
\pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
\pgf@circ@res@step=\pgf@circ@res@right
@@ -3110,7 +3526,7 @@
\pgfpathclose
\pgf@circ@draworfill
\endpgfscope
-
+
% input terminal up
\pgfpathmoveto{\pgfpoint
{\pgf@circ@res@left}
@@ -3131,12 +3547,12 @@
{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
\pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi}
-
+
% output leads down and up
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
\pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi}
-
+
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
\pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi}
@@ -3260,8 +3676,8 @@
\pgfscope
\newdimen\pgf@circ@res@right@double
- \pgf@circ@res@right@double=2\pgf@circ@res@right
-
+ \pgf@circ@res@right@double=2\pgf@circ@res@right
+
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
\pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
\pgf@circ@res@step=\pgf@circ@res@right
@@ -3452,7 +3868,7 @@
\pgfscope
\newdimen\pgf@circ@res@right@double
\pgf@circ@res@right@double=2\pgf@circ@res@right
-
+
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
\pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
\pgf@circ@res@step=\pgf@circ@res@right
@@ -3470,7 +3886,7 @@
\pgfpathclose
\pgf@circ@draworfill
\endpgfscope
-
+
% Negative input terminal
\pgfpathmoveto{\pgfpoint
{\pgf@circ@res@left}
@@ -3491,7 +3907,7 @@
{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
\pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi}
-
+
% Output terminal
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
@@ -3675,7 +4091,7 @@
\pgf@circ@res@right = -\pgf@x
\pgf@circ@res@left = \pgf@x
\pgf@circ@scaled@Rlen=\scaledRlen
-
+
\newdimen\pgf@circ@res@right@double
\pgf@circ@res@right@double=2\pgf@circ@res@right
@@ -3715,8 +4131,8 @@
\pgfpathlineto{\pgfpoint
{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
{-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
-
- % Negative input terminal
+
+ % Negative input terminal
\pgfpathmoveto{\pgfpoint
{\pgf@circ@res@left}
{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
@@ -3736,7 +4152,7 @@
{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
\pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi}
-
+
% Output terminal
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %