initial implementation of `has_included_subcircuit()`
This commit is contained in:
parent
f0e739cf02
commit
0f7785d588
22
src/token.c
22
src/token.c
|
|
@ -1812,6 +1812,21 @@ void print_tedax_subckt(FILE *fd, int symbol)
|
|||
}
|
||||
}
|
||||
|
||||
static int has_included_subcircuit(int symbol, char **result)
|
||||
{
|
||||
|
||||
char *spice_sym_def = NULL;
|
||||
int ret = 0;
|
||||
|
||||
my_strdup2(_ALLOC_ID_, &spice_sym_def, get_tok_value(xctx->sym[symbol].prop_ptr, "spice_sym_def", 0));
|
||||
if(xctx->tok_size) {
|
||||
tclvareval("has_included_subcircuit {", spice_sym_def, "}", NULL);
|
||||
my_mstrcat(_ALLOC_ID_, result, tclresult(), NULL);
|
||||
ret = 1;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &spice_sym_def);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void print_spice_subckt_nodes(FILE *fd, int symbol)
|
||||
{
|
||||
|
|
@ -2192,6 +2207,7 @@ int print_spice_element(FILE *fd, int inst)
|
|||
else if(strcmp(token,"@pinlist")==0) /* of course pinlist must not be present in attributes */
|
||||
/* print multiplicity */
|
||||
{ /* and node number: m1 n1 m2 n2 .... */
|
||||
if(1 || !has_included_subcircuit(xctx->inst[inst].ptr, &result)) {
|
||||
Int_hashtable table = {NULL, 0};
|
||||
int_hash_init(&table, 37);
|
||||
for(i=0;i<no_of_pins; ++i)
|
||||
|
|
@ -2212,6 +2228,7 @@ int print_spice_element(FILE *fd, int inst)
|
|||
}
|
||||
int_hash_free(&table);
|
||||
}
|
||||
}
|
||||
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
char *prop = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr;
|
||||
|
|
@ -2273,10 +2290,9 @@ int print_spice_element(FILE *fd, int inst)
|
|||
}
|
||||
my_free(_ALLOC_ID_, &tmpstr);
|
||||
}
|
||||
tmp=strlen(value);
|
||||
tmp=strlen(value) + 100;
|
||||
STR_ALLOC(&result, tmp + result_pos, &size);
|
||||
memcpy(result+result_pos, value, tmp+1);
|
||||
result_pos+=tmp;
|
||||
result_pos += my_snprintf(result + result_pos, tmp, "%s", value);
|
||||
my_free(_ALLOC_ID_, &pin_attr_value);
|
||||
}
|
||||
else if(n>=0 && n < (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]) {
|
||||
|
|
|
|||
|
|
@ -654,6 +654,13 @@ proc ev0 {args} {
|
|||
}
|
||||
}
|
||||
|
||||
proc has_included_subcircuit {spice_sym_def} {
|
||||
regsub -all {\n\+} $spice_sym_def { } spice_sym_def
|
||||
if {[regexp -nocase {^\.include } $spice_sym_def]} {
|
||||
set filename [lindex $spice_sym_def 1]
|
||||
}
|
||||
return "---- $filename ----"
|
||||
}
|
||||
|
||||
# should not be called directly by user
|
||||
# does netlist post processing, called from global_(spice|vhdl|verilog)_netlist()
|
||||
|
|
|
|||
Loading…
Reference in New Issue