fix status bar info correctly swicthing when focusing multiple xschem child windows; multiple schematic window handling within one xschem instance is now working

This commit is contained in:
Stefan Frederik 2021-11-17 01:12:55 +01:00
parent ad05513838
commit bd626427fd
15 changed files with 175 additions and 113 deletions

View File

@ -66,6 +66,7 @@ Options:
--netlist_filename <file> --netlist_filename <file>
-t --tedax Set netlist type to tEDAx. -t --tedax Set netlist type to tEDAx.
-s --spice Set netlist type to SPICE. -s --spice Set netlist type to SPICE.
-y --symbol Set netlist type to SYMBOL (used when drawing symbols)
-x --no_x Don't use X (only command mode). -x --no_x Don't use X (only command mode).
-z --rainbow Use a raibow-looking layer color table. -z --rainbow Use a raibow-looking layer color table.
-W --waves Show simulation waveforms. -W --waves Show simulation waveforms.

View File

@ -294,19 +294,19 @@ void new_window(const char *cell, int symbol)
/* child of child */ /* child of child */
if(!cell || !cell[0]) { if(!cell || !cell[0]) {
if(!symbol) if(!symbol)
execl(xschem_executable,xschem_executable,"-b", "--tcl", execl(xschem_executable,xschem_executable, "-b", "-s", "--tcl",
"set netlist_type spice; set XSCHEM_START_WINDOW {}", NULL); "set XSCHEM_START_WINDOW {}", NULL);
else else
execl(xschem_executable,xschem_executable,"-b", "--tcl", execl(xschem_executable,xschem_executable, "-b", "-y", "--tcl",
"set netlist_type symbol; set XSCHEM_START_WINDOW {}", NULL); "set XSCHEM_START_WINDOW {}", NULL);
} }
else if(!symbol) { else if(!symbol) {
my_strncpy(f, cell, S(f)); my_strncpy(f, cell, S(f));
execl(xschem_executable,xschem_executable,"-b", "--tcl", "set netlist_type spice", f, NULL); execl(xschem_executable,xschem_executable, "-b", "-s", f, NULL);
} }
else { else {
my_strncpy(f, cell, S(f)); my_strncpy(f, cell, S(f));
execl(xschem_executable,xschem_executable,"-b", "--tcl", "set netlist_type symbol", f, NULL); execl(xschem_executable,xschem_executable, "-b", "-y", f, NULL);
} }
} else { } else {
/* error */ /* error */

View File

@ -173,6 +173,14 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
} }
#endif #endif
Tcl_VarEval(interp, xctx->top_path, ".statusbar.7 configure -text $netlist_type", NULL);
Tcl_VarEval(interp, xctx->top_path, ".statusbar.3 delete 0 end;",
xctx->top_path, ".statusbar.3 insert 0 $cadsnap",
NULL);
Tcl_VarEval(interp, xctx->top_path, ".statusbar.5 delete 0 end;",
xctx->top_path, ".statusbar.5 insert 0 $cadgrid",
NULL);
#if 0 #if 0
/* exclude Motion and Expose events */ /* exclude Motion and Expose events */
if(event!=6 /* && event!=12 */) dbg(0, "callback(): event=%d, winpath=%s, old_winpath=%s, semaphore=%d\n", if(event!=6 /* && event!=12 */) dbg(0, "callback(): event=%d, winpath=%s, old_winpath=%s, semaphore=%d\n",
@ -773,7 +781,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(key=='V' && state == ShiftMask) /* toggle spice/vhdl netlist */ if(key=='V' && state == ShiftMask) /* toggle spice/vhdl netlist */
{ {
xctx->netlist_type++; if(xctx->netlist_type==6) xctx->netlist_type=1; xctx->netlist_type++; if(xctx->netlist_type==6) xctx->netlist_type=1;
override_netlist_type(-1); set_tcl_netlist_type();
break; break;
} }

View File

@ -178,7 +178,7 @@ char old_winpath[PATH_MAX] = ".drw";
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
/* Cmdline options (used at xinit, and then not used anymore) */ /* Cmdline options (used at xinit, and then not used anymore) */
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
int cli_opt_netlist_type = -1; int cli_opt_netlist_type = 0;
char cli_opt_plotfile[PATH_MAX] = ""; char cli_opt_plotfile[PATH_MAX] = "";

View File

@ -522,6 +522,16 @@ void wirecheck(int k) /* recursive routine */
} }
} }
void set_tcl_netlist_type(void)
{
if(xctx->netlist_type == CAD_SPICE_NETLIST) tclsetvar("netlist_type", "spice");
else if(xctx->netlist_type == CAD_VERILOG_NETLIST) tclsetvar("netlist_type", "verilog");
else if(xctx->netlist_type == CAD_VHDL_NETLIST) tclsetvar("netlist_type", "vhdl");
else if(xctx->netlist_type == CAD_TEDAX_NETLIST) tclsetvar("netlist_type", "tedax");
else if(xctx->netlist_type == CAD_SYMBOL_ATTRS) tclsetvar("netlist_type", "symbol");
else tclsetvar("netlist_type", "unknown");
}
/* what==0 -> initialize */ /* what==0 -> initialize */
/* what==1 -> get new node name, net## */ /* what==1 -> get new node name, net## */
/* what==2 -> update multiplicity */ /* what==2 -> update multiplicity */
@ -603,23 +613,6 @@ int record_global_node(int what, FILE *fp, char *node)
return 0; return 0;
} }
/* set xctx->netlist_type tcl var to specified format, if -1 is given restore to default */
void override_netlist_type(int type)
{
if (type == CAD_VHDL_NETLIST) tclsetvar("netlist_type","vhdl");
else if(type == CAD_VERILOG_NETLIST) tclsetvar("netlist_type","verilog");
else if(type == CAD_TEDAX_NETLIST) tclsetvar("netlist_type","tedax");
else if(type == CAD_SYMBOL_ATTRS) tclsetvar("netlist_type","symbol");
else if(type == CAD_SPICE_NETLIST) tclsetvar("netlist_type","spice");
else {
if (xctx->netlist_type == CAD_VHDL_NETLIST) tclsetvar("netlist_type","vhdl");
else if(xctx->netlist_type == CAD_VERILOG_NETLIST) tclsetvar("netlist_type","verilog");
else if(xctx->netlist_type == CAD_TEDAX_NETLIST) tclsetvar("netlist_type","tedax");
else if(xctx->netlist_type == CAD_SYMBOL_ATTRS) tclsetvar("netlist_type","symbol");
else if(xctx->netlist_type == CAD_SPICE_NETLIST) tclsetvar("netlist_type","spice");
}
}
void prepare_netlist_structs(int for_netlist) void prepare_netlist_structs(int for_netlist)
{ {
xRect *rct; xRect *rct;

View File

@ -112,6 +112,10 @@ void check_opt(char *opt, char *optval, int type)
dbg(1, "process_options(): set netlist type to spice\n"); dbg(1, "process_options(): set netlist type to spice\n");
cli_opt_netlist_type=CAD_SPICE_NETLIST; cli_opt_netlist_type=CAD_SPICE_NETLIST;
} else if( (type == SHORT && *opt == 'y') || (type == LONG && !strcmp("symbol", opt)) ) {
dbg(1, "process_options(): set netlist type to symbol\n");
cli_opt_netlist_type=CAD_SYMBOL_ATTRS;
} else if( (type == SHORT && *opt == 'V') || (type == LONG && !strcmp("vhdl", opt)) ) { } else if( (type == SHORT && *opt == 'V') || (type == LONG && !strcmp("vhdl", opt)) ) {
dbg(1, "process_options(): set netlist type to vhdl\n"); dbg(1, "process_options(): set netlist type to vhdl\n");
cli_opt_netlist_type=CAD_VHDL_NETLIST; cli_opt_netlist_type=CAD_VHDL_NETLIST;

View File

@ -1080,12 +1080,12 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2
if(!strcmp(tclresult(), "SYMBOL")) { if(!strcmp(tclresult(), "SYMBOL")) {
save_netlist_type = xctx->netlist_type; save_netlist_type = xctx->netlist_type;
xctx->netlist_type = CAD_SYMBOL_ATTRS; xctx->netlist_type = CAD_SYMBOL_ATTRS;
set_tcl_netlist_type();
loaded_symbol = 1; loaded_symbol = 1;
tclsetvar("netlist_type","symbol");
} else { } else {
if(loaded_symbol) { if(loaded_symbol) {
xctx->netlist_type = save_netlist_type; xctx->netlist_type = save_netlist_type;
override_netlist_type(-1); set_tcl_netlist_type();
} }
loaded_symbol = 0; loaded_symbol = 0;
} }

View File

@ -204,7 +204,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
clear_drawing(); clear_drawing();
if(argc>=3 && !strcmp(argv[2],"SYMBOL")) { if(argc>=3 && !strcmp(argv[2],"SYMBOL")) {
xctx->netlist_type = CAD_SYMBOL_ATTRS; xctx->netlist_type = CAD_SYMBOL_ATTRS;
tclsetvar("netlist_type","symbol"); set_tcl_netlist_type();
for(i=0;;i++) { for(i=0;;i++) {
if(i == 0) my_snprintf(name, S(name), "%s.sym", "untitled"); if(i == 0) my_snprintf(name, S(name), "%s.sym", "untitled");
else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i); else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i);
@ -214,7 +214,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_strncpy(xctx->current_name, name, S(xctx->current_name)); my_strncpy(xctx->current_name, name, S(xctx->current_name));
} else { } else {
xctx->netlist_type = CAD_SPICE_NETLIST; xctx->netlist_type = CAD_SPICE_NETLIST;
tclsetvar("netlist_type","spice"); set_tcl_netlist_type();
for(i=0;;i++) { for(i=0;;i++) {
if(i == 0) my_snprintf(name, S(name), "%s.sch", "untitled"); if(i == 0) my_snprintf(name, S(name), "%s.sch", "untitled");
else my_snprintf(name, S(name), "%s-%d.sch", "untitled", i); else my_snprintf(name, S(name), "%s-%d.sch", "untitled", i);
@ -477,12 +477,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* ********** xschem get subcommands * ********** xschem get subcommands
*/ */
if(!strcmp(argv[1],"get") && !strcmp(argv[2],"schname") && argc >= 3) if(argc >= 3 && !strcmp(argv[1],"get") && !strcmp(argv[2],"schname"))
{ {
/* allows to retrieve name of n-th parent schematic */ /* allows to retrieve name of n-th parent schematic */
int x; int x;
cmd_found = 1; cmd_found = 1;
if(argc == 4) x = atoi(argv[3]); if(argc >= 4) x = atoi(argv[3]);
else x = xctx->currsch; else x = xctx->currsch;
if(x<0 && xctx->currsch+x>=0) { if(x<0 && xctx->currsch+x>=0) {
Tcl_SetResult(interp, xctx->sch[xctx->currsch+x], TCL_VOLATILE); Tcl_SetResult(interp, xctx->sch[xctx->currsch+x], TCL_VOLATILE);
@ -490,7 +490,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, xctx->sch[x], TCL_VOLATILE); Tcl_SetResult(interp, xctx->sch[x], TCL_VOLATILE);
} }
} }
else if(!strcmp(argv[1],"get") && !strcmp(argv[2],"sch_path") && argc >= 3) else if( argc >= 3 && !strcmp(argv[1],"get") && !strcmp(argv[2],"sch_path"))
{ {
int x; int x;
cmd_found = 1; cmd_found = 1;
@ -593,6 +593,27 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[2],"netlist_name")) { else if(!strcmp(argv[2],"netlist_name")) {
Tcl_SetResult(interp, xctx->netlist_name, TCL_VOLATILE); Tcl_SetResult(interp, xctx->netlist_name, TCL_VOLATILE);
} }
else if(!strcmp(argv[2],"netlist_type"))
{
if(xctx->netlist_type == CAD_SPICE_NETLIST) {
Tcl_SetResult(interp, "spice", TCL_STATIC);
}
else if(xctx->netlist_type == CAD_VHDL_NETLIST) {
Tcl_SetResult(interp, "vhdl", TCL_STATIC);
}
else if(xctx->netlist_type == CAD_VERILOG_NETLIST) {
Tcl_SetResult(interp, "verilog", TCL_STATIC);
}
else if(xctx->netlist_type == CAD_TEDAX_NETLIST) {
Tcl_SetResult(interp, "tedax", TCL_STATIC);
}
else if(xctx->netlist_type == CAD_SYMBOL_ATTRS) {
Tcl_SetResult(interp, "symbol", TCL_STATIC);
}
else {
Tcl_SetResult(interp, "unknown", TCL_STATIC);
}
}
else if(!strcmp(argv[2],"no_draw")) { else if(!strcmp(argv[2],"no_draw")) {
if( xctx->no_draw != 0 ) if( xctx->no_draw != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC); Tcl_SetResult(interp, "1",TCL_STATIC);
@ -1469,29 +1490,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
} }
else if(!strcmp(argv[1],"netlist_type"))
{
cmd_found = 1;
if(argc > 2) {
if(!strcmp(argv[2],"vhdl")) {
xctx->netlist_type=CAD_VHDL_NETLIST;
}
else if(!strcmp(argv[2],"verilog")) {
xctx->netlist_type=CAD_VERILOG_NETLIST;
}
else if(!strcmp(argv[2],"tedax")) {
xctx->netlist_type=CAD_TEDAX_NETLIST;
}
else if(!strcmp(argv[2],"symbol")) {
xctx->netlist_type=CAD_SYMBOL_ATTRS;
}
else if(!strcmp(argv[2],"spice")){
xctx->netlist_type=CAD_SPICE_NETLIST;
}
override_netlist_type(-1); /* set tcl netlist_type variable */
}
}
else if(!strcmp(argv[1],"new_schematic")) else if(!strcmp(argv[1],"new_schematic"))
{ {
cmd_found = 1; cmd_found = 1;
@ -2127,6 +2125,34 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[2],"netlist_name")) { else if(!strcmp(argv[2],"netlist_name")) {
my_strncpy(xctx->netlist_name, argv[3], S(xctx->netlist_name)); my_strncpy(xctx->netlist_name, argv[3], S(xctx->netlist_name));
} }
else if(!strcmp(argv[2],"netlist_type"))
{
if(argc > 3) {
if(!strcmp(argv[3],"spice")){
xctx->netlist_type=CAD_SPICE_NETLIST;
tclsetvar("netlist_type", "spice");
}
else if(!strcmp(argv[3],"vhdl")) {
xctx->netlist_type=CAD_VHDL_NETLIST;
tclsetvar("netlist_type", "vhdl");
}
else if(!strcmp(argv[3],"verilog")) {
xctx->netlist_type=CAD_VERILOG_NETLIST;
tclsetvar("netlist_type", "verilog");
}
else if(!strcmp(argv[3],"tedax")) {
xctx->netlist_type=CAD_TEDAX_NETLIST;
tclsetvar("netlist_type", "tedax");
}
else if(!strcmp(argv[3],"symbol")) {
xctx->netlist_type=CAD_SYMBOL_ATTRS;
tclsetvar("netlist_type", "symbol");
}
else {
tclsetvar("netlist_type", "unknown");
}
}
}
else if(!strcmp(argv[2],"no_draw")) { else if(!strcmp(argv[2],"no_draw")) {
int s = atoi(argv[3]); int s = atoi(argv[3]);
xctx->no_draw=s; xctx->no_draw=s;

View File

@ -253,11 +253,16 @@ void global_spice_netlist(int global) /* netlister driver */
if(split_f) { if(split_f) {
int save;
fclose(fd); fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname); my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_SPICE_NETLIST); save = xctx->netlist_type;
xctx->netlist_type = CAD_SPICE_NETLIST;
set_tcl_netlist_type();
tcleval(tcl_cmd_netlist); tcleval(tcl_cmd_netlist);
override_netlist_type(-1); /* restore to xctx->netlist_type default */ xctx->netlist_type = save;
set_tcl_netlist_type();
if(debug_var==0) xunlink(netl_filename); if(debug_var==0) xunlink(netl_filename);
} }
@ -475,11 +480,15 @@ void spice_block_netlist(FILE *fd, int i)
} }
fprintf(fd, ".ends\n\n"); fprintf(fd, ".ends\n\n");
if(split_f) { if(split_f) {
int save;
fclose(fd); fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname); my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_SPICE_NETLIST); save = xctx->netlist_type;
xctx->netlist_type = CAD_SPICE_NETLIST;
set_tcl_netlist_type();
tcleval(tcl_cmd_netlist); tcleval(tcl_cmd_netlist);
override_netlist_type(-1); /* restore to xctx->netlist_type default */ xctx->netlist_type = save;
set_tcl_netlist_type();
if(debug_var==0) xunlink(netl_filename); if(debug_var==0) xunlink(netl_filename);
} }
} }

