do a tcl evaluation of the "schematic" attribute of a symbol if the attribute is within a tcleval(...) expression. This way tcl variables/expressions can be used to determine the schematic to descend into when traversing/netlisting. example: schematic=tcleval(poweramp_${::mode}.sch).
This commit is contained in:
parent
242523cb9f
commit
9cdfad3abb
|
|
@ -923,6 +923,7 @@ void symbol_in_new_window(void)
|
|||
|
||||
void schematic_in_new_window(void)
|
||||
{
|
||||
char *sch = NULL;
|
||||
char filename[PATH_MAX];
|
||||
rebuild_selected_array();
|
||||
if(xctx->lastsel !=1 || xctx->sel_array[0].type!=ELEMENT)
|
||||
|
|
@ -945,9 +946,11 @@ void schematic_in_new_window(void)
|
|||
)
|
||||
) return;
|
||||
|
||||
my_strncpy(filename, abs_sym_path(get_tok_value(
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
, S(filename));
|
||||
my_strdup2(1246, &sch, get_tok_value(
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ));
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1247, &sch);
|
||||
if(!filename[0]) {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
|
|
@ -992,6 +995,7 @@ void launcher(void)
|
|||
void descend_schematic(int instnumber)
|
||||
{
|
||||
const char *str;
|
||||
char *sch = NULL;
|
||||
char filename[PATH_MAX];
|
||||
int inst_mult, inst_number;
|
||||
int save_ok = 0;
|
||||
|
|
@ -1088,10 +1092,11 @@ void descend_schematic(int instnumber)
|
|||
xctx->currsch++;
|
||||
hilight_child_pins();
|
||||
|
||||
my_strncpy(filename, abs_sym_path(get_tok_value(
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
, S(filename));
|
||||
|
||||
my_strdup2(1244, &sch,
|
||||
get_tok_value((xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ));
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1245, &sch);
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
if(filename[0]) {
|
||||
|
|
|
|||
|
|
@ -1065,12 +1065,17 @@ int sym_vs_sch_pins()
|
|||
int endfile;
|
||||
char tag[1];
|
||||
char filename[PATH_MAX];
|
||||
char *sch = NULL;
|
||||
n_syms = xctx->symbols;
|
||||
for(i=0;i<n_syms;i++)
|
||||
{
|
||||
if( xctx->sym[i].type && !strcmp(xctx->sym[i].type,"subcircuit")) {
|
||||
rects = xctx->sym[i].rects[PINLAYER];
|
||||
my_strncpy(filename, abs_sym_path(get_tok_value(xctx->sym[i].prop_ptr, "schematic", 0), "") , S(filename));
|
||||
|
||||
my_strdup2(1248, &sch, get_tok_value(xctx->sym[i].prop_ptr, "schematic", 0));
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1249, &sch);
|
||||
if(!filename[0]) {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2200,6 +2200,7 @@ void create_sch_from_sym(void)
|
|||
char *sub2_prop=NULL;
|
||||
char *str=NULL;
|
||||
struct stat buf;
|
||||
char *sch = NULL;
|
||||
int ln;
|
||||
|
||||
if(!stat(abs_sym_path(pinname[0], ""), &buf)) {
|
||||
|
|
@ -2213,9 +2214,11 @@ void create_sch_from_sym(void)
|
|||
if(xctx->lastsel > 1) return;
|
||||
if(xctx->lastsel==1 && xctx->sel_array[0].type==ELEMENT)
|
||||
{
|
||||
my_strncpy(schname, abs_sym_path(get_tok_value(
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
, S(schname));
|
||||
my_strdup2(1250, &sch,
|
||||
get_tok_value((xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ));
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(schname, abs_sym_path(sch, ""), S(schname));
|
||||
my_free(1251, &sch);
|
||||
if(!schname[0]) {
|
||||
my_strncpy(schname, add_ext(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), ".sch"), S(schname));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ void hier_psprint(void) /* netlister driver */
|
|||
char filename[PATH_MAX];
|
||||
char *abs_path = NULL;
|
||||
const char *str_tmp;
|
||||
char *sch = NULL;
|
||||
|
||||
if(!ps_draw(1)) return; /* prolog */
|
||||
if(xctx->modified) {
|
||||
|
|
@ -72,7 +73,10 @@ void hier_psprint(void) /* netlister driver */
|
|||
else
|
||||
spice_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
my_strdup2(1252, &sch, str_tmp);
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1253, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
|
|
@ -389,13 +393,17 @@ void spice_block_netlist(FILE *fd, int i)
|
|||
/* int j; */
|
||||
/* int multip; */
|
||||
char *extra=NULL;
|
||||
char *sch = NULL;
|
||||
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"spice_stop",0),"true") )
|
||||
spice_stop=1;
|
||||
else
|
||||
spice_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
my_strdup2(1254, &sch, str_tmp);
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1255, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,12 +154,17 @@ void tedax_block_netlist(FILE *fd, int i)
|
|||
char filename[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
char *extra=NULL;
|
||||
char *sch = NULL;
|
||||
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"tedax_stop",0),"true") )
|
||||
tedax_stop=1;
|
||||
else
|
||||
tedax_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
my_strdup2(1256, &sch, str_tmp);
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1257, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2752,6 +2752,7 @@ const char *translate(int inst, const char* s)
|
|||
const char *value;
|
||||
int escape=0;
|
||||
char date[200];
|
||||
char *sch = NULL;
|
||||
|
||||
if(!s) {
|
||||
my_free(1063, &result);
|
||||
|
|
@ -2920,9 +2921,10 @@ const char *translate(int inst, const char* s)
|
|||
my_free(1066, &pin_num_or_name);
|
||||
} else if(strcmp(token,"@sch_last_modified")==0) {
|
||||
|
||||
my_strncpy(file_name, abs_sym_path(get_tok_value(
|
||||
(xctx->inst[inst].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
, S(file_name));
|
||||
my_strdup2(1258, &sch, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr, "schematic",0 ));
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(file_name, abs_sym_path(sch, ""), S(file_name));
|
||||
my_free(1259, &sch);
|
||||
if(!file_name[0]) {
|
||||
my_strncpy(file_name, add_ext(abs_sym_path(xctx->inst[inst].name, ""), ".sch"), S(file_name));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,13 +365,17 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
char tcl_cmd_netlist[PATH_MAX + 100];
|
||||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
char *sch = NULL;
|
||||
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"verilog_stop",0),"true") )
|
||||
verilog_stop=1;
|
||||
else
|
||||
verilog_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
my_strdup2(1260, &sch, str_tmp);
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1261, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -419,13 +419,17 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
char *abs_path = NULL;
|
||||
char *sch = NULL;
|
||||
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"vhdl_stop",0),"true") )
|
||||
vhdl_stop=1;
|
||||
else
|
||||
vhdl_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
my_strdup2(1262, &sch, str_tmp);
|
||||
tcl_hook(&sch);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1263, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,34 @@
|
|||
v {xschem version=2.9.9 file_version=1.2}
|
||||
v {xschem version=2.9.9 file_version=1.2 }
|
||||
G {}
|
||||
K {type=subcircuit
|
||||
format="@name @pinlist @symname"
|
||||
template="name=x1"
|
||||
net_name=true
|
||||
}
|
||||
|
||||
T {@symname} -85.5 -6 0 0 0.3 0.3 {}
|
||||
T {@name} 135 -62 0 0 0.2 0.2 {}
|
||||
V {}
|
||||
S {}
|
||||
E {}
|
||||
L 4 -130 -50 130 -50 {}
|
||||
L 4 -130 50 130 50 {}
|
||||
L 4 -130 -50 -130 50 {}
|
||||
L 4 130 -50 130 50 {}
|
||||
B 5 -152.5 -42.5 -147.5 -37.5 {name=MINUS dir=in }
|
||||
L 4 -150 -40 -130 -40 {}
|
||||
T {MINUS} -125 -44 0 0 0.2 0.2 {}
|
||||
B 5 -152.5 -22.5 -147.5 -17.5 {name=PLUS dir=in }
|
||||
L 4 -150 -20 -130 -20 {}
|
||||
T {PLUS} -125 -24 0 0 0.2 0.2 {}
|
||||
B 5 -152.5 -2.5 -147.5 2.5 {name=VSS dir=in }
|
||||
L 4 -150 0 -130 0 {}
|
||||
T {VSS} -125 -4 0 0 0.2 0.2 {}
|
||||
B 5 147.5 -42.5 152.5 -37.5 {name=OUT dir=out }
|
||||
L 4 130 -40 150 -40 {}
|
||||
T {OUT} 125 -44 0 1 0.2 0.2 {}
|
||||
B 5 -152.5 17.5 -147.5 22.5 {name=VPP dir=in }
|
||||
L 4 -150 20 -130 20 {}
|
||||
T {VPP} -125 16 0 0 0.2 0.2 {}
|
||||
B 5 -152.5 37.5 -147.5 42.5 {name=VNN dir=in }
|
||||
L 4 -150 40 -130 40 {}
|
||||
B 5 -152.5 -42.5 -147.5 -37.5 {name=MINUS dir=in }
|
||||
B 5 -152.5 -22.5 -147.5 -17.5 {name=PLUS dir=in }
|
||||
B 5 -152.5 -2.5 -147.5 2.5 {name=VSS dir=in }
|
||||
B 5 147.5 -42.5 152.5 -37.5 {name=OUT dir=out }
|
||||
B 5 -152.5 17.5 -147.5 22.5 {name=VPP dir=in }
|
||||
B 5 -152.5 37.5 -147.5 42.5 {name=VNN dir=in }
|
||||
T {@symname} -85.5 -6 0 0 0.3 0.3 {}
|
||||
T {@name} 135 -62 0 0 0.2 0.2 {}
|
||||
T {MINUS} -125 -44 0 0 0.2 0.2 {}
|
||||
T {PLUS} -125 -24 0 0 0.2 0.2 {}
|
||||
T {VSS} -125 -4 0 0 0.2 0.2 {}
|
||||
T {OUT} 125 -44 0 1 0.2 0.2 {}
|
||||
T {VPP} -125 16 0 0 0.2 0.2 {}
|
||||
T {VNN} -125 36 0 0 0.2 0.2 {}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
v {xschem version=2.9.7 file_version=1.2}
|
||||
G {type=subcircuit
|
||||
v {xschem version=2.9.9 file_version=1.2 }
|
||||
G {}
|
||||
K {type=subcircuit
|
||||
format="@name @pinlist @symname"
|
||||
verilog_stop=true
|
||||
template="name=x1"
|
||||
|
||||
}
|
||||
template="name=x1"}
|
||||
V {}
|
||||
S {}
|
||||
E {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue