allow to change tcl flag `lvs_netlist` at runtime (just before netlist generation) , not only at xschem startup
This commit is contained in:
parent
28aca824ed
commit
d19ad57ee1
|
|
@ -615,8 +615,14 @@ void netlist_options(int i)
|
|||
str = get_tok_value(xctx->inst[i].prop_ptr, "lvs_netlist", 0);
|
||||
if(str[0]) {
|
||||
/* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx->inst[i].prop_ptr); */
|
||||
if(!strboolcmp(str, "true")) tclsetintvar("lvs_netlist", 1);
|
||||
else tclsetintvar("lvs_netlist", 0);
|
||||
if(!strboolcmp(str, "true")) {
|
||||
tclsetintvar("lvs_netlist", 1);
|
||||
my_strdup(_ALLOC_ID_, &xctx->format, "lvs_format");
|
||||
}
|
||||
else {
|
||||
tclsetintvar("lvs_netlist", 0);
|
||||
my_strdup(_ALLOC_ID_, &xctx->format, xctx->custom_format);
|
||||
}
|
||||
}
|
||||
|
||||
str = get_tok_value(xctx->inst[i].prop_ptr, "top_is_subckt", 0);
|
||||
|
|
|
|||
|
|
@ -1418,8 +1418,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
else if(!strcmp(argv[2], "format")) { /* alternate format attribute to use in netlist (or NULL) */
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
if(!xctx->format ) Tcl_SetResult(interp, "<NULL>",TCL_STATIC);
|
||||
else Tcl_SetResult(interp, xctx->format,TCL_VOLATILE);
|
||||
if(!xctx->custom_format ) Tcl_SetResult(interp, "<NULL>",TCL_STATIC);
|
||||
else Tcl_SetResult(interp, xctx->custom_format,TCL_VOLATILE);
|
||||
}
|
||||
break;
|
||||
case 'g':
|
||||
|
|
@ -5345,7 +5345,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
else if(!strcmp(argv[2], "format")) { /* set name of custom format attribute used for netlisting */
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
my_strdup(_ALLOC_ID_, &xctx->format, argv[3]);
|
||||
my_strdup(_ALLOC_ID_, &xctx->custom_format, argv[3]);
|
||||
}
|
||||
else if(!strcmp(argv[2], "header_text")) { /* set header metadata (used for license info) */
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
|
|
|
|||
|
|
@ -173,9 +173,11 @@ static int spice_netlist(FILE *fd, int spice_stop )
|
|||
int err = 0;
|
||||
int i, flag = 0;
|
||||
const char *type;
|
||||
int top_sub = tclgetboolvar("lvs_netlist") || tclgetboolvar("top_is_subckt");
|
||||
int lvs_netlist = tclgetboolvar("lvs_netlist");
|
||||
int top_sub = lvs_netlist || tclgetboolvar("top_is_subckt");
|
||||
int lvs_ignore = tclgetboolvar("lvs_ignore");
|
||||
|
||||
if(lvs_netlist) my_strdup(_ALLOC_ID_, &xctx->format, "lvs_format");
|
||||
else my_strdup(_ALLOC_ID_, &xctx->format, xctx->custom_format);
|
||||
if(!spice_stop) {
|
||||
dbg(1, "spice_netlist(): invoke prepare_netlist_structs for %s\n", xctx->current_name);
|
||||
xctx->prep_net_structs = 0;
|
||||
|
|
@ -263,11 +265,9 @@ int global_spice_netlist(int global, int alert) /* netlister driver */
|
|||
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
|
||||
char *subckt_name;
|
||||
char *abs_path = NULL;
|
||||
int top_sub;
|
||||
int split_f;
|
||||
Str_hashtable subckt_table = {NULL, 0};
|
||||
Str_hashentry *model_entry;
|
||||
int lvs_ignore = tclgetboolvar("lvs_ignore");
|
||||
int save_prev_mod = xctx->prev_set_modify;
|
||||
struct stat buf;
|
||||
char *top_symbol_name = NULL;
|
||||
|
|
@ -278,7 +278,12 @@ int global_spice_netlist(int global, int alert) /* netlister driver */
|
|||
int npins = 0; /* top schematic number of i/o ports */
|
||||
Sch_pin_record *pinnumber_list = NULL; /* list of top sch i/o ports ordered wrt sim_pinnumber attr */
|
||||
int uppercase_subckt = tclgetboolvar("uppercase_subckt");
|
||||
int lvs_netlist = tclgetboolvar("lvs_netlist");
|
||||
int top_sub = lvs_netlist || tclgetboolvar("top_is_subckt");
|
||||
int lvs_ignore = tclgetboolvar("lvs_ignore");
|
||||
|
||||
if(lvs_netlist) my_strdup(_ALLOC_ID_, &xctx->format, "lvs_format");
|
||||
else my_strdup(_ALLOC_ID_, &xctx->format, xctx->custom_format);
|
||||
exit_code = 0; /* reset exit code */
|
||||
split_f = tclgetboolvar("split_files");
|
||||
dbg(1, "global_spice_netlist(): invoking push_undo()\n");
|
||||
|
|
@ -339,7 +344,6 @@ int global_spice_netlist(int global, int alert) /* netlister driver */
|
|||
netlist_options(i);
|
||||
}
|
||||
}
|
||||
top_sub = tclgetboolvar("lvs_netlist") || tclgetboolvar("top_is_subckt");
|
||||
if(!top_sub) fprintf(fd,"**");
|
||||
if(uppercase_subckt)
|
||||
fprintf(fd,".SUBCKT %s", get_cell(xctx->sch[xctx->currsch], 0));
|
||||
|
|
|
|||
|
|
@ -422,6 +422,7 @@ static void free_xschem_data()
|
|||
my_free(_ALLOC_ID_, &xctx->current_win_path);
|
||||
my_free(_ALLOC_ID_, &xctx->fill_type);
|
||||
my_free(_ALLOC_ID_, &xctx->format);
|
||||
my_free(_ALLOC_ID_, &xctx->custom_format);
|
||||
my_free(_ALLOC_ID_, &xctx);
|
||||
}
|
||||
|
||||
|
|
@ -684,8 +685,10 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->active_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
xctx->hide_symbols = 0;
|
||||
xctx->netlist_type = CAD_SPICE_NETLIST;
|
||||
xctx->format = NULL; /* custom format string for netlist, otherwise use
|
||||
xctx->format = NULL; /* format string for netlist, (copied from custom_format) otherwise use
|
||||
* "format", "verilog_format", "vhdl_format", "tedax_format" */
|
||||
/* user specified format string to use for spice netlist (xschem set format command) */
|
||||
xctx->custom_format = NULL;
|
||||
xctx->top_path = NULL;
|
||||
xctx->current_win_path = NULL;
|
||||
my_strdup2(_ALLOC_ID_, &xctx->top_path, top_path);
|
||||
|
|
@ -2753,8 +2756,8 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
/* set global variables fetching data from tcl code */
|
||||
|
||||
/* if lvs_netlist is set also use lvs_format for devices netlisting rule if existing */
|
||||
if(tclgetboolvar("lvs_netlist")) tcleval("xschem set format lvs_format");
|
||||
else tcleval("xschem set format {}");
|
||||
if(tclgetboolvar("lvs_netlist")) my_strdup(_ALLOC_ID_, &xctx->format, "lvs_format");
|
||||
else my_strdup(_ALLOC_ID_, &xctx->format, NULL);
|
||||
|
||||
if(cli_opt_netlist_type) {
|
||||
xctx->netlist_type = cli_opt_netlist_type;
|
||||
|
|
|
|||
|
|
@ -1137,6 +1137,7 @@ typedef struct {
|
|||
int hide_symbols; /* MIRRORED IN TCL */
|
||||
int netlist_type;
|
||||
char *format; /* "format", "verilog_format", "vhdl_format" or "tedax_format" */
|
||||
char *custom_format; /* user specified format string to use for spice netlist (xschem set format command) */
|
||||
char *top_path;
|
||||
/* top_path is the path prefix of drawing canvas (current_win_path):
|
||||
* top_path is always "" in tabbed interface
|
||||
|
|
|
|||
|
|
@ -9353,13 +9353,7 @@ tclcommand=\"xschem raw_read \$netlist_dir/[file tail [file rootname [xschem get
|
|||
$topwin.menubar.simulation add cascade -label "LVS" -menu $topwin.menubar.simulation.lvs
|
||||
menu $topwin.menubar.simulation.lvs -tearoff 0
|
||||
$topwin.menubar.simulation.lvs add checkbutton -label "LVS netlist + Top level is a .subckt" \
|
||||
-selectcolor $selectcolor -variable lvs_netlist -command {
|
||||
if {$lvs_netlist == 1} {
|
||||
xschem set format lvs_format
|
||||
} else {
|
||||
xschem set format {}
|
||||
}
|
||||
}
|
||||
-selectcolor $selectcolor -variable lvs_netlist
|
||||
$topwin.menubar.simulation.lvs add checkbutton -label "Upper case .SUBCKT and .ENDS" \
|
||||
-selectcolor $selectcolor -variable uppercase_subckt
|
||||
$topwin.menubar.simulation.lvs add checkbutton -label "Top level is a .subckt" \
|
||||
|
|
|
|||
Loading…
Reference in New Issue