added "place=header" (in addition to "place=end" attribuite value) to print code block as a header in spice netlists
This commit is contained in:
parent
73b51dff79
commit
771123550e
|
|
@ -141,6 +141,10 @@ function process( i, iprefix)
|
|||
spiceprefix=$3
|
||||
return
|
||||
}
|
||||
if($0 ~/\*\*\*\* begin user header code/){ #20180129
|
||||
user_code=1
|
||||
return
|
||||
}
|
||||
if($0 ~/\*\*\*\* begin user architecture code/){ #20180129
|
||||
user_code=1
|
||||
print
|
||||
|
|
@ -151,6 +155,10 @@ function process( i, iprefix)
|
|||
print
|
||||
return
|
||||
}
|
||||
if($0 ~/\*\*\*\* end user header code/){ #20180129
|
||||
user_code=0
|
||||
return
|
||||
}
|
||||
if(user_code) { #20180129
|
||||
print
|
||||
return
|
||||
|
|
|
|||
|
|
@ -152,6 +152,32 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
dbg(0, "global_spice_netlist(): problems opening netlist file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
first = 0;
|
||||
for(i=0;i<xctx->instances;i++) /* print netlist_commands of top level cell with 'place=header' property */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(1264, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
my_strdup(1265, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(!place) {
|
||||
my_strdup(1266, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
|
||||
}
|
||||
if(place && !strcmp(place, "header" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user header code\n");
|
||||
first++;
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
}
|
||||
if(first) fprintf(fd,"**** end user header code\n");
|
||||
|
||||
/* netlist_options */
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if(!(xctx->inst[i].ptr+ xctx->sym)->type) continue;
|
||||
|
|
@ -188,7 +214,8 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
spice_netlist(fd, 0);
|
||||
|
||||
first = 0;
|
||||
for(i=0;i<xctx->instances;i++) /* print netlist_commands of top level cell with no 'place=end' property */
|
||||
for(i=0;i<xctx->instances;i++) /* print netlist_commands of top level cell with no 'place=end' property
|
||||
and no place=header */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
|
|
@ -198,13 +225,13 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
my_strdup(381, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
my_strdup(382, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(!place || strcmp(place, "end" )) {
|
||||
if(!place) {
|
||||
my_strdup(383, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
|
||||
if(!place || strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
if(!place || (strcmp(place, "end") && strcmp(place, "header")) ) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ S {}
|
|||
E {}
|
||||
T {CMOS DIFFERENTIAL AMPLIFIER
|
||||
EXAMPLE} 250 -650 0 0 0.4 0.4 {}
|
||||
T {This is an example of a code block that will
|
||||
be placed as a header in the netlist.
|
||||
use 'place=header' attribute and set the
|
||||
header text as a 'value' attribute} 720 -720 0 0 0.4 0.4 {}
|
||||
N 30 -310 30 -280 {lab=VCC}
|
||||
N 30 -310 60 -310 {lab=VCC}
|
||||
N 260 -240 260 -190 {lab=GN}
|
||||
|
|
@ -108,3 +112,9 @@ C {ngspice_probe.sym} 600 -260 0 0 {name=r3}
|
|||
C {ngspice_probe.sym} 770 -420 0 0 {name=r4}
|
||||
C {ngspice_get_value.sym} 620 -160 0 0 {name=r5 node=i(@$\{path\}m1[id])
|
||||
descr="I="}
|
||||
C {code.sym} 920 -580 0 0 {name=HEADER
|
||||
place=header
|
||||
only_toplevel=true
|
||||
value="** ======================== **
|
||||
** This is a netlist header **
|
||||
** ======================== **"}
|
||||
|
|
|
|||
Loading…
Reference in New Issue