View File

@ -265,11 +265,15 @@ void global_verilog_netlist(int global) /* netlister driver */
fprintf(fd, "endmodule\n"); fprintf(fd, "endmodule\n");
if(split_f) { if(split_f) {
int save;
fclose(fd); fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname); my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_VERILOG_NETLIST); save = xctx->netlist_type;
xctx->netlist_type = CAD_VERILOG_NETLIST;
set_tcl_netlist_type();
tcleval(tcl_cmd_netlist); tcleval(tcl_cmd_netlist);
override_netlist_type(-1); /* restore to xctx->netlist_type default */ xctx->netlist_type = save;
set_tcl_netlist_type();
if(debug_var==0) xunlink(netl_filename); if(debug_var==0) xunlink(netl_filename);
} }
@ -496,11 +500,15 @@ void verilog_block_netlist(FILE *fd, int i)
fprintf(fd,"---- end user architecture code\n"); fprintf(fd,"---- end user architecture code\n");
fprintf(fd, "endmodule\n"); fprintf(fd, "endmodule\n");
if(split_f) { if(split_f) {
int save;
fclose(fd); fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname); my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_VERILOG_NETLIST); save = xctx->netlist_type;
xctx->netlist_type = CAD_VERILOG_NETLIST;
set_tcl_netlist_type();
tcleval(tcl_cmd_netlist); tcleval(tcl_cmd_netlist);
override_netlist_type(-1); /* restore to xctx->netlist_type default */ xctx->netlist_type = save;
set_tcl_netlist_type();
if(debug_var==0) xunlink(netl_filename); if(debug_var==0) xunlink(netl_filename);
} }
my_free(1079, &dir_tmp); my_free(1079, &dir_tmp);

View File

@ -319,11 +319,15 @@ void global_vhdl_netlist(int global) /* netlister driver */
fprintf(fd, "end arch_%s ;\n\n", skip_dir( xctx->sch[xctx->currsch]) ); fprintf(fd, "end arch_%s ;\n\n", skip_dir( xctx->sch[xctx->currsch]) );
if(split_f) { if(split_f) {
int save;
fclose(fd); fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname); my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_VHDL_NETLIST); save = xctx->netlist_type;
xctx->netlist_type = CAD_VHDL_NETLIST;
set_tcl_netlist_type();
tcleval(tcl_cmd_netlist); tcleval(tcl_cmd_netlist);
override_netlist_type(-1); /* restore to netlist_dir default */ xctx->netlist_type = save;
set_tcl_netlist_type();
if(debug_var==0) xunlink(netl_filename); if(debug_var==0) xunlink(netl_filename);
} }
xctx->netlist_count++; xctx->netlist_count++;
@ -611,11 +615,15 @@ void vhdl_block_netlist(FILE *fd, int i)
if(xctx->schvhdlprop && xctx->schvhdlprop[0]) fprintf(fd, "%s\n", xctx->schvhdlprop); if(xctx->schvhdlprop && xctx->schvhdlprop[0]) fprintf(fd, "%s\n", xctx->schvhdlprop);
fprintf(fd, "end arch_%s ;\n\n", skip_dir(xctx->sym[i].name) ); /* skip_dir( xctx->sch[xctx->currsch]) ); */ fprintf(fd, "end arch_%s ;\n\n", skip_dir(xctx->sym[i].name) ); /* skip_dir( xctx->sch[xctx->currsch]) ); */
if(split_f) { if(split_f) {
int save;
fclose(fd); fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname); my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_VHDL_NETLIST); save = xctx->netlist_type;
xctx->netlist_type = CAD_VHDL_NETLIST;
set_tcl_netlist_type();
tcleval(tcl_cmd_netlist); tcleval(tcl_cmd_netlist);
override_netlist_type(-1); /* restore to netlist_dir default */ xctx->netlist_type = save;
set_tcl_netlist_type();
if(debug_var==0) xunlink(netl_filename); if(debug_var==0) xunlink(netl_filename);
} }
xctx->netlist_count++; xctx->netlist_count++;

