From 6adee35b89862f42b5f7285dfc14f67c3f4e569d Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 20 Jan 2025 23:03:33 +0100 Subject: [PATCH 1/4] update make_sym.awk to use a polyline instead of segments for the symbol box --- src/make_sym.awk | 13 +++++++------ xschem_library/examples/cmos_example.sch | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/make_sym.awk b/src/make_sym.awk index 93b0f940..e74d1617 100755 --- a/src/make_sym.awk +++ b/src/make_sym.awk @@ -236,14 +236,15 @@ function endfile(f) { y=-m*space x=-width print "T {@name}",-x-lwidth+5, y-space/2-8-lab_voffset,0,0,labsize, labsize,"{}" >sym - print "L 4 " (x+lwidth) ,y-space/2,(-x-lwidth) , y-space/2,"{}" >sym - print "L 4 " (x+lwidth) ,y+n*space-space/2,(-x-lwidth) , y+n*space-space/2,"{}" >sym - print "L 4 " (x+lwidth) ,y-space/2,(x+lwidth) , y+n*space-space/2,"{}" >sym - print "L 4 " (-x-lwidth) ,y-space/2,(-x-lwidth) , y+n*space-space/2,"{}" >sym - + print "P 4 5", \ + (-x-lwidth) ,y-space/2, \ + (x+lwidth) , y-space/2, \ + (x+lwidth), y+n*space-space/2, \ + (-x-lwidth), y+n*space-space/2, \ + (-x-lwidth) ,y-space/2, \ + "{}" > sym hsort_key(index_pin, y_pin, n_pin) # 20140519 - num_i = num_o = 0 #20140519 for(ii=0;ii Date: Tue, 21 Jan 2025 02:57:46 +0100 Subject: [PATCH 2/4] symbol_in_new_window(): if no symbol selected build file name for symbol of current schematic and open it in a new tab. If opening a non existing xxxx.sym file euristically set netlist_type to symbol. proc open_sub_schematic: if no symbol selected for subcircuit to open, open the corresponsing schematic of the symbol we are editing --- src/actions.c | 6 +++++- src/save.c | 10 ++++++++++ src/scheduler.c | 1 + src/xschem.tcl | 16 +++++++++++++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/actions.c b/src/actions.c index d64c0916..4c07a46f 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1604,7 +1604,11 @@ void symbol_in_new_window(int new_process) rebuild_selected_array(); if(xctx->lastsel !=1 || xctx->sel_array[0].type!=ELEMENT) { - my_strncpy(filename, xctx->sch[xctx->currsch], S(filename)); + if(tclgetboolvar("search_schematic")) { + my_strncpy(filename, abs_sym_path(xctx->current_name, ".sym"), S(filename)); + } else { + my_strncpy(filename, add_ext(xctx->sch[xctx->currsch], ".sym"), S(filename)); + } if(new_process) new_xschem_process(filename, 1); else new_schematic("create", NULL, filename, 1); } diff --git a/src/save.c b/src/save.c index c8adf632..0dda6daa 100644 --- a/src/save.c +++ b/src/save.c @@ -3523,6 +3523,8 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler } else fd=fopen(name,fopen_read_mode); if( fd == NULL) { + size_t len; + char *ptr; ret = 0; if(alert) { fprintf(errfp, "load_schematic(): unable to open file: %s, fname=%s\n", name, fname ); @@ -3531,6 +3533,14 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler tcleval(msg); } } + len = strlen(name); + ptr = strstr(name, ".sym"); + if(ptr && ptr - name == len - 4) { + xctx->save_netlist_type = xctx->netlist_type; + xctx->netlist_type = CAD_SYMBOL_ATTRS; + set_tcl_netlist_type(); + xctx->loaded_symbol = 1; + } clear_drawing(); if(reset_undo) set_modify(0); } else { diff --git a/src/scheduler.c b/src/scheduler.c index 691ca26a..08d6c033 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -4350,6 +4350,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg int e_b = xctx->rect[c][n].ellipse_b; save = xctx->draw_window; xctx->draw_window = 1; drawrect(xctx->rectcolor,NOW, x1,y1,x2,y2, 0, e_a, e_b); + filledrect(xctx->rectcolor, NOW, x1, y1, x2, y2, 1, -1, -1); xctx->draw_window = save; } set_modify(1); diff --git a/src/xschem.tcl b/src/xschem.tcl index 1593a828..ef71c0a4 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3818,9 +3818,19 @@ proc save_file_dialog { msg ext global_initdir {initialf {}} {overwrt 1} } { # opens indicated instance (or selected one) into a separate tab/window # keeping the hierarchy path, as it was descended into (as with 'e' key). proc open_sub_schematic {{inst {}} {inst_number 0}} { + global search_schematic set rawfile {} - set one_sel [expr {[xschem get lastsel] == 1}] - if { $inst eq {} && $one_sel} { + set n_sel [xschem get lastsel] + + if { $inst eq {} && $n_sel == 0} { + if {$search_schematic == 1} { + set f [abs_sym_path [xschem get current_name] {.sch}] + } else { + set f [file rootname [xschem get schname]].sch + } + xschem new_schematic create {} $f + return 1 + } elseif { $inst eq {} && $n_sel == 1} { set inst [lindex [xschem selected_set] 0] xschem unselect_all } else { @@ -7084,10 +7094,10 @@ proc tab_ctx_cmd {tab_but what} { } # puts $filename } + proc tab_context_menu {tab_but} { global retval search_schematic - # find filename associated with tab button set win_path [lindex [$tab_but cget -command] 3] ;# xschem new_schematic switch .x1.drw set tablist [xschem tab_list] ;# .drw filename0 .x1.drw filename1 ... From d47747965f2dfef550cbd8600db972548e0837a5 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 21 Jan 2025 03:45:42 +0100 Subject: [PATCH 3/4] updates in autozero_comp.sch --- xschem_library/ngspice/autozero_comp.sch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xschem_library/ngspice/autozero_comp.sch b/xschem_library/ngspice/autozero_comp.sch index 50073e61..564f7340 100644 --- a/xschem_library/ngspice/autozero_comp.sch +++ b/xschem_library/ngspice/autozero_comp.sch @@ -53,7 +53,7 @@ color="8 6" linewidth_mult=1.0 hilight_wave=-1 -dataset=188 +dataset=-1 rawfile=$netlist_dir/autozero_comp.raw sim_type=tran rainbow=0 @@ -136,7 +136,7 @@ saout 0.45" sweep="freq0 freq1 freq0" mode=HistoH -xlabmag=2.0} +xlabmag=1.3} B 2 270 -1610 680 -1450 {flags=graph,unlocked y1 = 0 y2 = 0.9 From 2b05b365e599e272feacd101cbefcf30fcab0cc4 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 21 Jan 2025 04:09:08 +0100 Subject: [PATCH 4/4] If opening a non existing xxxx.sym file euristically set netlist_type to symbol --> better implementation --- src/save.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/save.c b/src/save.c index 0dda6daa..4c4c4991 100644 --- a/src/save.c +++ b/src/save.c @@ -3524,7 +3524,6 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler else fd=fopen(name,fopen_read_mode); if( fd == NULL) { size_t len; - char *ptr; ret = 0; if(alert) { fprintf(errfp, "load_schematic(): unable to open file: %s, fname=%s\n", name, fname ); @@ -3534,8 +3533,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler } } len = strlen(name); - ptr = strstr(name, ".sym"); - if(ptr && ptr - name == len - 4) { + if(!strcmp(name + len - 4, ".sym")) { xctx->save_netlist_type = xctx->netlist_type; xctx->netlist_type = CAD_SYMBOL_ATTRS; set_tcl_netlist_type();