make op backannotation in schematic work also if raw file loaded at hierarchy level > 0
This commit is contained in:
parent
e67ff344c8
commit
931c1520e3
|
|
@ -487,6 +487,8 @@ void free_rawfile(int dr)
|
|||
if(xctx->graph_npoints) my_free(1413, &xctx->graph_npoints);
|
||||
xctx->graph_allpoints = 0;
|
||||
if(xctx->graph_raw_schname) my_free(1393, &xctx->graph_raw_schname);
|
||||
xctx->graph_raw_level = -1;
|
||||
tclsetintvar("graph_raw_level", -1);
|
||||
xctx->graph_datasets = 0;
|
||||
xctx->graph_nvars = 0;
|
||||
xctx->graph_annotate_p = -1;
|
||||
|
|
@ -568,6 +570,8 @@ int raw_read(const char *f, const char *type)
|
|||
if((res = read_dataset(fd, type)) == 1) {
|
||||
int i;
|
||||
my_strdup2(1394, &xctx->graph_raw_schname, xctx->sch[xctx->currsch]);
|
||||
xctx->graph_raw_level = xctx->currsch;
|
||||
tclsetintvar("graph_raw_level", xctx->currsch);
|
||||
xctx->graph_allpoints = 0;
|
||||
for(i = 0; i < xctx->graph_datasets; i++) {
|
||||
xctx->graph_allpoints += xctx->graph_npoints[i];
|
||||
|
|
|
|||
18
src/token.c
18
src/token.c
|
|
@ -3018,7 +3018,8 @@ const char *translate(int inst, const char* s)
|
|||
}
|
||||
else if(strcmp(token,"@spice_get_voltage")==0 )
|
||||
{
|
||||
if((sch_waves_loaded() >= 0) && xctx->graph_annotate_p>=0) {
|
||||
int start_level; /* hierarchy level where waves were loaded */
|
||||
if((start_level = sch_waves_loaded() >= 0) && xctx->graph_annotate_p>=0) {
|
||||
int multip;
|
||||
int no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER];
|
||||
if(no_of_pins == 1) {
|
||||
|
|
@ -3030,6 +3031,12 @@ const char *translate(int inst, const char* s)
|
|||
double val;
|
||||
char valstr[120];
|
||||
if(path) {
|
||||
int skip = 0;
|
||||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
}
|
||||
prepare_netlist_structs(0);
|
||||
net = net_name(inst,0, &multip, 0, 0);
|
||||
len = strlen(path) + strlen(net) + 1;
|
||||
|
|
@ -3062,7 +3069,8 @@ const char *translate(int inst, const char* s)
|
|||
}
|
||||
else if(strcmp(token,"@spice_get_current")==0 )
|
||||
{
|
||||
if((sch_waves_loaded() >= 0) && xctx->graph_annotate_p>=0) {
|
||||
int start_level; /* hierarchy level where waves were loaded */
|
||||
if((start_level = sch_waves_loaded() >= 0) && xctx->graph_annotate_p>=0) {
|
||||
char *fqdev = NULL;
|
||||
const char *path = xctx->sch_path[xctx->currsch] + 1;
|
||||
char *dev = NULL;
|
||||
|
|
@ -3071,6 +3079,12 @@ const char *translate(int inst, const char* s)
|
|||
double val;
|
||||
char valstr[120];
|
||||
if(path) {
|
||||
int skip = 0;
|
||||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
}
|
||||
my_strdup2(1550, &dev, xctx->inst[inst].instname);
|
||||
strtolower(dev);
|
||||
len = strlen(path) + strlen(dev) + 11; /* some extra chars for i(..) wrapper */
|
||||
|
|
|
|||
|
|
@ -452,6 +452,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->graph_annotate_p = -1; /* point in raw file to use for annotating voltages/currents/etc */
|
||||
xctx->graph_struct.hilight_wave = -1; /* index of wave */
|
||||
xctx->graph_raw_schname = NULL;
|
||||
xctx->graph_raw_level = -1; /* hierarchy level where raw file has been read */
|
||||
xctx->wires = 0;
|
||||
xctx->instances = 0;
|
||||
xctx->symbols = 0;
|
||||
|
|
|
|||
|
|
@ -912,6 +912,7 @@ typedef struct {
|
|||
/* when descending hierarchy xctx->current_name changes, xctx->graph_raw_schname
|
||||
* holds the name of the top schematic from which the raw file was loaded */
|
||||
char *graph_raw_schname;
|
||||
int graph_raw_level; /* hierarchy level where raw file has been read MIRRORED IN TCL*/
|
||||
/* */
|
||||
XSegment *biggridpoint;
|
||||
XPoint *gridpoint;
|
||||
|
|
|
|||
|
|
@ -3105,12 +3105,21 @@ proc tclpropeval {s instname symname} {
|
|||
|
||||
# this hook is called in translate() if whole string is contained in a tcleval(...) construct
|
||||
proc tclpropeval2 {s} {
|
||||
global debug_var env path
|
||||
global debug_var env path graph_raw_level
|
||||
|
||||
set netlist_type [xschem get netlist_type]
|
||||
# puts "tclpropeval2: s=|$s|"
|
||||
if {$debug_var <=-1} {puts "tclpropeval2: $s"}
|
||||
set path [string range [xschem get sch_path] 1 end]
|
||||
|
||||
# skip hierarchy components above the level where raw file has been loaded.
|
||||
# node path names to look up in raw file begin from there.
|
||||
set skip 0
|
||||
while { $skip < $graph_raw_level } {
|
||||
regsub {^[^.]*\.} $path {} path
|
||||
incr skip
|
||||
}
|
||||
|
||||
if { $netlist_type eq {spice} } {
|
||||
# this is necessary if spiceprefix is being used in netlists
|
||||
regsub {^([^xX])} $path {x\1} path
|
||||
|
|
@ -4661,7 +4670,7 @@ set tctx::global_list {
|
|||
dark_colorscheme dim_bg dim_value disable_unique_names do_all_inst draw_grid draw_window
|
||||
edit_prop_pos edit_prop_size editprop_sympath edit_symbol_prop_new_sel enable_dim_bg enable_stretch
|
||||
en_hilight_conn_inst filetmp flat_netlist fullscreen gaw_fd gaw_tcp_address globfilter
|
||||
graph_bus graph_digital graph_logx graph_logy
|
||||
graph_bus graph_digital graph_logx graph_logy graph_raw_level
|
||||
graph_sel_color graph_schname graph_selected graph_sel_wave graph_sort
|
||||
graph_unlocked hide_empty_graphs hide_symbols hsize
|
||||
incr_hilight infowindow_text INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR
|
||||
|
|
@ -5708,6 +5717,7 @@ set_ne graph_logx 0
|
|||
set_ne graph_logy 0
|
||||
set_ne graph_selected {}
|
||||
set_ne graph_schname {}
|
||||
set_ne graph_raw_level -1 ;# hierarchy level where raw file has been loaded
|
||||
# user clicked this wave
|
||||
set_ne graph_sel_wave {}
|
||||
# flag to force simulation stop (Esc key pressed)
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ B 5 -2.5 27.5 2.5 32.5 {name=minus dir=inout propag=0}
|
|||
T {@name} 15 -18.75 0 0 0.2 0.2 {}
|
||||
T {@#0:net_name} 10 -28.75 0 0 0.15 0.15 {layer=15}
|
||||
T {@#1:net_name} 10 20 0 0 0.15 0.15 {layer=15}
|
||||
T {@spice_get_current} 12.5 0 0 0 0.2 0.2 {layer=15
|
||||
T {@spice_get_current} 2.5 7.5 0 0 0.2 0.2 {layer=15
|
||||
hide=true}
|
||||
|
|
|
|||
Loading…
Reference in New Issue