View File

@ -389,19 +389,6 @@ void free_gc()
} }
} }
void get_netlist_type_from_tcl(void)
{
if(xctx->netlist_type==-1) {
if(!strcmp(tclgetvar("netlist_type"),"vhdl") ) xctx->netlist_type=CAD_VHDL_NETLIST;
else if(!strcmp(tclgetvar("netlist_type"),"verilog") ) xctx->netlist_type=CAD_VERILOG_NETLIST;
else if(!strcmp(tclgetvar("netlist_type"),"tedax") ) xctx->netlist_type=CAD_TEDAX_NETLIST;
else if(!strcmp(tclgetvar("netlist_type"),"symbol") ) xctx->netlist_type=CAD_SYMBOL_ATTRS;
else xctx->netlist_type=CAD_SPICE_NETLIST;
} else {
override_netlist_type(-1); /* set tcl netlist_type */
}
}
void alloc_xschem_data(const char *top_path) void alloc_xschem_data(const char *top_path)
{ {
int i, j; int i, j;
@ -572,7 +559,7 @@ void alloc_xschem_data(const char *top_path)
xctx->n_active_layers = 0; xctx->n_active_layers = 0;
xctx->active_layer=my_calloc(563, cadlayers, sizeof(int)); xctx->active_layer=my_calloc(563, cadlayers, sizeof(int));
xctx->hide_symbols = 0; xctx->hide_symbols = 0;
xctx->netlist_type = -1; xctx->netlist_type = CAD_SPICE_NETLIST;
xctx->top_path = NULL; xctx->top_path = NULL;
my_strdup2(1296, &xctx->top_path, top_path); my_strdup2(1296, &xctx->top_path, top_path);
xctx->fill_type=my_calloc(640, cadlayers, sizeof(int)); xctx->fill_type=my_calloc(640, cadlayers, sizeof(int));
@ -804,7 +791,6 @@ void preview_window(const char *what, const char *tk_win_path, const char *filen
my_strdup(117, &current_file, filename); my_strdup(117, &current_file, filename);
xctx = NULL; /* reset for preview */ xctx = NULL; /* reset for preview */
alloc_xschem_data(""); /* alloc data into xctx */ alloc_xschem_data(""); /* alloc data into xctx */
get_netlist_type_from_tcl();
init_pixdata(); /* populate xctx->fill_type array that is used in create_gc() to set fill styles */ init_pixdata(); /* populate xctx->fill_type array that is used in create_gc() to set fill styles */
preview_xctx = xctx; preview_xctx = xctx;
preview_xctx->window = pre_window; preview_xctx->window = pre_window;
@ -1479,10 +1465,18 @@ int Tcl_AppInit(Tcl_Interp *inter)
xctx->draw_window=atoi(tclgetvar("draw_window")); xctx->draw_window=atoi(tclgetvar("draw_window"));
/* set global variables fetching data from tcl code */ /* set global variables fetching data from tcl code */
if(cli_opt_netlist_type) {
xctx->netlist_type = cli_opt_netlist_type; xctx->netlist_type = cli_opt_netlist_type;
set_tcl_netlist_type();
get_netlist_type_from_tcl(); } else {
const char *n;
n = tclgetvar("netlist_type");
if(!strcmp(n, "spice")) xctx->netlist_type = CAD_SPICE_NETLIST;
else if(!strcmp(n, "vhdl")) xctx->netlist_type = CAD_VHDL_NETLIST;
else if(!strcmp(n, "verilog")) xctx->netlist_type = CAD_VERILOG_NETLIST;
else if(!strcmp(n, "tedax")) xctx->netlist_type = CAD_TEDAX_NETLIST;
else if(!strcmp(n, "symbol")) xctx->netlist_type = CAD_SYMBOL_ATTRS;
}
init_pixdata();/* populate xctx->fill_type array that is used in create_gc() to set fill styles */ init_pixdata();/* populate xctx->fill_type array that is used in create_gc() to set fill styles */
init_color_array(0.0, 0.0); init_color_array(0.0, 0.0);
my_snprintf(tmp, S(tmp), "%d",debug_var); my_snprintf(tmp, S(tmp), "%d",debug_var);

View File

@ -1139,7 +1139,7 @@ extern void select_connected_wires(int stop_at_junction);
extern void draw_hilight_net(int on_window); extern void draw_hilight_net(int on_window);
extern void display_hilights(char **str); extern void display_hilights(char **str);
extern void redraw_hilights(int clear); extern void redraw_hilights(int clear);
extern void override_netlist_type(int type); extern void set_tcl_netlist_type(void);
extern void prepare_netlist_structs(int for_netlist); extern void prepare_netlist_structs(int for_netlist);
extern void create_simdata(void); extern void create_simdata(void);
extern void free_simdata(void); extern void free_simdata(void);

View File

@ -20,6 +20,7 @@ Options:
-N <file> Set name (only name, not path) of top level netlist file. -N <file> Set name (only name, not path) of top level netlist file.
-t --tedax Set netlist type to tEDAx. -t --tedax Set netlist type to tEDAx.
-s --spice Set netlist type to SPICE. -s --spice Set netlist type to SPICE.
-y --symbol Set netlist type to SYMBOL (used when drawing symbols)
-x --no_x Don't use X (only command mode). -x --no_x Don't use X (only command mode).
-z --rainbow Use a raibow-looking layer color table. -z --rainbow Use a raibow-looking layer color table.
-W --waves Show simulation waveforms. -W --waves Show simulation waveforms.

View File

@ -131,9 +131,10 @@ proc execute {status args} {
proc netlist {source_file show netlist_file} { proc netlist {source_file show netlist_file} {
global XSCHEM_SHAREDIR flat_netlist hspice_netlist netlist_dir global XSCHEM_SHAREDIR flat_netlist hspice_netlist netlist_dir
global verilog_2001 netlist_type debug_var global verilog_2001 debug_var
simuldir simuldir
set netlist_type [xschem get netlist_type]
if {$debug_var <= -1} { puts "netlist: source_file=$source_file, netlist_type=$netlist_type" } if {$debug_var <= -1} { puts "netlist: source_file=$source_file, netlist_type=$netlist_type" }
if {$netlist_type eq {spice}} { if {$netlist_type eq {spice}} {
if { $hspice_netlist == 1 } { if { $hspice_netlist == 1 } {
@ -309,11 +310,11 @@ proc edit_file {filename} {
## ##
## Other global vars: ## Other global vars:
## netlist_dir ## netlist_dir
## netlist_type
## computerfarm ## computerfarm
## terminal ## terminal
## netlist_type can be obtained with [xschem get netlist_type]
proc save_sim_defaults {f} { proc save_sim_defaults {f} {
global sim netlist_dir netlist_type computerfarm terminal global sim netlist_dir computerfarm terminal
set a [catch {open $f w} fd] set a [catch {open $f w} fd]
if { $a } { if { $a } {
@ -877,11 +878,12 @@ proc simulate {{callback {}}} {
## $S : schematic name full path (/home/schippes/.xschem/xschem_library/opamp.sch) ## $S : schematic name full path (/home/schippes/.xschem/xschem_library/opamp.sch)
## $d : netlist directory ## $d : netlist directory
global netlist_dir netlist_type computerfarm terminal sim global netlist_dir computerfarm terminal sim
global execute_callback XSCHEM_SHAREDIR has_x OS global execute_callback XSCHEM_SHAREDIR has_x OS
simuldir simuldir
set_sim_defaults set_sim_defaults
set netlist_type [xschem get netlist_type]
if { [select_netlist_dir 0] ne {}} { if { [select_netlist_dir 0] ne {}} {
set d ${netlist_dir} set d ${netlist_dir}
set tool $netlist_type set tool $netlist_type
@ -1001,10 +1003,11 @@ proc waves {} {
## $S : schematic name full path (/home/schippes/.xschem/xschem_library/opamp.sch) ## $S : schematic name full path (/home/schippes/.xschem/xschem_library/opamp.sch)
## $d : netlist directory ## $d : netlist directory
global netlist_dir netlist_type computerfarm terminal sim XSCHEM_SHAREDIR has_x global netlist_dir computerfarm terminal sim XSCHEM_SHAREDIR has_x
global bespice_listen_port env global bespice_listen_port env
simuldir simuldir
set netlist_type [xschem get netlist_type]
set_sim_defaults set_sim_defaults
if { [select_netlist_dir 0] ne {}} { if { [select_netlist_dir 0] ne {}} {
set d ${netlist_dir} set d ${netlist_dir}
@ -1038,7 +1041,7 @@ proc waves {} {
# ============================================================ # ============================================================
proc utile_translate {schname} { proc utile_translate {schname} {
global netlist_dir netlist_type debug_var XSCHEM_SHAREDIR global netlist_dir debug_var XSCHEM_SHAREDIR
global utile_gui_path utile_cmd_path global utile_gui_path utile_cmd_path
simuldir simuldir
@ -1048,7 +1051,7 @@ proc utile_translate {schname} {
} }
proc utile_gui {schname} { proc utile_gui {schname} {
global netlist_dir netlist_type debug_var XSCHEM_SHAREDIR global netlist_dir debug_var XSCHEM_SHAREDIR
global utile_gui_path utile_cmd_path global utile_gui_path utile_cmd_path
simuldir simuldir
@ -1058,7 +1061,7 @@ proc utile_gui {schname} {
} }
proc utile_edit {schname} { proc utile_edit {schname} {
global netlist_dir netlist_type debug_var editor XSCHEM_SHAREDIR global netlist_dir debug_var editor XSCHEM_SHAREDIR
global utile_gui_path utile_cmd_path global utile_gui_path utile_cmd_path
simuldir simuldir
@ -1068,7 +1071,7 @@ proc utile_edit {schname} {
} }
proc get_shell { curpath } { proc get_shell { curpath } {
global netlist_dir netlist_type debug_var global netlist_dir debug_var
global terminal global terminal
simuldir simuldir
@ -1076,10 +1079,11 @@ proc get_shell { curpath } {
} }
proc edit_netlist {schname } { proc edit_netlist {schname } {
global netlist_dir netlist_type debug_var global netlist_dir debug_var
global editor terminal OS global editor terminal OS
simuldir simuldir
set netlist_type [xschem get netlist_type]
set tmpname [file rootname "$schname"] set tmpname [file rootname "$schname"]
if { [regexp vim $editor] } { set ftype "-c \":set filetype=$netlist_type\"" } else { set ftype {} } if { [regexp vim $editor] } { set ftype "-c \":set filetype=$netlist_type\"" } else { set ftype {} }
@ -2176,7 +2180,9 @@ proc tclpropeval {s instname symname} {
# this hook is called in translate() if whole string is contained in a tcleval(...) construct # this hook is called in translate() if whole string is contained in a tcleval(...) construct
proc tclpropeval2 {s} { proc tclpropeval2 {s} {
global debug_var env netlist_type path global debug_var env path
set netlist_type [xschem get netlist_type]
# puts "tclpropeval2: s=|$s|" # puts "tclpropeval2: s=|$s|"
if {$debug_var <=-1} {puts "tclpropeval2: $s"} if {$debug_var <=-1} {puts "tclpropeval2: $s"}
set path [string range [xschem get sch_path] 1 end] set path [string range [xschem get sch_path] 1 end]
@ -2296,9 +2302,10 @@ proc ask_save { {ask {save file?}} } {
proc edit_vi_prop {txtlabel} { proc edit_vi_prop {txtlabel} {
global XSCHEM_TMP_DIR retval symbol prev_symbol rcode debug_var netlist_type editor global XSCHEM_TMP_DIR retval symbol prev_symbol rcode debug_var editor
global user_wants_copy_cell global user_wants_copy_cell
set netlist_dir [xschem get netlist_type]
set user_wants_copy_cell 0 set user_wants_copy_cell 0
set rcode {} set rcode {}
set filename .xschem_edit_file.[pid] set filename .xschem_edit_file.[pid]
@ -2324,9 +2331,10 @@ proc edit_vi_prop {txtlabel} {
} }
proc edit_vi_netlist_prop {txtlabel} { proc edit_vi_netlist_prop {txtlabel} {
global XSCHEM_TMP_DIR retval rcode debug_var netlist_type editor global XSCHEM_TMP_DIR retval rcode debug_var editor
global user_wants_copy_cell global user_wants_copy_cell
set netlist_type [xschem get netlist_type]
set user_wants_copy_cell 0 set user_wants_copy_cell 0
set filename .xschem_edit_file.[pid] set filename .xschem_edit_file.[pid]
if ![string compare $netlist_type "vhdl"] { set suffix vhd } else { set suffix v } if ![string compare $netlist_type "vhdl"] { set suffix vhd } else { set suffix v }
@ -3543,8 +3551,8 @@ set tctx::global_list {
incr_hilight infowindow_text INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR incr_hilight infowindow_text INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR
input_line_cmd input_line_data launcher_default_program light_colors line_width local_netlist_dir input_line_cmd input_line_data launcher_default_program light_colors line_width local_netlist_dir
myload_d myload_default_geometry myload_dir1 myload_dir2 myload_dirs2 myload_files1 myload_files2 myload_index1 myload_d myload_default_geometry myload_dir1 myload_dir2 myload_dirs2 myload_files1 myload_files2 myload_index1
myload_retval myload_sash_pos myload_sel myload_type myload_yview netlist_dir netlist_show netlist_type myload_retval myload_sash_pos myload_sel myload_type myload_yview netlist_dir netlist_show
no_change_attrs noprint_libs old_selected_tok netlist_type no_change_attrs noprint_libs old_selected_tok
only_probes path pathlist persistent_command preserve_unchanged_attrs prev_symbol ps_colors rainbow_colors only_probes path pathlist persistent_command preserve_unchanged_attrs prev_symbol ps_colors rainbow_colors
rcode recentfile replace_key retval retval_orig rotated_text search_exact search_found search_select rcode recentfile replace_key retval retval_orig rotated_text search_exact search_found search_select
search_value selected_tok show_infowindow show_pin_net_names simconf_default_geometry simconf_vpos search_value selected_tok show_infowindow show_pin_net_names simconf_default_geometry simconf_vpos
@ -3715,7 +3723,7 @@ proc build_widgets { {topwin {} } } {
global draw_grid big_grid_points sym_txt change_lw incr_hilight symbol_width global draw_grid big_grid_points sym_txt change_lw incr_hilight symbol_width
global cadgrid draw_window show_pin_net_names toolbar_visible hide_symbols global cadgrid draw_window show_pin_net_names toolbar_visible hide_symbols
global disable_unique_names persistent_command autotrim_wires en_hilight_conn_inst global disable_unique_names persistent_command autotrim_wires en_hilight_conn_inst
global local_netlist_dir editor netlist_dir spiceprefix initial_geometry simulate_bg global local_netlist_dir editor netlist_type netlist_dir spiceprefix initial_geometry simulate_bg
frame $topwin.menubar -relief raised -bd 2 frame $topwin.menubar -relief raised -bd 2
toolbar_toolbar $topwin toolbar_toolbar $topwin
menubutton $topwin.menubar.file -text "File" -menu $topwin.menubar.file.menu -padx 3 -pady 0 menubutton $topwin.menubar.file -text "File" -menu $topwin.menubar.file.menu -padx 3 -pady 0
@ -3859,19 +3867,19 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.option.menu add separator $topwin.menubar.option.menu add separator
$topwin.menubar.option.menu add radiobutton -label "Spice netlist" -variable netlist_type -value spice \ $topwin.menubar.option.menu add radiobutton -label "Spice netlist" -variable netlist_type -value spice \
-accelerator {Shift+V} \ -accelerator {Shift+V} \
-command "xschem netlist_type spice" -command "xschem set netlist_type spice"
$topwin.menubar.option.menu add radiobutton -label "VHDL netlist" -variable netlist_type -value vhdl \ $topwin.menubar.option.menu add radiobutton -label "VHDL netlist" -variable netlist_type -value vhdl \
-accelerator {Shift+V} \ -accelerator {Shift+V} \
-command "xschem netlist_type vhdl" -command "xschem set netlist_type vhdl"
$topwin.menubar.option.menu add radiobutton -label "Verilog netlist" -variable netlist_type -value verilog \ $topwin.menubar.option.menu add radiobutton -label "Verilog netlist" -variable netlist_type -value verilog \
-accelerator {Shift+V} \ -accelerator {Shift+V} \
-command "xschem netlist_type verilog" -command "xschem set netlist_type verilog"
$topwin.menubar.option.menu add radiobutton -label "tEDAx netlist" -variable netlist_type -value tedax \ $topwin.menubar.option.menu add radiobutton -label "tEDAx netlist" -variable netlist_type -value tedax \
-accelerator {Shift+V} \ -accelerator {Shift+V} \
-command "xschem netlist_type tedax" -command "xschem set netlist_type tedax"
$topwin.menubar.option.menu add radiobutton -label "Symbol global attrs" -variable netlist_type -value symbol \ $topwin.menubar.option.menu add radiobutton -label "Symbol global attrs" -variable netlist_type -value symbol \
-accelerator {Shift+V} \ -accelerator {Shift+V} \
-command "xschem netlist_type symbol" -command "xschem set netlist_type symbol"
$topwin.menubar.edit.menu add command -label "Undo" -command "xschem undo; xschem redraw" -accelerator U $topwin.menubar.edit.menu add command -label "Undo" -command "xschem undo; xschem redraw" -accelerator U
toolbar_create EditUndo "xschem undo; xschem redraw" "Undo" $topwin toolbar_create EditUndo "xschem undo; xschem redraw" "Undo" $topwin
$topwin.menubar.edit.menu add command -label "Redo" -command "xschem redo; xschem redraw" -accelerator {Shift+U} $topwin.menubar.edit.menu add command -label "Redo" -command "xschem redo; xschem redraw" -accelerator {Shift+U}
@ -4166,14 +4174,14 @@ proc build_widgets { {topwin {} } } {
frame $topwin.statusbar frame $topwin.statusbar
label $topwin.statusbar.1 -text "STATUS BAR 1" label $topwin.statusbar.1 -text "STATUS BAR 1"
label $topwin.statusbar.2 -text "SNAP:" label $topwin.statusbar.2 -text "SNAP:"
entry $topwin.statusbar.3 -textvariable cadsnap -relief sunken -bg white \ entry $topwin.statusbar.3 -relief sunken -bg white \
-width 10 -foreground black -takefocus 0 -width 10 -foreground black -takefocus 0
label $topwin.statusbar.4 -text "GRID:" label $topwin.statusbar.4 -text "GRID:"
entry $topwin.statusbar.5 -textvariable cadgrid -relief sunken -bg white \ entry $topwin.statusbar.5 -relief sunken -bg white \
-width 10 -foreground black -takefocus 0 -width 10 -foreground black -takefocus 0
label $topwin.statusbar.6 -text "NETLIST MODE:" label $topwin.statusbar.6 -text "NETLIST MODE:"
entry $topwin.statusbar.7 -textvariable netlist_type -relief sunken -bg white \ label $topwin.statusbar.7 -relief sunken -bg white \
-width 8 -state disabled -disabledforeground black -width 8
label $topwin.statusbar.8 -activebackground red -text {} label $topwin.statusbar.8 -activebackground red -text {}
} }
@ -4364,6 +4372,9 @@ set_ne globfilter {*}
## list of tcl procedures to load at end of xschem.tcl ## list of tcl procedures to load at end of xschem.tcl
set_ne tcl_files {} set_ne tcl_files {}
set_ne netlist_dir "$USER_CONF_DIR/simulations" set_ne netlist_dir "$USER_CONF_DIR/simulations"
# this global exists only for netlist_type radiobuttons, don't use, use [xschem] subcommand to get/set values
# it is also used in xschemrc to set initial netlist type.
set_ne netlist_type spice
set_ne local_netlist_dir 0 ;# if set use <sch_dir>/simulation for netlist and sims set_ne local_netlist_dir 0 ;# if set use <sch_dir>/simulation for netlist and sims
set_ne bus_replacement_char {} ;# use {<>} to replace [] with <> in bussed signals set_ne bus_replacement_char {} ;# use {<>} to replace [] with <> in bussed signals
set_ne hspice_netlist 1 set_ne hspice_netlist 1
@ -4372,7 +4383,6 @@ set_ne spiceprefix 1
set_ne verilog_2001 1 set_ne verilog_2001 1
set_ne split_files 0 set_ne split_files 0
set_ne flat_netlist 0 set_ne flat_netlist 0
set_ne netlist_type spice
set_ne netlist_show 0 set_ne netlist_show 0
set_ne color_ps 1 set_ne color_ps 1
set_ne transparent_svg 0 set_ne transparent_svg 0