From 37575e9404feb00d772a81fc0e25d0621ab1b0a6 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sun, 26 Dec 2021 04:09:55 +0100 Subject: [PATCH] allow button1 in addition to button2 for panning / zooming waveforms, add menu commands to insert graph, display/hide empty graphs, load raw file --- src/actions.c | 61 ++++++++-------- src/callback.c | 30 ++++---- src/draw.c | 28 ++++---- src/scheduler.c | 36 +++++++++- src/xschem.h | 2 +- src/xschem.tcl | 24 ++++--- tests/xschemtest.tcl | 3 +- xschem_library/rom8k/rom2_ctrl.sch | 24 ++++--- xschem_library/rom8k/rom8k.sch | 108 ++++++++++++----------------- 9 files changed, 173 insertions(+), 143 deletions(-) diff --git a/src/actions.c b/src/actions.c index f720148e..aaee51f0 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1251,7 +1251,7 @@ void change_to_unix_fn(char* fn) /* selected: 0 -> all, 1 -> selected, 2 -> hilighted */ void calc_drawing_bbox(xRect *boundbox, int selected) { - xRect tmp; + xRect rect; int c, i; int count=0; #if HAS_CAIRO==1 @@ -1264,16 +1264,19 @@ void calc_drawing_bbox(xRect *boundbox, int selected) boundbox->y2=100; if(selected != 2) for(c=0;clines[c];i++) { if(selected == 1 && !xctx->line[c][i].sel) continue; - tmp.x1=xctx->line[c][i].x1; - tmp.x2=xctx->line[c][i].x2; - tmp.y1=xctx->line[c][i].y1; - tmp.y2=xctx->line[c][i].y2; + rect.x1=xctx->line[c][i].x1; + rect.x2=xctx->line[c][i].x2; + rect.y1=xctx->line[c][i].y1; + rect.y2=xctx->line[c][i].y2; count++; - updatebbox(count,boundbox,&tmp); + updatebbox(count,boundbox,&rect); } for(i=0;ipolygons[c];i++) @@ -1289,32 +1292,32 @@ void calc_drawing_bbox(xRect *boundbox, int selected) if(k==0 || xctx->poly[c][i].x[k] > x2) x2 = xctx->poly[c][i].x[k]; if(k==0 || xctx->poly[c][i].y[k] > y2) y2 = xctx->poly[c][i].y[k]; } - tmp.x1=x1;tmp.y1=y1;tmp.x2=x2;tmp.y2=y2; - updatebbox(count,boundbox,&tmp); + rect.x1=x1;rect.y1=y1;rect.x2=x2;rect.y2=y2; + updatebbox(count,boundbox,&rect); } for(i=0;iarcs[c];i++) { if(selected == 1 && !xctx->arc[c][i].sel) continue; arc_bbox(xctx->arc[c][i].x, xctx->arc[c][i].y, xctx->arc[c][i].r, xctx->arc[c][i].a, xctx->arc[c][i].b, - &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2); + &rect.x1, &rect.y1, &rect.x2, &rect.y2); count++; - updatebbox(count,boundbox,&tmp); + updatebbox(count,boundbox,&rect); } for(i=0;irects[c];i++) { if(selected == 1 && !xctx->rect[c][i].sel) continue; /* skip graph objects if no datafile loaded */ - if(c == 2 && xctx->rect[c][i].flags == 1) { - if(!waves) continue; + if(c == GRIDLAYER && xctx->rect[c][i].flags == 1) { + if(hide_graphs && !waves) continue; } - tmp.x1=xctx->rect[c][i].x1; - tmp.x2=xctx->rect[c][i].x2; - tmp.y1=xctx->rect[c][i].y1; - tmp.y2=xctx->rect[c][i].y2; + rect.x1=xctx->rect[c][i].x1; + rect.x2=xctx->rect[c][i].x2; + rect.y1=xctx->rect[c][i].y1; + rect.y2=xctx->rect[c][i].y2; count++; - updatebbox(count,boundbox,&tmp); + updatebbox(count,boundbox,&rect); } } if(selected == 2 && xctx->hilight_nets) prepare_netlist_structs(0); @@ -1339,12 +1342,12 @@ void calc_drawing_bbox(xRect *boundbox, int selected) if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; } else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; } } - tmp.x1 = xctx->wire[i].x1-ov; - tmp.x2 = xctx->wire[i].x2+ov; - tmp.y1 = y1; - tmp.y2 = y2; + rect.x1 = xctx->wire[i].x1-ov; + rect.x2 = xctx->wire[i].x2+ov; + rect.y1 = y1; + rect.y2 = y2; count++; - updatebbox(count,boundbox,&tmp); + updatebbox(count,boundbox,&rect); } if(has_x && selected != 2) for(i=0;itexts;i++) { @@ -1357,9 +1360,9 @@ void calc_drawing_bbox(xRect *boundbox, int selected) xctx->text[i].yscale,xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].x0, xctx->text[i].y0, - &tmp.x1,&tmp.y1, &tmp.x2,&tmp.y2, &no_of_lines, &longest_line) ) { + &rect.x1,&rect.y1, &rect.x2,&rect.y2, &no_of_lines, &longest_line) ) { count++; - updatebbox(count,boundbox,&tmp); + updatebbox(count,boundbox,&rect); } #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); @@ -1388,12 +1391,12 @@ void calc_drawing_bbox(xRect *boundbox, int selected) /* cpu hog 20171206 */ /* symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2); */ - tmp.x1=xctx->inst[i].x1; - tmp.y1=xctx->inst[i].y1; - tmp.x2=xctx->inst[i].x2; - tmp.y2=xctx->inst[i].y2; + rect.x1=xctx->inst[i].x1; + rect.y1=xctx->inst[i].y1; + rect.x2=xctx->inst[i].x2; + rect.y2=xctx->inst[i].y2; count++; - updatebbox(count,boundbox,&tmp); + updatebbox(count,boundbox,&rect); } } diff --git a/src/callback.c b/src/callback.c index 8a16a9d3..1acb8b67 100644 --- a/src/callback.c +++ b/src/callback.c @@ -215,7 +215,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int cy = (y1 - y2) / (wy2 - wy1); dbg(1, "%g %g %g %g - %d %d\n", wx1, wy1, wx2, wy2, divx, divy); } - if(event == MotionNotify && (state & Button2Mask)) { + if(event == MotionNotify && (state & (Button2Mask | Button1Mask))) { double delta; if(xctx->mousex_snap < W_X(wx1)) { delta = (wy2 - wy1) / divy; @@ -269,9 +269,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int xx1 = wx1 - delta * delta_threshold; xx2 = wx2 - delta * delta_threshold; my_snprintf(s, S(s), "%g", xx1); - my_strdup(1395, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x1", s)); + my_strdup(1428, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x1", s)); my_snprintf(s, S(s), "%g", xx2); - my_strdup(1396, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s)); + my_strdup(1429, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s)); } need_redraw = 1; } @@ -327,16 +327,16 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta = (wy2 - wy1); yy2 = wy2 - delta * 0.1; my_snprintf(s, S(s), "%g", yy2); - my_strdup(1418, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y2", s)); + my_strdup(1439, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y2", s)); } else { delta = (wx2 - wx1) / divx; delta_threshold = 1.0; xx1 = wx1 + delta * delta_threshold; xx2 = wx2 + delta * delta_threshold; my_snprintf(s, S(s), "%g", xx1); - my_strdup(1397, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x1", s)); + my_strdup(1430, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x1", s)); my_snprintf(s, S(s), "%g", xx2); - my_strdup(1398, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s)); + my_strdup(1431, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s)); } need_redraw = 1; } @@ -346,12 +346,12 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta = (wy2 - wy1); yy2 = wy2 + delta * 0.1; my_snprintf(s, S(s), "%g", yy2); - my_strdup(1419, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y2", s)); + my_strdup(1432, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y2", s)); } else { delta = (wx2 - wx1); xx2 = wx2 + delta * 0.1; my_snprintf(s, S(s), "%g", xx2); - my_strdup(1399, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s)); + my_strdup(1433, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s)); } need_redraw = 1; } @@ -364,9 +364,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int yy1 = wy1 - delta * delta_threshold; yy2 = wy2 - delta * delta_threshold; my_snprintf(s, S(s), "%g", yy1); - my_strdup(1420, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y1", s)); + my_strdup(1434, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y1", s)); my_snprintf(s, S(s), "%g", yy2); - my_strdup(1421, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y2", s)); + my_strdup(1435, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y2", s)); } else { delta = (wx2 - wx1); xx2 = wx2 + delta * 0.1; @@ -386,7 +386,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta = (wx2 - wx1); xx2 = wx2 - delta * 0.1; my_snprintf(s, S(s), "%g", xx2); - my_strdup(1400, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s)); + my_strdup(1436, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s)); } need_redraw = 1; } @@ -399,9 +399,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int yy1 = wy1 + delta * delta_threshold; yy2 = wy2 + delta * delta_threshold; my_snprintf(s, S(s), "%g", yy1); - my_strdup(1416, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y1", s)); + my_strdup(1437, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y1", s)); my_snprintf(s, S(s), "%g", yy2); - my_strdup(1417, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y2", s)); + my_strdup(1438, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y2", s)); } else { delta = (wx2 - wx1); xx2 = wx2 - delta * 0.1; @@ -451,13 +451,13 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int need_redraw = 1; } } - else if(event == ButtonPress && button == Button2) { + else if(event == ButtonPress && (button == Button2 || button == Button1)) { xctx->mx_double_save = xctx->mousex_snap; xctx->my_double_save = xctx->mousey_snap; } } - if(need_redraw) draw_graph(c, n, 3); /* draw data in each graph box */ + if(need_redraw) draw_graph(c, n, 1); /* draw data in each graph box */ } draw_selection(xctx->gc[SELLAYER], 0); diff --git a/src/draw.c b/src/draw.c index 1fd81e29..dee6d562 100644 --- a/src/draw.c +++ b/src/draw.c @@ -1651,6 +1651,7 @@ int read_rawfile(const char *f) dbg(0, "read_rawfile(): failed to open file %s for reading\n", f); return 0; } + int get_raw_index(const char *node) { struct int_hashentry *entry; @@ -1817,7 +1818,7 @@ void draw_graph(int c, int i, int flags) char tmpstr[200]; char *saven, *savec, *saves, *nptr, *cptr, *sptr, *ntok, *ctok, *stok; int wcnt = 0; - int dataset = -1; + int dataset = -1; /* container (embedding rectangle) coordinates */ rx1 = r->x1; ry1 = r->y1; @@ -1882,9 +1883,7 @@ void draw_graph(int c, int i, int flags) txtsizelab = marginy / 100; /* background */ - if((flags & 2) ) { - filledrect(0, NOW, rx1, ry1, rx2, ry2); - } + filledrect(0, NOW, rx1, ry1, rx2, ry2); /* graph bounding box */ drawrect(c, NOW, rx1, ry1, rx2, ry2, 2); @@ -1939,7 +1938,7 @@ void draw_graph(int c, int i, int flags) * swap order of wy1 and wy2 since grap y orientation is opposite to xorg orientation */ if(wx1 <= 0 && wx2 >= 0) drawline(2, ADD, W_X(0), W_Y(wy2), W_X(0), W_Y(wy1), 0); drawline(2, END, 0.0, 0.0, 0.0, 0.0, 0); - /* if simulation data is loaded and matches schematic draw data */ + /* get data to plot */ my_strdup2(1389, &node, get_tok_value(r->prop_ptr,"node",0)); my_strdup2(1390, &color, get_tok_value(r->prop_ptr,"color",0)); my_strdup2(1407, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); @@ -1960,8 +1959,8 @@ void draw_graph(int c, int i, int flags) } /* draw sweep variable(s) on x-axis */ if(wcnt == 0 || (stok && stok[0])) { - if(unitx != 1.0) my_snprintf(tmpstr, S(tmpstr), "%s[%c]", xctx->names[sweep_idx], unitx_suffix); - else my_snprintf(tmpstr, S(tmpstr), "%s", xctx->names[sweep_idx]); + if(unitx != 1.0) my_snprintf(tmpstr, S(tmpstr), "%s[%c]", stok ? stok : "" , unitx_suffix); + else my_snprintf(tmpstr, S(tmpstr), "%s", stok ? stok : ""); draw_string(wave_color, NOW, tmpstr, 2, 1, 0, 0, rx1 + 2 + rw/n_nodes * wcnt, ry2-1, txtsizelab, txtsizelab); } @@ -1972,7 +1971,7 @@ void draw_graph(int c, int i, int flags) /* clipping everything outside graph area */ /* quickly find index number of ntok variable to be plotted */ entry = int_hash_lookup(xctx->raw_table, ntok, 0, XLOOKUP); - if(entry) { + if(xctx->values && entry) { int p, dset, ofs; int poly_npoints; int v; @@ -2059,15 +2058,18 @@ void draw_graph(int c, int i, int flags) * 1: do final XCopyArea (copy 2nd buffer areas to screen) * If draw_waves() is called from draw() no need to do XCopyArea, as draw() does it already. * This makes drawing faster and removes a 'tearing' effect when moving around. - * 2: do not draw background (when called from draw() this is already done) */ void draw_waves(int flags) { - int c, i; + int c, i, sch_loaded, hide_graphs; int bbox_set = 0; + const char *tmp; int save_bbx1, save_bby1, save_bbx2, save_bby2; /* save bbox data, since draw_waves() is called from draw() which may be called after a bbox(SET) */ - if(schematic_waves_loaded()) { + sch_loaded = schematic_waves_loaded(); + tmp = tclgetvar("hide_empty_graphs"); + hide_graphs = (tmp && tmp[0] == '1') ? 1 : 0; + if(sch_loaded || !hide_graphs) { if(xctx->sem) { bbox_set = 1; save_bbx1 = xctx->bbx1; @@ -2082,7 +2084,7 @@ void draw_waves(int flags) cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); #endif - c = 2; /* only rectangles on layer 2 (GRID) can embed graphs */ + c = GRIDLAYER; /* only rectangles on layer 2 (GRID) can embed graphs */ if(xctx->draw_single_layer==-1 || c == xctx->draw_single_layer) { if(xctx->enable_layer[c]) for(i = 0; i < xctx->rects[c]; i++) { xRect *r = &xctx->rect[c][i]; @@ -2155,7 +2157,7 @@ void draw(void) } if(xctx->enable_layer[c]) for(i=0;irects[c];i++) { xRect *r = &xctx->rect[c][i]; - if(c != 2 || r->flags != 1 ) { + if(c != GRIDLAYER || r->flags != 1 ) { drawrect(c, ADD, r->x1, r->y1, r->x2, r->y2, r->dash); filledrect(c, ADD, r->x1, r->y1, r->x2, r->y2); } diff --git a/src/scheduler.c b/src/scheduler.c index db1f71b5..2e541164 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -298,7 +298,34 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg xctx->ui_state |= START_SYMPIN; Tcl_ResetResult(interp); } - + + if(!strcmp(argv[1],"add_graph")) + { + cmd_found = 1; + unselect_all(); + storeobject(-1, xctx->mousex_snap-400, xctx->mousey_snap-200, xctx->mousex_snap+400, xctx->mousey_snap+200, + xRECT, GRIDLAYER, SELECTED, + "flags=1\n" + "y1=0\n" + "y2=5\n" + "divy=4\n" + "subdivy=1\n" + "x1=0\n" + "x2=10e-6\n" + "divx=8\n" + "subdivx=1\n" + "node=\"v(a) v(b) v(c)\"\n" + "color=\"7 8 10 11 12 13 14 15 16 17\"\n" + "dataset=0\n" + "unitx=u\n" + ); + xctx->need_reb_sel_arr=1; + rebuild_selected_array(); + move_objects(START,0,0,0); + xctx->ui_state |= START_SYMPIN; + Tcl_ResetResult(interp); + } + else if(!strcmp(argv[1],"align")) { cmd_found = 1; @@ -1936,6 +1963,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(!strcmp(argv[1], "raw_clear")) { cmd_found = 1; + tclsetvar("rawfile_loaded", "0"); free_rawfile(); Tcl_ResetResult(interp); } @@ -1947,7 +1975,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg int dataset = 0; cmd_found = 1; Tcl_ResetResult(interp); - if(xctx->values) { + if(argc > 2 && !strcmp(argv[2], "loaded")) { + Tcl_AppendResult(interp, schematic_waves_loaded() ? "1" : "0", NULL); + } else if(xctx->values) { if(argc > 5) dataset = atoi(argv[5]); if(argc > 4) { /* xschem rawfile_query value v(ldcp) 123 */ @@ -2005,6 +2035,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } else if(argc > 2) { free_rawfile(); read_rawfile(argv[2]); + if(schematic_waves_loaded()) tclsetvar("rawfile_loaded", "1"); + else tclsetvar("rawfile_loaded", "0"); } Tcl_ResetResult(interp); } diff --git a/src/xschem.h b/src/xschem.h index 4f841584..c9b17806 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -679,7 +679,7 @@ typedef struct { /* bbox */ int bbx1, bbx2, bby1, bby2; int savew, saveh, savex1, savex2, savey1, savey2; - int sem; + int sem; /* set to 1 if a clipping bbox is set (void bbox() ) */ XRectangle savexrect; /* new_prop_string */ char prefix; diff --git a/src/xschem.tcl b/src/xschem.tcl index a487a637..28e722ba 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -20,7 +20,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -### INUTILE integration +### INUTILE integration (spice stimuli generator from a higher level description language) proc inutile_line {txtlabel} { global retval toplevel .inutile_line -class Dialog @@ -3805,15 +3805,16 @@ 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 hide_symbols hsize hspice_netlist + flat_netlist fullscreen gaw_fd gaw_tcp_address globfilter hide_empty_graphs hide_symbols hsize hspice_netlist incr_hilight infowindow_text INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR 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_retval myload_sash_pos myload_sel myload_type myload_yview netlist_dir netlist_show 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 - 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 + rawfile_loaded 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 spiceprefix split_files svg_colors svg_font_name symbol symbol_width sym_txt tclcmd_txt text_line_default_geometry textwindow_fileid textwindow_filename textwindow_w tmp_bus_char toolbar_horiz toolbar_visible top_subckt transparent_svg undo_type @@ -4443,6 +4444,13 @@ proc build_widgets { {topwin {} } } { -command {edit_netlist [file tail [xschem get schname]]} $topwin.menubar.simulation.menu add command -label {Send highlighted nets to viewer} \ -command {xschem create_plot_cmd} -accelerator Shift+J + $topwin.menubar.simulation.menu add checkbutton -label "Hide graphs if no spice data loaded" \ + -variable hide_empty_graphs -command {xschem redraw} + $topwin.menubar.simulation.menu add checkbutton -variable rawfile_loaded \ + -label {Load/Unload ngspice .raw file} -command { + 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 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 \ @@ -4701,6 +4709,7 @@ set_ne local_netlist_dir 0 ;# if set use /simulation for netlist and si set_ne bus_replacement_char {} ;# use {<>} to replace [] with <> in bussed signals set_ne hspice_netlist 1 set_ne top_subckt 0 +set_ne hide_empty_graphs 0 ;# if set to 1 waveform boxes will be hidden if no raw file loaded set_ne spiceprefix 1 set_ne verilog_2001 1 set_ne split_files 0 @@ -4766,10 +4775,6 @@ set_ne show_pin_net_names 0 # gaw tcp {host port} set_ne gaw_tcp_address {localhost 2020} -## utile -set_ne utile_gui_path "${XSCHEM_SHAREDIR}/utile/utile3" -set_ne utile_cmd_path "${XSCHEM_SHAREDIR}/utile/utile" - ## cairo stuff 20171112 set_ne cairo_font_scale 1.0 set_ne nocairo_font_xscale .85 @@ -4857,7 +4862,8 @@ if {$OS == "Windows"} { } else { set filetmp [pwd]/.tmp2 } -# /20111106 + +set rawfile_loaded 0 # flag bound to a checkbutton in symbol editprop form # if set cell is copied when renaming it diff --git a/tests/xschemtest.tcl b/tests/xschemtest.tcl index 944b9319..9f92da74 100644 --- a/tests/xschemtest.tcl +++ b/tests/xschemtest.tcl @@ -18,7 +18,8 @@ ## move schematic and redraw in a loop. proc draw_test {{filelist {-}}} { - global show_pin_net_names + global show_pin_net_names hide_empty_graphs + set hide_empty_graphs 1 set show_pin_net_names 1 foreach f $filelist { if { $f ne {-}} { diff --git a/xschem_library/rom8k/rom2_ctrl.sch b/xschem_library/rom8k/rom2_ctrl.sch index 71470ba2..7b242992 100644 --- a/xschem_library/rom8k/rom2_ctrl.sch +++ b/xschem_library/rom8k/rom2_ctrl.sch @@ -8,28 +8,34 @@ B 2 580 -140 1200 -30 {flags=1 y1 = 0 y2 = 2 divy = 2 -x1=1.4e-07 -x2=1.8e-07 +x1=1.11978e-07 +x2=2.09815e-07 divx=8 -node="v(ldcp) v(xctrl.ldcp_ref) v(xctrl.ldprechref)" +comm="example of using tcl to replace the path + with $path variable automatically" +node="tcleval(v($\{path\}ldcp_ref) v($\{path\}ldprechref))" color=12\\ 5\\ 13} B 2 580 -230 1200 -140 {flags=1 y1 = 0 y2 = 2 divy = 2 -x1=1.4e-07 -x2=1.8e-07 +x1=1.36438e-07 +x2=2.34275e-07 divx=8 -node="v(ldcp) v(xctrl.ldcpb)" +comm="example of using tcl to replace the path + with $path variable automatically" +node="tcleval(v($\{path\}ldcp_ref) v($\{path\}ldcpb))" color=12\\ 5\\ 8} B 2 580 -320 1200 -230 {flags=1 y1 = 0 y2 = 2 divy = 2 -x1=1.4e-07 -x2=1.8e-07 +x1=1.11978e-07 +x2=2.09815e-07 divx=8 -node="v(ldcp) v(xctrl.ldouti) v(xctrl.ldoutib)" +comm="example of using tcl to replace the path + with $path variable automatically" +node="tcleval(v($\{path\}ldcp_ref) v($\{path\}ldouti) v($\{path\}ldoutib))" color=12\\ 5\\ 8} N 370 -560 510 -560 {lab=LDCPB} N 250 -650 260 -650 {lab=LDCPB} diff --git a/xschem_library/rom8k/rom8k.sch b/xschem_library/rom8k/rom8k.sch index 09f8f285..5b246818 100644 --- a/xschem_library/rom8k/rom8k.sch +++ b/xschem_library/rom8k/rom8k.sch @@ -27,135 +27,115 @@ L 8 1150 -160 1180 -160 {} L 8 1180 -160 1180 -120 {} L 8 1180 -120 1300 -120 {} L 8 820 -120 950 -120 {} -B 2 1860 -1180 3010 -1100 {flags=1 +B 2 1860 -890 3010 -810 {flags=1 y1 = 0 y2 = 1 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node=" v(ldbl[0]) v(ldbl[16]) v(ldbl[32]) v(ldbl[1]) v(ldbl[17]) v(ldbl[33]) v(ldbl[2]) v(ldbl[18]) v(ldbl[34]) " color="8 9 10 11 12 13 14 15 16 17 18" unitx=n} -B 2 1860 -1090 3010 -1010 {flags=1 +B 2 1860 -810 3010 -730 {flags=1 y1 = 0 y2 = 1.5 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node=" v(ldl1x[0]) v(ldl1x[1]) v(ldl1x[2]) v(ldl1x[3]) " color="6 7 8 9 10 11 12 13" unitx=n} -B 2 1860 -1000 3010 -920 {flags=1 -y1 = 0 -y2 = 1.5 -divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 -node="v(lda[3])" -color=12 unitx=n subdivy=2} -B 2 1860 -1490 3010 -1280 {flags=1 +B 2 1860 -1180 3010 -970 {flags=1 y1 = 0 y2 = 2 divy = 4 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(ldcp) v(ldyms[4]) v(ldyms[5]) v(ldyms[6]) v(ldyms[7])" color=6\\ 12\\ 13\\ 14\\ 15 unitx=n} -B 2 1860 -910 3010 -830 {flags=1 -y1 = 0 -y2 = 1.5 -subdivy=2 -divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 -node="v(ldl1x[0])" -color=4 unitx=n} -B 2 1860 -730 3010 -650 {flags=1 +B 2 1860 -490 3010 -410 {flags=1 y1 = 0 y2 = 1.6 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(ldprech)" color=4 unitx=n subdivy=2} -B 2 1860 -640 3010 -560 {flags=1 +B 2 1860 -410 3010 -330 {flags=1 y1 = 0 y2 = 1.5 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(lden) v(ldcp)" color=12\\ 18 unitx=n subdivy=2} -B 2 1860 -550 3010 -470 {flags=1 +B 2 1860 -730 3010 -570 {flags=1 y1 = 0 -y2 = 1.6 -divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +y2 = 1.5 +divy = 3 +subdivy=1 +subdivx = 1 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node=" +v(ldcp) v(ldwl[0]) v(ldwl[1]) v(ldwl[2]) v(ldwl[3]) v(ldwl[4]) v(ldwl[5]) v(ldwl[6]) v(ldwl[8]) v(ldwl[7])" -color=12\\ 15\\ 16\\ 17\\ 18\\ 19\\ 11\\ 7\\ 4 unitx=n subdivy=2} -B 2 1860 -460 3010 -380 {flags=1 +color="12 15 16 17 18 19 11 7 4 8" +unitx=n +} +B 2 1860 -330 3010 -250 {flags=1 y1 = 0 y2 = 1 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(ldymsref)" color=3 unitx=n subdivy=4} -B 2 1860 -370 3010 -290 {flags=1 +B 2 1860 -250 3010 -170 {flags=1 y1 = 0 y2 = 1.5 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 -node="v(ldoe)" -color=4 unitx=n subdivy=2} -B 2 1860 -280 3010 -200 {flags=1 -y1 = 0 -y2 = 1.5 -divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(lden)" color=4 unitx=n subdivy=2} -B 2 1860 -190 3010 -110 {flags=1 +B 2 1860 -170 3010 -90 {flags=1 y1 = 0 y2 = 1.5 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(lden) v(ldprech)" color=12\\ 16 unitx=n subdivy=2} -B 2 1860 -100 3010 -20 {flags=1 +B 2 1860 -90 3010 -10 {flags=1 y1 = 0 y2 = 1.5 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(lden) v(ldcp)" color=12\\ 5 unitx=n subdivy=2} -B 2 1860 -820 3010 -740 {flags=1 +B 2 1860 -570 3010 -490 {flags=1 y1 = 0 y2 = 1.6 divy = 1 subdivy=2 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(ldl1x[1])" color=4 unitx=n} -B 2 1860 -1270 3010 -1190 {flags=1 +B 2 1860 -970 3010 -890 {flags=1 y1 = 0 y2 = 1.5 divy = 1 -x1=1.18117e-07 -x2=2.27926e-07 divx=10 +x1=1.25369e-07 +x2=2.02265e-07 divx=10 node="v(lden) v(ldprech)" color=4\\ 6 unitx=n} B 7 950 -250 980 -80 {}