Merge branch 'StefanSchippers:master' into master
This commit is contained in:
commit
05a376e678
|
|
@ -934,7 +934,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
Return a list of 3-items. Each 3-item is
|
||||
an instance name followed by the symbol reference and symbol type.
|
||||
Example: xschem instance_list -->
|
||||
{x1} {sky130_tests/bandgap.sym} {subcircuit}} {...} {...} {...} ... </pre>
|
||||
{x1} {sky130_tests/bandgap.sym} {subcircuit}
|
||||
{...} {...} {...}
|
||||
...</pre>
|
||||
<li><kbd> instance_net inst pin</kbd></li><pre>
|
||||
Return the name of the net attached to pin 'pin' of instance 'inst'
|
||||
Example: xschem instance_net x3 MINUS --> REF </pre>
|
||||
|
|
@ -1064,7 +1066,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
<li><kbd> net_pin_mismatch</kbd></li><pre>
|
||||
Highlight nets attached to selected symbols with
|
||||
a different name than symbol pin </pre>
|
||||
<li><kbd> netlist [-messages] [filename]</kbd></li><pre>
|
||||
<li><kbd> netlist [-messages | -erc | -nohier] [filename]</kbd></li><pre>
|
||||
do a netlist of current schematic in currently defined netlist format
|
||||
if 'filename'is given use specified name for the netlist
|
||||
if 'filename' contains path components place the file in specified path location.
|
||||
|
|
@ -1074,6 +1076,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
will create the netlist in different places.
|
||||
netlisting directory is reset to previous setting after completing this command
|
||||
If -messages is given return the ERC messages instead of just a fail (1)
|
||||
If -erc is given it means netlister is called from gui, enable show infowindow
|
||||
If -nohier is given netlist only current level
|
||||
or no fail (0) code. </pre>
|
||||
<li><kbd> new_process [f]</kbd></li><pre>
|
||||
Start a new xschem process for a schematic.
|
||||
|
|
|
|||
|
|
@ -2073,6 +2073,7 @@ void get_additional_symbols(int what)
|
|||
}
|
||||
}
|
||||
/* fallback = 1: if schematic attribute is set but file not existing fallback
|
||||
* if inst == -1 use only symbol reference
|
||||
* to defaut symbol schematic (symname.sym -> symname.sch) */
|
||||
void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
|
||||
{
|
||||
|
|
@ -2084,17 +2085,29 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
|
|||
int cancel = 0;
|
||||
int is_gen = 0;
|
||||
|
||||
my_strncpy(filename, "", PATH_MAX);
|
||||
|
||||
if(inst >= xctx->instances) {
|
||||
dbg(0, "get_sch_from_sym() error: called with invalid inst=%d\n", inst);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!sym) {
|
||||
dbg(0, "get_sch_from_sym() error: called with NULL sym", inst);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get sch/sym name from parent schematic downloaded from web */
|
||||
if(is_from_web(xctx->current_dirname)) {
|
||||
web_url = 1;
|
||||
}
|
||||
|
||||
dbg(1, "get_sch_from_sym(): current_dirname= %s\n", xctx->current_dirname);
|
||||
dbg(1, "get_sch_from_sym(): symbol %s inst=%d web_url=%d\n", sym->name, inst, web_url);
|
||||
if(inst >= 0) {
|
||||
/* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */
|
||||
my_strdup(_ALLOC_ID_, &str_tmp,
|
||||
translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6), 1,
|
||||
xctx->inst[inst].prop_ptr, NULL, NULL));
|
||||
/* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */
|
||||
if(inst >=0 ) {
|
||||
my_strdup(_ALLOC_ID_, &str_tmp, translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6),
|
||||
1, xctx->inst[inst].prop_ptr, NULL, NULL));
|
||||
}
|
||||
if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 6));
|
||||
if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */
|
||||
|
|
@ -2111,17 +2124,14 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
|
|||
if(web_url) my_strncpy(filename, sch, PATH_MAX);
|
||||
else my_strncpy(filename, abs_sym_path(sch, ""), PATH_MAX);
|
||||
}
|
||||
} else {
|
||||
my_strncpy(filename, "", PATH_MAX);
|
||||
}
|
||||
|
||||
if(has_x && fallback && !is_gen && filename[0]) {
|
||||
file_exists = !stat(filename, &buf);
|
||||
if(!file_exists) {
|
||||
tclvareval("ask_save {Schematic ", filename, "\ndoes not exist.\nDescend into base schematic?}", NULL);
|
||||
if(strcmp(tclresult(), "yes") ) fallback = 0;
|
||||
if(!strcmp(tclresult(), "") ) {
|
||||
my_strncpy(filename, "", PATH_MAX);
|
||||
if(strcmp(tclresult(), "yes") ) fallback = 0; /* 'no' or 'cancel' */
|
||||
if(!strcmp(tclresult(), "") ) { /* 'cancel' */
|
||||
cancel = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2303,6 +2303,7 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
|
|||
Raw *raw = NULL;
|
||||
const char *ptr;
|
||||
|
||||
raw = xctx->raw;
|
||||
autoload = !strboolcmp(get_tok_value(r->prop_ptr,"autoload", 0), "1");
|
||||
if(autoload == 0) autoload = 2;
|
||||
ptr = get_tok_value(r->prop_ptr,"rawfile", 0);
|
||||
|
|
@ -2336,7 +2337,6 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
|
|||
}
|
||||
}
|
||||
|
||||
raw = xctx->raw;
|
||||
/* if doing double variable DC sweeps raw->datasets == 1 but there are multiple curves.
|
||||
* find_closest_wave() may return a dataset number that is > 0 but its a "virtual" dataset
|
||||
* since double DC sweeps just do multiple sweeps by wrapping the sweep variable
|
||||
|
|
@ -2360,6 +2360,7 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
|
|||
xx1 = mylog10(xx1);
|
||||
xx2 = mylog10(xx2);
|
||||
}
|
||||
dbg(1, "graph_fullxzoom(): xx1=%g, xx2=%g\n");
|
||||
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1)));
|
||||
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
|
||||
|
||||
|
|
@ -2409,7 +2410,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
|
|||
|
||||
ptr = get_tok_value(r->prop_ptr,"rawfile", 0);
|
||||
if(!ptr[0]) {
|
||||
if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile);
|
||||
if(xctx->raw && xctx->raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, xctx->raw->rawfile);
|
||||
else my_strdup2(_ALLOC_ID_, &custom_rawfile, "");
|
||||
} else {
|
||||
my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr);
|
||||
|
|
@ -2431,7 +2432,6 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
|
|||
extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0);
|
||||
}
|
||||
raw = xctx->raw;
|
||||
|
||||
my_strdup2(_ALLOC_ID_, &nd, find_nth(ntok, "%", "\"", 0, 2));
|
||||
/* if %<n> is specified after node name, <n> is the dataset number to plot in graph */
|
||||
if(nd[0]) {
|
||||
|
|
@ -3860,7 +3860,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
|||
if(custom_rawfile[0]) {
|
||||
if(extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type :
|
||||
(xctx->raw && xctx->raw->sim_type ? xctx->raw->sim_type : NULL), -1.0, -1.0) == 0) {
|
||||
valid_rawfile = 0;
|
||||
valid_rawfile = 0;
|
||||
}
|
||||
}
|
||||
my_strdup2(_ALLOC_ID_, &nd, find_nth(ntok, "%", "\"", 0, 2));
|
||||
|
|
|
|||
|
|
@ -1423,10 +1423,12 @@ static int name_unlabeled_instances()
|
|||
int i, j;
|
||||
xInstance * const inst = xctx->inst;
|
||||
int const instances = xctx->instances;
|
||||
int rects, all_unconn;
|
||||
int rects;
|
||||
|
||||
/* name nets that do not touch ipin opin alias instances */
|
||||
dbg(2, "name_unlabeled_instances(): naming nets that dont touch labels\n");
|
||||
|
||||
#if 0 /* does not work */
|
||||
int all_unconn;
|
||||
for (i = 0; i < instances; ++i)
|
||||
{
|
||||
if(!inst[i].node) continue;
|
||||
|
|
@ -1438,7 +1440,6 @@ static int name_unlabeled_instances()
|
|||
if(inst[i].node[j] == NULL)
|
||||
{
|
||||
all_unconn++;
|
||||
err |= set_unnamed_inst(i, j);
|
||||
}
|
||||
}
|
||||
if(rects > 0 && all_unconn == rects && for_netlist > 0 && xctx->netlist_count > 0) {
|
||||
|
|
@ -1450,6 +1451,23 @@ static int name_unlabeled_instances()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
dbg(2, "name_unlabeled_instances(): naming nets that dont touch labels\n");
|
||||
for (i = 0; i < instances; ++i)
|
||||
{
|
||||
if(!inst[i].node) continue;
|
||||
if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
|
||||
if(inst[i].ptr != -1) {
|
||||
rects=(inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(j = 0; j < rects; ++j) {
|
||||
if(inst[i].node[j] == NULL)
|
||||
{
|
||||
err |= set_unnamed_inst(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2413,7 +2413,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
* Return a list of 3-items. Each 3-item is
|
||||
* an instance name followed by the symbol reference and symbol type.
|
||||
* Example: xschem instance_list -->
|
||||
* {x1} {sky130_tests/bandgap.sym} {subcircuit}} {...} {...} {...} ... */
|
||||
* {x1} {sky130_tests/bandgap.sym} {subcircuit}
|
||||
* {...} {...} {...}
|
||||
* ...
|
||||
*/
|
||||
else if(!strcmp(argv[1], "instance_list"))
|
||||
{
|
||||
int i;
|
||||
|
|
@ -2663,7 +2666,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
|
||||
/* is_symgen symbol
|
||||
* tell if 'symbol' is a generator (symbol(param1,param2,...) */
|
||||
else if(!strcmp(argv[1], "is_symgen"))
|
||||
else if(!strcmp(argv[1], "is_generator"))
|
||||
{
|
||||
char s[30];
|
||||
if(argc > 2) {
|
||||
|
|
@ -3181,7 +3184,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
hilight_net_pin_mismatches();
|
||||
}
|
||||
|
||||
/* netlist [-messages] [filename]
|
||||
/* netlist [-messages | -erc | -nohier] [filename]
|
||||
* do a netlist of current schematic in currently defined netlist format
|
||||
* if 'filename'is given use specified name for the netlist
|
||||
* if 'filename' contains path components place the file in specified path location.
|
||||
|
|
@ -3191,51 +3194,62 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
* will create the netlist in different places.
|
||||
* netlisting directory is reset to previous setting after completing this command
|
||||
* If -messages is given return the ERC messages instead of just a fail (1)
|
||||
* If -erc is given it means netlister is called from gui, enable show infowindow
|
||||
* If -nohier is given netlist only current level
|
||||
* or no fail (0) code. */
|
||||
else if(!strcmp(argv[1], "netlist") )
|
||||
{
|
||||
char *saveshow = NULL;
|
||||
int err = 0;
|
||||
int messages = 0;
|
||||
int hier_netlist = 1;
|
||||
int i, messages = 0;
|
||||
int erc = 0;
|
||||
const char *fname = NULL;
|
||||
const char *path;
|
||||
char savedir[PATH_MAX];
|
||||
int done_netlist = 0;
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
yyparse_error = 0;
|
||||
my_strdup(_ALLOC_ID_, &saveshow, tclgetvar("show_infowindow_after_netlist"));
|
||||
if(argc <= 2 || (argc > 2 && strcmp(argv[2], "-erc"))) { /* xschem netlist NOT invoked from GUI */
|
||||
tclsetvar("show_infowindow_after_netlist", "never");
|
||||
}
|
||||
if(argc > 2) {
|
||||
if(!strcmp(argv[2], "-messages")) {
|
||||
messages = 1;
|
||||
if(argc > 3) fname = argv[3];
|
||||
} else if(strcmp(argv[2], "-erc")) {
|
||||
fname = argv[2];
|
||||
}
|
||||
if(fname) {
|
||||
my_strncpy(xctx->netlist_name, get_cell_w_ext(fname, 0), S(xctx->netlist_name));
|
||||
tclvareval("file dirname ", fname, NULL);
|
||||
path = tclresult();
|
||||
if(strchr(fname, '/')) {
|
||||
set_netlist_dir(1, path);
|
||||
|
||||
my_strncpy(savedir, tclgetvar("netlist_dir"), S(savedir));
|
||||
for(i = 2; i < argc; i++) {
|
||||
if(argv[i][0] == '-') {
|
||||
if(!strcmp(argv[i], "-messages")) {
|
||||
messages = 1;
|
||||
} else if(!strcmp(argv[i], "-erc")) {
|
||||
erc = 1;
|
||||
} else if(!strcmp(argv[i], "-nohier")) {
|
||||
hier_netlist = 0;
|
||||
}
|
||||
} else {
|
||||
fname = argv[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(erc == 0) tclsetvar("show_infowindow_after_netlist", "never");
|
||||
if(fname) {
|
||||
my_strncpy(xctx->netlist_name, get_cell_w_ext(fname, 0), S(xctx->netlist_name));
|
||||
tclvareval("file dirname ", fname, NULL);
|
||||
path = tclresult();
|
||||
if(strchr(fname, '/')) {
|
||||
set_netlist_dir(1, path);
|
||||
}
|
||||
}
|
||||
if(set_netlist_dir(0, NULL) ) {
|
||||
done_netlist = 1;
|
||||
if(xctx->netlist_type == CAD_SPICE_NETLIST)
|
||||
err = global_spice_netlist(1); /* 1 means global netlist */
|
||||
err = global_spice_netlist(hier_netlist); /* 1 means global netlist */
|
||||
else if(xctx->netlist_type == CAD_VHDL_NETLIST)
|
||||
err = global_vhdl_netlist(1);
|
||||
err = global_vhdl_netlist(hier_netlist);
|
||||
else if(xctx->netlist_type == CAD_VERILOG_NETLIST)
|
||||
err = global_verilog_netlist(1);
|
||||
err = global_verilog_netlist(hier_netlist);
|
||||
else if(xctx->netlist_type == CAD_TEDAX_NETLIST)
|
||||
global_tedax_netlist(1);
|
||||
global_tedax_netlist(hier_netlist);
|
||||
else
|
||||
if(has_x) tcleval("tk_messageBox -type ok -parent [xschem get topwindow] "
|
||||
"-message {Please Set netlisting mode (Options menu)}");
|
||||
if( (argc ==3 && strcmp(argv[2], "-erc") ) || argc > 3) {
|
||||
if( (erc == 0) ) {
|
||||
my_strncpy(xctx->netlist_name, "", S(xctx->netlist_name));
|
||||
}
|
||||
}
|
||||
|
|
@ -3256,6 +3270,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
}
|
||||
tclsetvar("show_infowindow_after_netlist", saveshow);
|
||||
set_netlist_dir(1, savedir);
|
||||
if(done_netlist) {
|
||||
if(messages) {
|
||||
Tcl_SetResult(interp, xctx->infowindow_text, TCL_VOLATILE);
|
||||
|
|
@ -5652,7 +5667,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
char n[100];
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
if(argc > 2 && !strcmp(argv[2], "derived_symbols")) derived_symbols = 1;
|
||||
else if(argc > 2) {
|
||||
else if(argc > 2 && argv[2][0]) {
|
||||
one_symbol = 1;
|
||||
i = get_symbol(argv[2]);
|
||||
if(i >=0) Tcl_AppendResult(interp, my_itoa(i), " {", xctx->sym[i].name, "}", NULL);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ char *get_generator_command(const char *str)
|
|||
#endif
|
||||
dbg(1, "get_generator_command(): cmd_filename=%s\n", cmd_filename);
|
||||
dbg(1, "get_generator_command(): gen_cmd=%s\n", gen_cmd);
|
||||
dbg(1, "get_generator_command(): is_symgen=%d\n", is_generator(str));
|
||||
dbg(1, "get_generator_command(): is_generator=%d\n", is_generator(str));
|
||||
|
||||
end:
|
||||
my_free(_ALLOC_ID_, &cmd);
|
||||
|
|
|
|||
|
|
@ -1787,7 +1787,7 @@ proc cellview_setlabels {w symbol sym_sch default_sch sym_spice_sym_def} {
|
|||
$w configure -fg $symfg
|
||||
} else {
|
||||
if {[$w get] eq $default_sch} {
|
||||
puts "need to clear schematic attr in symbol"
|
||||
puts "$symbol: need to clear schematic attr in symbol"
|
||||
} elseif {[$w get] eq $sym_sch} {
|
||||
$w configure -bg $symbg
|
||||
} else {
|
||||
|
|
@ -1799,7 +1799,19 @@ proc cellview_setlabels {w symbol sym_sch default_sch sym_spice_sym_def} {
|
|||
}
|
||||
}
|
||||
|
||||
proc cellview {} {
|
||||
proc cellview_edit_item {w sym_spice_sym_def} {
|
||||
if {[xschem is_generator [$w get]]} {
|
||||
set f [$w get]
|
||||
regsub {\(.*} $f {} f
|
||||
textwindow [abs_sym_path $f]
|
||||
} elseif { $sym_spice_sym_def eq {}} {
|
||||
xschem load_new_window [$w get]
|
||||
} else {
|
||||
editdata $sym_spice_sym_def {Symbol spice_sym_def attribute}
|
||||
}
|
||||
}
|
||||
|
||||
proc cellview {{derived_symbols {}}} {
|
||||
global keep_symbols nolist_libs
|
||||
|
||||
if {[info tclversion] >= 8.5} {
|
||||
|
|
@ -1824,7 +1836,7 @@ proc cellview {} {
|
|||
frame .cv.center
|
||||
set sf [sframe .cv.center]
|
||||
# puts sf=$sf
|
||||
set syms [join [lsort -index 1 [xschem symbols]]]
|
||||
set syms [join [lsort -index 1 [xschem symbols $derived_symbols]]]
|
||||
foreach {i symbol} $syms {
|
||||
set abs_sch [xschem get_sch_from_sym -1 $symbol]
|
||||
set abs_sym [abs_sym_path $symbol]
|
||||
|
|
@ -1838,7 +1850,6 @@ proc cellview {} {
|
|||
}
|
||||
if {$skip} { continue }
|
||||
set sym_sch [rel_sym_path $abs_sch]
|
||||
set default_sch [add_ext $symbol .sch]
|
||||
set type [xschem getprop symbol $symbol type]
|
||||
set sym_spice_sym_def [xschem getprop symbol $symbol spice_sym_def]
|
||||
if {$type eq {subcircuit}} {
|
||||
|
|
@ -1850,12 +1861,7 @@ proc cellview {} {
|
|||
entry $sf.f$i.s -width 45 -borderwidth 1 -relief sunken -font $font
|
||||
balloon $sf.f$i.s $abs_sch
|
||||
button $sf.f$i.b -text Sch -padx 4 -borderwidth 1 -pady 0 -font $font \
|
||||
-command "
|
||||
if { [list $sym_spice_sym_def] eq {}} {
|
||||
xschem load_new_window \[$sf.f$i.s get\]
|
||||
} else {
|
||||
editdata [list $sym_spice_sym_def] {Symbol spice_sym_def attribute}
|
||||
}"
|
||||
-command "cellview_edit_item $sf.f$i.s [list $sym_spice_sym_def]"
|
||||
if {$sym_spice_sym_def eq {}} {
|
||||
$sf.f$i.s insert 0 $sym_sch
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue