Alt-a in graph annotates schematic with values at cursor b position. Simulation->Live annotate option to automatically update schematic probes if cursor moved. Some improvements and fixes in ngspice_annotate.tcl. Fix xschem setprobe command. Added missing housekeeping_ctx when a new tab is created. housekeeping_ctx: added more variables to sync.

This commit is contained in:
Stefan Frederik 2022-09-18 05:29:16 +02:00
parent 5dc0b14de4
commit 96f80d1d33
17 changed files with 252 additions and 100 deletions

View File

@ -22,7 +22,7 @@
#include "xschem.h"
static int waves_selected(int event, int state, int button)
static int waves_selected(int event, KeySym key, int state, int button)
{
int i;
int is_inside = 0, skip = 0;
@ -30,7 +30,7 @@ static int waves_selected(int event, int state, int button)
STARTPAN | STARTSELECT | STARTMOVE | STARTCOPY;
if(xctx->ui_state & excl) skip = 1;
else if(!xctx->graph_values) skip = 1;
else if(state & Mod1Mask) skip = 1;
else if(key !='a' && (state & Mod1Mask)) skip = 1;
else if(event == MotionNotify && (state & Button2Mask)) skip = 1;
else if(event == MotionNotify && (state & Button1Mask) && (state & ShiftMask)) skip = 1;
else if(event == ButtonPress && button == Button2) skip = 1;
@ -173,6 +173,96 @@ static void start_wire(double mx, double my)
}
static void backannotate_at_cursor_b_pos(xRect *r)
{
dbg(1, "cursor b pos: %g\n", xctx->graph_cursor2_x);
if(xctx->graph_values) {
int dataset, i, p, ofs;
int sweepvar=0; /* allow different sweep vars? */
const char *ds = get_tok_value(r->prop_ptr, "dataset", 0);
double sweep;
/*
* xSymbol *symptr;
* const char *type;
* int c;
*/
if(ds[0]) dataset = atoi(ds);
else dataset = 0;
if(dataset < 0) dataset = 0;
dbg(1, "dataset=%d\n", dataset);
ofs = 0;
for(p = 0; p < dataset; p++) {
ofs += xctx->graph_npoints[p];
}
for(p = ofs; p < ofs + xctx->graph_npoints[dataset]; p++) {
int s;
sweep = xctx->graph_values[sweepvar][p];
if(p == ofs) {
if(sweep == xctx->graph_cursor2_x) break;
s = XSIGN0(sweep - xctx->graph_cursor2_x);
} else {
int ss = XSIGN0(sweep - xctx->graph_cursor2_x);
if(ss != s) break;
}
}
dbg(1, "ofs=%d, npoints=%d, close to cursor=%g, p=%d\n",
ofs, xctx->graph_npoints[dataset], sweep, p);
for(i = 0; i < xctx->graph_nvars; i++) {
char s[100];
my_snprintf(s, S(s), "%.4g", xctx->graph_values[i][p]);
dbg(1, "%s = %g\n", xctx->graph_names[i], xctx->graph_values[i][p]);
tclvareval("set ngspice::ngspice_data([list {", xctx->graph_names[i], "}]) ", s, NULL);
}
tclvareval("set ngspice::ngspice_data(n\\ vars) ", my_itoa( xctx->graph_nvars), NULL);
tclvareval("set ngspice::ngspice_data(n\\ points) 1", NULL);
draw();
/* draw only probes. does not work as multiple texts will be overlayed */
#if 0
save = xctx->draw_window;
xctx->draw_window = 1;
for(c=0;c<cadlayers;c++) {
if(xctx->draw_single_layer!=-1 && c != xctx->draw_single_layer) continue;
for(i = 0; i < xctx->instances; i++) {
type = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "type", 0);
if(!strstr(type, "source") && !strstr(type, "probe")) continue;
if(xctx->inst[i].ptr == -1 || (c > 0 && (xctx->inst[i].flags & 1)) ) continue;
symptr = (xctx->inst[i].ptr+ xctx->sym);
if(
c==0 ||
symptr->lines[c] ||
symptr->arcs[c] ||
symptr->rects[c] ||
symptr->polygons[c] ||
((c==TEXTWIRELAYER || c==TEXTLAYER) && symptr->texts) )
{
draw_symbol(ADD, c, i,c,0,0,0.0,0.0);
}
}
filledrect(c, END, 0.0, 0.0, 0.0, 0.0);
drawarc(c, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
drawrect(c, END, 0.0, 0.0, 0.0, 0.0, 0);
drawline(c, END, 0.0, 0.0, 0.0, 0.0, 0);
}
xctx->draw_window = save;
#endif
}
}
/* process user input (arrow keys for now) when only graphs are selected */
/* xctx->graph_flags:
@ -254,8 +344,12 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
tclvareval("graph_edit_properties ", my_itoa(i), NULL);
}
}
/* backannotate node values at cursor b position */
else if(key == 'a' && state == Mod1Mask && (xctx->graph_flags & 4)) {
backannotate_at_cursor_b_pos(r);
}
/* x cursor1 toggle */
else if((key == 'a') ) {
else if((key == 'a' && state == 0) ) {
xctx->graph_flags ^= 2;
need_all_redraw = 1;
if(xctx->graph_flags & 2) xctx->graph_cursor1_x = G_X(xctx->mousex);
@ -264,7 +358,10 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
else if((key == 'b') ) {
xctx->graph_flags ^= 4;
need_all_redraw = 1;
if(xctx->graph_flags & 4) xctx->graph_cursor2_x = G_X(xctx->mousex);
if(xctx->graph_flags & 4) {
xctx->graph_cursor2_x = G_X(xctx->mousex);
if(tclgetboolvar("live_cursor2_backannotate")) backannotate_at_cursor_b_pos(r);
}
}
/* measurement tooltip */
else if((key == 'm') ) {
@ -411,7 +508,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
}
/* move cursor2 */
else if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 32 )) {
need_redraw = 1;
if(tclgetboolvar("live_cursor2_backannotate")) backannotate_at_cursor_b_pos(r);
else need_redraw = 1;
}
else /* drag waves with mouse */
if(event == MotionNotify && (state & Button1Mask) && !xctx->graph_bottom) {
@ -1023,7 +1121,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
break;
case MotionNotify:
if( waves_selected(event, state, button)) {
if( waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -1453,7 +1551,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key==XK_Right && !(state & ControlMask)) /* left */
{
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -1464,7 +1562,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key==XK_Left && !(state & ControlMask)) /* right */
{
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -1475,7 +1573,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key==XK_Down) /* down */
{
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -1486,7 +1584,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key==XK_Up) /* up */
{
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -1523,7 +1621,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key=='t' && state == 0) /* place text */
{
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -1614,10 +1712,19 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
go_back(1);break;
}
if(key=='a' && state == Mod1Mask) /* graph annotate dc point @cursor2 */
{
if(xctx->semaphore >= 2) break;
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
break;
}
if(key=='a' && state == 0) /* make symbol */
{
if(xctx->semaphore >= 2) break;
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -2054,7 +2161,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key=='m' && state==0 && !(xctx->ui_state & (STARTMOVE | STARTCOPY))) /* move selection */
{
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -2171,8 +2278,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key==':') /* toggle flat netlist (only spice) */
{
xctx->flat_netlist = !xctx->flat_netlist;
if(xctx->flat_netlist) {
if(!tclgetboolvar("flat_netlist")) {
tcleval("alert_ { enabling flat netlist} {}");
tclsetvar("flat_netlist","1");
}
@ -2185,7 +2291,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(key=='b' && state==0) /* merge schematic */
{
if(xctx->semaphore >= 2) break;
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -2252,7 +2358,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key=='f' && state == 0 ) /* full zoom */
{
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -2273,7 +2379,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
break;
case ButtonPress: /* end operation */
dbg(1, "callback(): ButtonPress ui_state=%d state=%d\n",xctx->ui_state,state);
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -2427,21 +2533,21 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
}
else if(button==Button5 && state == 0 ) {
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
view_unzoom(CADZOOMSTEP);
}
else if(button==Button4 && state == 0 ) {
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
view_zoom(CADZOOMSTEP);
}
else if(button==Button4 && (state & ShiftMask) && !(state & Button2Mask)) {
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -2450,7 +2556,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
redraw_w_a_l_r_p_rubbers();
}
else if(button==Button5 && (state & ShiftMask) && !(state & Button2Mask)) {
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -2668,7 +2774,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
} /* button==Button1 */
break;
case ButtonRelease:
if(waves_selected(event, state, button)) {
if(waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
}
@ -2700,7 +2806,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
break;
case -3: /* double click : edit prop */
if( waves_selected(event, state, button)) {
if( waves_selected(event, key, state, button)) {
waves_callback(event, mx, my, key, button, aux, state);
break;
} else {

View File

@ -2870,13 +2870,11 @@ static void draw_graph_all(int flags)
{
int i, sch_loaded, hide_graphs;
int bbox_set = 0;
const char *tmp;
int save_bbx1, save_bby1, save_bbx2, save_bby2;
dbg(1, "draw_graph_all(): flags=%d\n", flags);
/* save bbox data, since draw_graph_all() is called from draw() which may be called after a bbox(SET) */
sch_loaded = schematic_waves_loaded();
tmp = tclgetvar("hide_empty_graphs");
hide_graphs = (tmp && tmp[0] == '1') ? 1 : 0;
hide_graphs = tclgetboolvar("hide_empty_graphs");
if(sch_loaded || !hide_graphs) {
if(xctx->sem) {
bbox_set = 1;

View File

@ -51,8 +51,8 @@ proc ngspice::read_ngspice_raw {arr fp} {
}
}
if {$variables} {
set bindata [read $fp [expr 8 * $n_vars * $n_points]]
if { $n_points == 1} {
set bindata [read $fp [expr 8 * $n_vars * $n_points]]
binary scan $bindata d[expr $n_vars * $n_points] data
for {set p 0} {$p < $n_points} { incr p} {
for {set v 0} {$v < $n_vars} { incr v} {
@ -117,11 +117,12 @@ proc ngspice::get_current {n} {
set n $path$n
if { $path ne {} } {
set n $prefix.$n
}
}
if { ![regexp $prefix {[ve]}] } {
set n @$n
}
set n i($n)
if { [regexp {\[} $n] } { set n \{$n\} }
# puts "ngspice::get_current --> $n"
set err [catch {set ::ngspice::ngspice_data($n)} res]
if { $err } {
@ -165,32 +166,40 @@ proc ngspice::resetdata {} {
array unset ::ngspice::ngspice_data
}
proc ngspice::annotate {{f {}}} {
proc ngspice::annotate {{f {}} {read_file 1}} {
upvar ::ngspice::ngspice_data arr
if { $f eq {}} {
set rawfile "$::netlist_dir/[file rootname [file tail [xschem get schname 0]]].raw"
if { $read_file == 1} {
if { $f eq {}} {
set rawfile "$::netlist_dir/[file rootname [file tail [xschem get schname 0]]].raw"
} else {
set rawfile $f
}
if { ![file exists $rawfile] } {
puts "no raw file found: $rawfile"
return
}
set fp [open $rawfile r]
fconfigure $fp -translation binary
set op_point_read 0
## not needed: done in ngspice::read_ngspice_raw
# array unset ::ngspice::ngspice_data
while 1 {
ngspice::read_ngspice_raw arr $fp
if { [info exists arr(n\ points)] } {
if { $arr(n\ points) == 1 } {
set op_point_read 1; break
}
} else break;
}
close $fp
puts {Raw file read ...}
} else {
set rawfile $f
set op_point_read 1
}
if { ![file exists $rawfile] } {
puts "no raw file found: $rawfile"
return
}
set fp [open $rawfile r]
fconfigure $fp -translation binary
set op_point_read 0
## not needed: done in ngspice::read_ngspice_raw
# array unset ::ngspice::ngspice_data
while 1 {
ngspice::read_ngspice_raw arr $fp
if { [info exists arr(n\ points)] } {
if { $arr(n\ points) == 1 } {
set op_point_read 1; break
}
} else break;
}
close $fp
puts {Raw file read ...}
if { $op_point_read } {
### disable screen redraw and undo when looping to speed up performance
### but save state on undo stack before doing backannotations.
@ -238,4 +247,4 @@ proc ngspice::annotate {{f {}}} {
}
}
if { [info exists ::has_x] } {bind .drw <Alt-a> {puts {Annotating...}; ngspice::annotate} }
# if { [info exists ::has_x] } {bind .drw <Alt-a> {puts {Annotating...}; ngspice::annotate} }

View File

@ -903,12 +903,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[2],"draw_window")) {
Tcl_SetResult(interp, my_itoa(xctx->draw_window),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"flat_netlist")) {
if( xctx->flat_netlist != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"format")) {
if( !xctx->format )
Tcl_SetResult(interp, "<NULL>",TCL_STATIC);
@ -2543,9 +2537,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[2],"draw_window")) {
xctx->draw_window=atoi(argv[3]);
}
else if(!strcmp(argv[2],"flat_netlist")) {
xctx->flat_netlist=atoi(argv[3]);
}
else if(!strcmp(argv[2],"format")) {
my_strdup(1542, &xctx->format, argv[3]);
}
@ -2611,7 +2602,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xctx->sym_txt=atoi(argv[3]);
}
else {
Tcl_AppendResult(interp, "xschem set ", argv[1], argv[3], ": invalid command.", NULL);
Tcl_AppendResult(interp, "xschem set ", argv[2], ": invalid command.", NULL);
return TCL_ERROR;
}
}
@ -2682,7 +2673,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5]),fast,
tclgetboolvar("disable_unique_names"));
} else {/* assume argc == 5 , delete attribute */
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], NULL),fast,
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[4], NULL),fast,
tclgetboolvar("disable_unique_names"));
}
type=xctx->sym[xctx->inst[inst].ptr].type;

View File

@ -482,7 +482,6 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->sch_to_compare[0] = '\0';
xctx->tok_size = 0;
xctx->netlist_name[0] = '\0';
xctx->flat_netlist = 0;
xctx->plotfile[0] = '\0';
xctx->netlist_unconn_cnt = 0; /* unique count of unconnected pins while netlisting */
xctx->current_dirname[0] = '\0';
@ -1438,6 +1437,7 @@ static void create_new_tab(int *window_count, const char *fname)
build_colors(0.0, 0.0);
resetwin(1, 0, 1, 0, 0); /* create pixmap. resetwin(create_pixmap, clear_pixmap, force, w, h) */
/* draw empty window so if following load fails due to missing file window appears correctly drawn */
tclvareval("housekeeping_ctx", NULL);
zoom_full(1, 0, 1, 0.97);
load_schematic(1,fname, 1);
zoom_full(1, 0, 1, 0.97); /* draw */
@ -2249,7 +2249,6 @@ int Tcl_AppInit(Tcl_Interp *inter)
tclsetvar("menu_debug_var",debug_var ? "1" : "0" );
if(cli_opt_flat_netlist) {
tclsetvar("flat_netlist","1");
xctx->flat_netlist = 1;
}
xctx->areaw = CADWIDTH+4*INT_WIDTH(xctx->lw); /* clip area extends 1 pixel beyond physical xctx->window area */
xctx->areah = CADHEIGHT+4*INT_WIDTH(xctx->lw); /* to avoid drawing clipped rectangle borders at xctx->window edges */
@ -2444,7 +2443,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
xctx->pending_fullzoom=1;
if(cli_opt_do_netlist) {
if(debug_var>=1) {
if(xctx->flat_netlist)
if(tclgetboolvar("flat_netlist"))
fprintf(errfp, "xschem: flat netlist requested\n");
}
if(!cli_opt_filename[0]) {

View File

@ -782,7 +782,6 @@ typedef struct {
int semaphore;
size_t tok_size;
char netlist_name[PATH_MAX];
int flat_netlist;
char current_dirname[PATH_MAX];
int netlist_unconn_cnt; /* unique count of unconnected pins while netlisting */
Instpinentry *instpin_spatial_table[NBOXES][NBOXES];
@ -929,7 +928,7 @@ typedef struct {
double save_lw; /* used to save linewidth when selecting 'only_probes' view */
int no_draw;
int netlist_count; /* netlist counter incremented at any cell being netlisted */
int hide_symbols;
int hide_symbols; /* MIRRORED IN TCL */
int netlist_type;
char *format; /* "format", "verilog_format", "vhdl_format" or "tedax_format" */
char *top_path;
@ -945,7 +944,7 @@ typedef struct {
int *fill_type; /* for every layer: 0: no fill, 1, solid fill, 2: stipple fill */
int fill_pattern;
int draw_pixmap; /* pixmap used as 2nd buffer */
int draw_window;
int draw_window; /* MIRRORED IN TCL */
int do_copy_area;
time_t time_last_modify;
int undo_type; /* 0: on disk, 1: in memory */
@ -953,8 +952,8 @@ typedef struct {
void (*pop_undo)(int, int);
void (*delete_undo)(void);
void (*clear_undo)(void);
int case_insensitive; /* for case insensitive compare where needed */
int show_hidden_texts; /* force show texts that have hide=true attribute set */
int case_insensitive; /* for case insensitive compare where needed MIRRORED IN TCL*/
int show_hidden_texts; /* force show texts that have hide=true attribute set MIRRORED IN TCL*/
int (*x_strcmp)(const char *, const char *);
Lcc hier_attr[CADMAXHIER]; /* hierarchical recursive attribute substitution when descending */
} Xschem_ctx;

View File

@ -4660,15 +4660,13 @@ set tctx::global_list {
change_lw color_ps colors connect_by_kissing constrained_move copy_cell custom_label_prefix custom_token dark_colors
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
en_hilight_conn_inst filetmp flat_netlist fullscreen gaw_fd gaw_tcp_address globfilter
graph_bus graph_digital graph_logx graph_logy
graph_sel_color graph_schname graph_selected graph_sel_wave graph_sort
graph_unlocked
hide_empty_graphs hide_symbols hsize
graph_unlocked hide_empty_graphs hide_symbols hsize
incr_hilight infowindow_text INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR
input_line_cmd input_line_data launcher_default_program light_colors line_width local_netlist_dir
measure_text
input_line_cmd input_line_data launcher_default_program light_colors line_width
live_cursor2_backannotate local_netlist_dir measure_text
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 no_change_attrs noprint_libs old_selected_tok
@ -4754,12 +4752,15 @@ proc save_ctx {context} {
}
proc housekeeping_ctx {} {
global has_x simulate_bg
global has_x simulate_bg show_hidden_texts case_insensitive draw_window hide_symbols
if {![info exists has_x]} {return}
uplevel #0 {
}
# puts "housekeeping_ctx, path: [xschem get current_win_path]"
xschem set hide_symbols $hide_symbols
xschem set draw_window $draw_window
xschem case_insensitive $case_insensitive
xschem set show_hidden_texts $show_hidden_texts
if {![info exists tctx::[xschem get current_win_path]_simulate]} {
[xschem get top_path].menubar.simulate configure -bg $simulate_bg
} else {
@ -5378,6 +5379,8 @@ proc build_widgets { {topwin {} } } {
xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw
}
$topwin.menubar.simulation.menu add command -label {Add waveform graph} -command {xschem add_graph}
$topwin.menubar.simulation.menu add checkbutton -label "Live annotate probes with 'b' cursor" \
-variable live_cursor2_backannotate
$topwin.menubar.simulation.menu add separator
$topwin.menubar.simulation.menu add checkbutton -label "LVS netlist: Top level is a .subckt" -variable top_subckt
$topwin.menubar.simulation.menu add checkbutton -label "Use 'spiceprefix' attribute" -variable spiceprefix \
@ -5672,6 +5675,7 @@ set_ne fullscreen 0
set_ne unzoom_nodrift 0
set_ne change_lw 1
set_ne line_width 0
set_ne live_cursor2_backannotate 0
set_ne draw_window 0
set_ne show_hidden_texts 0
set_ne incr_hilight 1

View File

@ -365,3 +365,17 @@
## This option shows text objects even if they have attribute 'hide=true' set
## default: 0 (not set)
# set show_hidden_texts 1
###########################################################################
#### HIDE GRAPHS IF NO SPICE DATA LOADED
###########################################################################
## if enabled graphs will be hidden if no data is loaded.
## default: not enabled (0)
# set hide_empty_graphs 0
###########################################################################
#### SHOW HIDDEN TEXTS
###########################################################################
## if enabled will backannotate values in schematic at cursor 'b' position
## in graph. Default: not enabled (0)
# set live_cursor2_backannotate 1

View File

@ -1,4 +1,5 @@
v {xschem version=3.0.0 file_version=1.2 }
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=current_probe
format="@name @pinlist 0
@ -12,7 +13,8 @@ L 4 -7.5 0 -0 10 {}
L 4 -0 10 7.5 0 {}
B 5 -2.5 -32.5 2.5 -27.5 {name=plus dir=inout propag=1}
B 5 -2.5 27.5 2.5 32.5 {name=minus dir=inout propag=0}
T {@current} 10 2.5 0 0 0.2 0.2 {layer=15}
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 {tcleval(id=[ngspice::get_node [subst -nocommand \{i($\{path\}@name\\\\)\}]] )} 12.5 0 0 0 0.2 0.2 {layer=15
hide=true}

View File

@ -1,6 +1,6 @@
v {xschem version=2.9.8 file_version=1.2}
G {}
K {type=isource
K {type=source
format="@name @pinlist @function"
template="name=B1 function=\\"v=tanh(v(1))\\""
}

View File

@ -1,6 +1,6 @@
v {xschem version=2.9.8 file_version=1.2}
G {}
K {type=isource
K {type=source
format="@name @pinlist @VAR = @FUNC "
template="name=B1 VAR=I FUNC=\\"pwl(V(plus,minus),0,0, 1,10m, 2, 100m)\\""}
V {}

View File

@ -1,6 +1,6 @@
v {xschem version=2.9.8 file_version=1.2}
G {}
K {type=isource
K {type=vcr
format="@name @@p @@m @function @@cp @@cm @TABLE"
template="name=G1 function=\\"vcr pwl(1)\\" TABLE=\\"1 0 2 3\\""
}

View File

@ -1,4 +1,5 @@
v {xschem version=2.9.8 file_version=1.2}
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=vsource
format="@name @pinlist @value"
@ -16,3 +17,5 @@ T {@name} 20 -18.75 0 0 0.2 0.2 {}
T {@value} 20 -6.25 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 {tcleval(id=[ngspice::get_node [subst -nocommand \{i($\{path\}@name\\\\)\}]] )} 17.5 7.5 0 0 0.2 0.2 {layer=15
hide=true}

View File

@ -1,6 +1,7 @@
v {xschem version=2.9.8 file_version=1.2}
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=isource
K {type=vsource
format="@name @pinlist VOL=' @VOL '"
template="name=E1 VOL=cos(V(IN))"
}
@ -17,3 +18,5 @@ T {@VOL} 20 0 0 0 0.2 0.2 {}
T {@name} 20 -17.5 0 0 0.2 0.2 {}
T {@#0:net_name} 5 -42.5 0 0 0.15 0.15 {layer=15}
T {@#1:net_name} 5 32.5 0 0 0.15 0.15 {layer=15}
T {tcleval(id=[ngspice::get_node [subst -nocommand \{i($\{path\}@name\\\\)\}]] )} 12.5 15 0 0 0.2 0.2 {layer=15
hide=true}

View File

@ -1,6 +1,6 @@
v {xschem version=2.9.8 file_version=1.2}
G {}
K {type=isource
K {type=vsource
format="@name @@p @@m pwl(1) @@cp @@cm @TABLE"
template="name=E1 TABLE=\\"1 0 2 3\\""
}

View File

@ -12,8 +12,8 @@ y1=-47
y2=50
divy=4
subdivy=4
x1=0.00763563
x2=0.00893547
x1=0.00920343
x2=0.0124371
divx=8
subdivx=1
dataset=0
@ -30,8 +30,8 @@ y1=0.94
y2=160
divy=4
subdivy=9
x1=0.00763563
x2=0.00893547
x1=0.00920343
x2=0.0124371
divx=8
subdivx=9
dataset=0
@ -48,8 +48,8 @@ y1=-0.05
y2=150
divy=4
subdivy=9
x1=0.00763563
x2=0.00893547
x1=0.00920343
x2=0.0124371
divx=8
subdivx=9
dataset=0
@ -479,3 +479,7 @@ descr="View Raw file"
tclcommand="textwindow $netlist_dir/[file tail [file rootname [ xschem get schname 0 ] ] ].raw"
}
C {spice_probe.sym} 790 -600 0 0 {name=p60 analysis=tran voltage=-0.1364}
C {ngspice_get_expr.sym} 1300 -550 0 1 {name=r25
node="[ngspice::get_current v8]"
descr = current
}

View File

@ -23,8 +23,8 @@ B 2 260 -1080 720 -920 {flags=graph
y1 = 0
y2 = 0.93
divy = 5
x1=1.12193e-07
x2=4.32192e-07
x1=1.28193e-07
x2=4.48192e-07
divx=5
subdivx=4
unitx=n
@ -36,8 +36,8 @@ B 2 260 -1220 720 -1090 {flags=graph
y1 = 0.647319
y2 = 0.652563
divy = 5
x1=1.12193e-07
x2=4.32192e-07
x1=1.28193e-07
x2=4.48192e-07
unitx=n
divx=5
subdivx=4
@ -244,7 +244,8 @@ value="* .option SCALE=1e-6
reset
set appendwrite
end
save saout cal i(vvcc) en plus minus saoutf outdiff
* save saout cal i(vvcc) en plus minus saoutf outdiff
save all
tran 0.1n 900n uic
write autozero_comp.raw
let run = run + 1
@ -385,3 +386,22 @@ tclcommand="
xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw
"
}
C {ngspice_probe.sym} 890 -700 0 0 {name=r1}
C {ngspice_probe.sym} 660 -680 0 0 {name=r1}
C {ngspice_probe.sym} 380 -680 0 1 {name=r1}
C {ngspice_probe.sym} 1130 -640 0 0 {name=r1}
C {ngspice_probe.sym} 850 -640 0 1 {name=r2}
C {ngspice_probe.sym} 1000 -590 0 0 {name=r1}
C {ngspice_probe.sym} 1260 -710 0 0 {name=r1}
C {ngspice_probe.sym} 1600 -710 0 0 {name=r1}
C {ngspice_probe.sym} 2100 -710 0 0 {name=r1}
C {ngspice_probe.sym} 1610 -1390 0 0 {name=r1}
C {ngspice_probe.sym} 1920 -1260 0 0 {name=r1}
C {ngspice_probe.sym} 1430 -1260 0 0 {name=r1}
C {ngspice_probe.sym} 920 -1260 0 0 {name=r1}
C {ngspice_probe.sym} 1040 -860 0 0 {name=r1}
C {ngspice_probe.sym} 530 -860 0 0 {name=r1}
C {ngspice_probe.sym} 200 -570 0 0 {name=r1}
C {ngspice_probe.sym} 120 -570 0 1 {name=r1}
C {ngspice_probe.sym} 200 -700 0 0 {name=r1}
C {ngspice_probe.sym} 120 -470 0 0 {name=r1}