Add channel type determination belong nmos/pmos model parameter

This commit is contained in:
dwarning 2021-06-29 12:34:50 +02:00 committed by Holger Vogt
parent ba9834b1dc
commit 0ece04cdc8
5 changed files with 23 additions and 8 deletions

View File

@ -37,6 +37,7 @@
`define CLIP_HIGH(val,max) ((val)<(max)?(val):(max))
`define CLIP_BOTH(val,min,max) ((val)>(min)?((val)<(max)?(val):(max)):(min))
`define PGIVEN(p) $param_given(p)
// Note 1: In this va-code, the `P-macro is defined such that its argument
// is ignored during compilation; in this source code it acts as
// a comment

View File

@ -94,7 +94,9 @@ electrical BD;
// Special model parameters, some are also simulator global variables
parameter real LEVEL = 102 `P(info="Model level" unit="");
parameter real TYPE = 1.0 `from( -1.0,1.0 ) `P(info="Channel type parameter, +1=NMOS -1=PMOS" unit="");
parameter integer TYPE = 1 `from( -1 ,1 ) `P(info="Channel type parameter, +1=NMOS -1=PMOS" unit="");
parameter integer nmos = 1 `from( 0, 1 ) `P(desc="MOS channel type");
parameter integer pmos = 1 `from( 0, 1 ) `P(desc="MOS channel type");
parameter real TR = 21.0 `from( -273.0,inf ) `P(info="nominal (reference) temperature" unit="C");
// Switch parameters that turn models or effects on or off
@ -250,7 +252,9 @@ electrical BD;
// Special model parameters
parameter real LEVEL = 1020 `P(info="Model level" unit="");
parameter real TYPE = 1.0 `from( -1,1 ) `P(info="Channel type parameter, +1=NMOS -1=PMOS" unit="");
parameter integer TYPE = 1 `from( -1, 1 ) `P(info="Channel type parameter, +1=NMOS -1=PMOS" unit="");
parameter integer nmos = 1 `from( 0, 1 ) `P(desc="MOS channel type");
parameter integer pmos = 1 `from( 0, 1 ) `P(desc="MOS channel type");
// Reference Temperature
parameter real TR = 21.0 `from( -273.0,inf ) `P(info="nominal (reference) temperature" unit="C");
@ -992,11 +996,14 @@ analog begin
// 4.1 Internal parameters (including temperature scaling)
// (only internal parameters independent on instance parameters
// are calculated in this section)
if (TYPE >= 0) begin
CHNL_TYPE = `NMOS;
if (`PGIVEN(nmos)) begin
CHNL_TYPE = `NMOS;
end else if (`PGIVEN(pmos)) begin
CHNL_TYPE = `PMOS;
end else begin
CHNL_TYPE = `PMOS;
CHNL_TYPE = (`PGIVEN(TYPE)) ? TYPE : `NMOS;
end
//$strobe("CHNL_TYPE %d", CHNL_TYPE);
// Transistor temperature
TR_i = `CLIP_LOW(TR, -273);

View File

@ -32,6 +32,7 @@
// Explicit Gmin
`define GMIN $simparam("gmin",1e-15)
`define PGIVEN(p) $param_given(p)
`define PMOS -1
`define NMOS +1

View File

@ -584,11 +584,14 @@ analog begin
begin : initial_model
// Clipping and rounding of switch parameters
if (TYPE >= 0) begin
CHNL_TYPE = `NMOS;
if (`PGIVEN(nmos)) begin
CHNL_TYPE = `NMOS;
end else if (`PGIVEN(pmos)) begin
CHNL_TYPE = `PMOS;
end else begin
CHNL_TYPE = `PMOS;
CHNL_TYPE = (`PGIVEN(TYPE)) ? TYPE : `NMOS;
end
//$strobe("CHNL_TYPE %d", CHNL_TYPE);
EPSSI = `EPSO * `EPSRSI;
SWGEO_i = floor(`CLIP_BOTH(SWGEO, 0.0, 2.0) + 0.5);
SWIGATE_i = floor(`CLIP_BOTH(SWIGATE, 0.0, 2.0) + 0.5);

View File

@ -30,6 +30,9 @@
// Special model parameters, some are also simulator global variables
`MPInb(LEVEL ,103 ,"" ,"Model level")
`MPIty(TYPE ,1 ,"" ,"Channel type parameter, +1=NMOS -1=PMOS")
`MPIty(nmos ,1 ,"" ,"MOS channel type")
`MPIty(pmos ,1 ,"" ,"MOS channel type")
`MPRco(TR ,21.0 ,"degC" ,-273.0 ,inf ,"nominal (reference) temperature")
// Switch parameters that turn models or effects on or off