updates for Vacask netlister

This commit is contained in:
stefan schippers 2025-07-25 14:53:15 +02:00
parent 720bf93a73
commit edcd141a22
6 changed files with 50 additions and 47 deletions

View File

@ -50,7 +50,7 @@ BEGIN{
# join split lines
{
if($0 ~ /^\*\*\*\* begin user (architecture|header) code/) {
if($0 ~ /^\/\/\/\/ begin user (architecture|header) code/) {
user_code = 1
}
if($0 ~ /^[+]/ && !user_code) {
@ -67,7 +67,7 @@ BEGIN{
}
line[lines++] = $0
}
if($0 ~ /^\*\*\*\* end user (architecture|header) code/) {
if($0 ~ /^\/\/\/\/ end user (architecture|header) code/) {
user_code = 0
}
}
@ -150,29 +150,29 @@ function sign(x)
function process( i,j, iprefix, saveinstr, savetype, saveanalysis)
{
if($0 ~/\*\*\*\* end_element/){
if($0 ~/\/\/\/\/ end_element/){
spiceprefix=""
return
}
if($0 ~/\*\*\*\* spice_prefix/){
if($0 ~/\/\/\/\/ spice_prefix/){
spiceprefix=$3
return
}
if($0 ~/\*\*\*\* begin user header code/){ #20180129
if($0 ~/\/\/\/\/ begin user header code/){ #20180129
user_code=1
return
}
if($0 ~/\*\*\*\* begin user architecture code/){ #20180129
if($0 ~/\/\/\/\/ begin user architecture code/){ #20180129
user_code=1
print
return
}
if($0 ~/\*\*\*\* end user architecture code/){ #20180129
if($0 ~/\/\/\/\/ end user architecture code/){ #20180129
user_code=0
print
return
}
if($0 ~/\*\*\*\* end user header code/){ #20180129
if($0 ~/\/\/\/\/ end user header code/){ #20180129
user_code=0
return
}
@ -182,7 +182,7 @@ function process( i,j, iprefix, saveinstr, savetype, saveanalysis)
}
# 20181208 do not process commented lines
if($1 ~/^\*/) {
if($1 ~/^\//) {
print
return
}
@ -274,7 +274,7 @@ function process( i,j, iprefix, saveinstr, savetype, saveanalysis)
}
}
} else if( $1 ~ /^\*\.(ipin|opin|iopin)/ ) {
} else if( $1 ~ /^\/\.(ipin|opin|iopin)/ ) {
num=split($2,name,",")
for(i=1;i<=num;i++) print $1 " " name[i]
} else if( tolower($1) ~ /\.subckt/) {

View File

@ -75,7 +75,7 @@ static int spectre_netlist(FILE *fd, int spectre_stop )
type = (xctx->inst[i].ptr+ xctx->sym)->type;
if( type && IS_PIN(type) ) {
if(top_sub && !flag) {
fprintf(fd, "*.PININFO ");
fprintf(fd, "//.PININFO ");
flag = 1;
}
if(top_sub) {
@ -101,14 +101,14 @@ static int spectre_netlist(FILE *fd, int spectre_stop )
if(xctx->netlist_count &&
!strboolcmp(get_tok_value(xctx->inst[i].prop_ptr, "only_toplevel", 0), "true")) continue;
if(!strcmp(type,"netlist_commands")) {
fprintf(fd,"**** begin user architecture code\n");
fprintf(fd,"//// begin user architecture code\n");
print_spectre_element(fd, i) ; /* this is the element line */
fprintf(fd,"**** end user architecture code\n");
fprintf(fd,"//// end user architecture code\n");
} else {
char *val = NULL;
const char *m;
if(print_spectre_element(fd, i)) {
fprintf(fd, "**** end_element\n");
fprintf(fd, "//// end_element\n");
}
/* hash device_model attribute if any */
my_strdup2(_ALLOC_ID_, &val, get_tok_value(xctx->inst[i].prop_ptr, "spectre_device_model", 2));
@ -195,12 +195,12 @@ int global_spectre_netlist(int global, int alert) /* netlister driver */
dbg(0, "global_spectre_netlist(): problems opening netlist file\n");
return 1;
}
fprintf(fd, "** sch_path: %s\n", xctx->sch[xctx->currsch]);
fprintf(fd, "// sch_path: %s\n", xctx->sch[xctx->currsch]);
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
} else {
my_snprintf(cellname, S(cellname), "%s.spice", get_cell(xctx->sch[xctx->currsch], 0));
my_snprintf(cellname, S(cellname), "%s.spectre", get_cell(xctx->sch[xctx->currsch], 0));
}
first = 0;
@ -214,13 +214,13 @@ int global_spectre_netlist(int global, int alert) /* netlister driver */
my_strdup(_ALLOC_ID_, &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");
if(first == 0) fprintf(fd,"//// begin user header code\n");
++first;
print_spectre_element(fd, i) ; /* this is the element line */
}
}
}
if(first) fprintf(fd,"**** end user header code\n");
if(first) fprintf(fd,"//// end user header code\n");
/* netlist_options */
for(i=0;i<xctx->instances; ++i) {
@ -230,7 +230,7 @@ int global_spectre_netlist(int global, int alert) /* netlister driver */
netlist_options(i);
}
}
if(!top_sub) fprintf(fd,"**");
if(!top_sub) fprintf(fd,"//");
if(uppercase_subckt)
fprintf(fd,"SUBCKT %s ( ", get_cell(xctx->sch[xctx->currsch], 0));
else
@ -280,7 +280,7 @@ int global_spectre_netlist(int global, int alert) /* netlister driver */
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
}
if(!place || (strcmp(place, "end") && strcmp(place, "header")) ) {
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
if(first == 0) fprintf(fd,"//// begin user architecture code\n");
++first;
print_spectre_element(fd, i) ; /* this is the element line */
}
@ -289,15 +289,15 @@ int global_spectre_netlist(int global, int alert) /* netlister driver */
xctx->netlist_count++;
if(xctx->schprop && xctx->schprop[0]) {
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
if(xctx->schspectreprop && xctx->schspectreprop[0]) {
if(first == 0) fprintf(fd,"//// begin user architecture code\n");
++first;
fprintf(fd, "%s\n", xctx->schprop);
fprintf(fd, "%s\n", xctx->schspectreprop);
}
if(first) fprintf(fd,"**** end user architecture code\n");
if(first) fprintf(fd,"//// end user architecture code\n");
/* /20100217 */
if(!top_sub) fprintf(fd,"**");
if(!top_sub) fprintf(fd,"//");
if(uppercase_subckt)
fprintf(fd, "ENDS\n");
else
@ -443,13 +443,13 @@ int global_spectre_netlist(int global, int alert) /* netlister driver */
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0));
if( type && !strcmp(type,"netlist_commands") ) {
if(place && !strcmp(place, "end" )) {
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
if(first == 0) fprintf(fd,"//// begin user architecture code\n");
++first;
print_spectre_element(fd, i) ;
} else {
my_strdup(_ALLOC_ID_, &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");
if(first == 0) fprintf(fd,"//// begin user architecture code\n");
++first;
print_spectre_element(fd, i) ;
}
@ -462,7 +462,7 @@ int global_spectre_netlist(int global, int alert) /* netlister driver */
for(i=0;i<model_table.size; ++i) {
model_entry=model_table.table[i];
while(model_entry) {
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
if(first == 0) fprintf(fd,"//// begin user architecture code\n");
++first;
fprintf(fd, "%s\n", model_entry->value);
model_entry = model_entry->next;
@ -470,11 +470,11 @@ int global_spectre_netlist(int global, int alert) /* netlister driver */
}
str_hash_free(&model_table);
str_hash_free(&subckt_table);
if(first) fprintf(fd,"**** end user architecture code\n");
if(first) fprintf(fd,"//// end user architecture code\n");
/* 20150922 added split_files check */
if( !top_sub && !split_f) fprintf(fd, ".end\n");
/* if( !top_sub && !split_f) fprintf(fd, ".end\n"); */
dbg(1, "global_spectre_netlist(): starting awk on netlist!\n");
@ -543,11 +543,11 @@ int spectre_block_netlist(FILE *fd, int i, int alert)
err = 1;
goto err;
}
my_snprintf(cellname, S(cellname), "%s.spice", get_cell(name, 0));
my_snprintf(cellname, S(cellname), "%s.spectre", get_cell(name, 0));
}
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n", name,xctx->sym[i].rects[PINLAYER] );
if(xctx->sym[i].base_name) fprintf(fd, "** sym_path: %s\n", abs_sym_path(xctx->sym[i].base_name, ""));
else fprintf(fd, "** sym_path: %s\n", sanitized_abs_sym_path(name, ""));
fprintf(fd, "\n// expanding symbol: %s # of pins=%d\n", name,xctx->sym[i].rects[PINLAYER] );
if(xctx->sym[i].base_name) fprintf(fd, "// sym_path: %s\n", abs_sym_path(xctx->sym[i].base_name, ""));
else fprintf(fd, "// sym_path: %s\n", sanitized_abs_sym_path(name, ""));
my_strdup(_ALLOC_ID_, &sym_def, get_tok_value(xctx->sym[i].prop_ptr,"spectre_sym_def",0));
if(sym_def) {
char *symname_attr = NULL;
@ -561,7 +561,7 @@ int spectre_block_netlist(FILE *fd, int i, int alert)
const char *s = get_tok_value(xctx->sym[i].templ,"model",0);
if(!s[0]) s = get_cell(sanitize(name), 0);
fprintf(fd, "** sch_path: %s\n", sanitized_abs_sym_path(filename, ""));
fprintf(fd, "// sch_path: %s\n", sanitized_abs_sym_path(filename, ""));
if(uppercase_subckt)
fprintf(fd, "SUBCKT %s ( ", s);
else
@ -583,10 +583,10 @@ int spectre_block_netlist(FILE *fd, int i, int alert)
get_additional_symbols(1);
err |= spectre_netlist(fd, spectre_stop); /* 20111113 added spectre_stop */
err |= warning_overlapped_symbols(0);
if(xctx->schprop && xctx->schprop[0]) {
fprintf(fd,"**** begin user architecture code\n");
fprintf(fd, "%s\n", xctx->schprop);
fprintf(fd,"**** end user architecture code\n");
if(xctx->schspectreprop && xctx->schspectreprop[0]) {
fprintf(fd,"//// begin user architecture code\n");
fprintf(fd, "%s\n", xctx->schspectreprop);
fprintf(fd,"//// end user architecture code\n");
}
if(uppercase_subckt)
fprintf(fd, "ENDS\n\n");

View File

@ -3055,7 +3055,7 @@ int print_spectre_element(FILE *fd, int inst)
/* @spiceprefix needs a special tag for postprocessing */
if(!strcmp(token, "@spiceprefix") && value[0]) {
my_realloc(_ALLOC_ID_, &spiceprefixtag, tok_val_len+22);
my_snprintf(spiceprefixtag, tok_val_len+22, "**** spice_prefix %s\n", value);
my_snprintf(spiceprefixtag, tok_val_len+22, "//// spice_prefix %s\n", value);
value = spiceprefixtag;
}

View File

@ -1,4 +1,4 @@
v {xschem version=3.4.5 file_version=1.2
v {xschem version=3.4.8RC file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
@ -23,10 +23,11 @@ G {}
K {type=ammeter
format="@name @pinlist 0 @savecurrent"
template="name=Vmeas savecurrent=true spice_ignore=0"
}
spectre_format="@name ( @pinlist ) vsource dc=0"
spectre_device_model="model vsource vsource"}
V {}
S {}
F {}
E {}
L 4 0 -30 0 30 {}
L 4 -7.5 0 -0 10 {}

View File

@ -26,7 +26,7 @@ function0="1"
function1="0"
format="@name @pinlist @value m=@m"
spectre_format="@name ( @pinlist ) @model r=@value"
spectre_format="@name ( @pinlist ) resistor r=@value"
verilog_format="tran @name (@@P\\\\, @@M\\\\);"
tedax_format="footprint @name @footprint
@ -42,7 +42,7 @@ footprint=1206
device=resistor
m=1"
spectre_device_model="load \\"resistor.osdi\\"
model @model resistor"
model resistor resistor"
}
V {}
S {}

View File

@ -1,4 +1,4 @@
v {xschem version=3.4.5 file_version=1.2
v {xschem version=3.4.8RC file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
@ -23,9 +23,11 @@ G {}
K {type=vsource
format="@name @pinlist @value@savecurrent"
template="name=V1 value=3 savecurrent=false"
}
spectre_format="@name ( @pinlist ) vsource @value"
spectre_device_model="model vsource vsource"}
V {}
S {}
F {}
E {}
L 4 2.5 -22.5 7.5 -22.5 {}
L 4 5 -25 5 -20 {}