add option `keep_symbols in xschemrc to avoid purging symbols when netlisting /descending hierarchy. Add functions atan, asin,acos, cosh, sinh, atanh,acosh,asinh in wave processor

This commit is contained in:
stefan schippers 2024-02-24 13:15:43 +01:00
parent de2572e448
commit 203cf38e1e
8 changed files with 74 additions and 17 deletions

View File

@ -2246,7 +2246,7 @@ int descend_schematic(int instnumber, int fallback, int alert)
unselect_all(1);
dbg(1, "descend_schematic(): filename=%s\n", filename);
/* we are descending from a parent schematic downloaded from the web */
remove_symbols();
if(!tclgetboolvar("keep_symbols")) remove_symbols();
load_schematic(1, filename, 1, alert);
if(xctx->hilight_nets) {
prepare_netlist_structs(0);
@ -2293,7 +2293,7 @@ void go_back(int confirm) /* 20171006 add confirm */
}
if(save_ok==0) return;
unselect_all(1);
remove_symbols();
if(!tclgetboolvar("keep_symbols")) remove_symbols();
from_embedded_sym=0;
if(strstr(xctx->sch[xctx->currsch], ".xschem_embedded_")) {
/* when returning after editing an embedded symbol

View File

@ -1451,6 +1451,15 @@ static double ravg_store(int what , int i, int p, int last, double value)
#define DEL 27 /* delay by an anount of sweep axis distance */
#define MAX 28 /* clip data above given argument */
#define MIN 29 /* clip data below given argument */
#define ATAN 30
#define ASIN 31
#define ACOS 32
#define COSH 33
#define SINH 34
#define ATANH 35
#define ACOSH 36
#define ASINH 37
#define ORDER_DERIV 1 /* 1 or 2: 1st order or 2nd order differentiation. 1st order is faster */
@ -1499,13 +1508,21 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr, c
else if(!strcmp(n, "*")) stack1[stackptr1++].i = MULT;
else if(!strcmp(n, "/")) stack1[stackptr1++].i = DIVIS;
else if(!strcmp(n, "**")) stack1[stackptr1++].i = POW;
else if(!strcmp(n, "atan()")) stack1[stackptr1++].i = ATAN;
else if(!strcmp(n, "asin()")) stack1[stackptr1++].i = ASIN;
else if(!strcmp(n, "acos()")) stack1[stackptr1++].i = ACOS;
else if(!strcmp(n, "tan()")) stack1[stackptr1++].i = TAN;
else if(!strcmp(n, "sin()")) stack1[stackptr1++].i = SIN;
else if(!strcmp(n, "cos()")) stack1[stackptr1++].i = COS;
else if(!strcmp(n, "abs()")) stack1[stackptr1++].i = ABS;
else if(!strcmp(n, "sgn()")) stack1[stackptr1++].i = SGN;
else if(!strcmp(n, "sqrt()")) stack1[stackptr1++].i = SQRT;
else if(!strcmp(n, "tan()")) stack1[stackptr1++].i = TAN;
else if(!strcmp(n, "tanh()")) stack1[stackptr1++].i = TANH;
else if(!strcmp(n, "cosh()")) stack1[stackptr1++].i = COSH;
else if(!strcmp(n, "sinh()")) stack1[stackptr1++].i = SINH;
else if(!strcmp(n, "atanh()")) stack1[stackptr1++].i = ATANH;
else if(!strcmp(n, "acosh()")) stack1[stackptr1++].i = ACOSH;
else if(!strcmp(n, "asinh()")) stack1[stackptr1++].i = ASINH;
else if(!strcmp(n, "exp()")) stack1[stackptr1++].i = EXP;
else if(!strcmp(n, "ln()")) stack1[stackptr1++].i = LN;
else if(!strcmp(n, "log10()")) stack1[stackptr1++].i = LOG10;
@ -1809,18 +1826,48 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr, c
case SQRT:
stack2[stackptr2 - 1] = sqrt(stack2[stackptr2 - 1]);
break;
case TAN:
stack2[stackptr2 - 1] = tan(stack2[stackptr2 - 1]);
break;
case TANH:
stack2[stackptr2 - 1] = tanh(stack2[stackptr2 - 1]);
break;
case COSH:
stack2[stackptr2 - 1] = cosh(stack2[stackptr2 - 1]);
break;
case SINH:
stack2[stackptr2 - 1] = sinh(stack2[stackptr2 - 1]);
break;
case ATANH:
tmp = stack2[stackptr2 - 1];
tmp = 0.5 * log( (1 + tmp) / (1 - tmp) );
stack2[stackptr2 - 1] = tmp;
break;
case ACOSH:
tmp = stack2[stackptr2 - 1];
tmp = log(tmp + sqrt(tmp * tmp - 1));
stack2[stackptr2 - 1] = tmp;
break;
case ASINH:
tmp = stack2[stackptr2 - 1];
tmp = log(tmp + sqrt(tmp * tmp + 1));
stack2[stackptr2 - 1] = tmp;
break;
case TAN:
stack2[stackptr2 - 1] = tan(stack2[stackptr2 - 1]);
break;
case SIN:
stack2[stackptr2 - 1] = sin(stack2[stackptr2 - 1]);
break;
case COS:
stack2[stackptr2 - 1] = cos(stack2[stackptr2 - 1]);
break;
case ATAN:
stack2[stackptr2 - 1] = atan(stack2[stackptr2 - 1]);
break;
case ASIN:
stack2[stackptr2 - 1] = asin(stack2[stackptr2 - 1]);
break;
case ACOS:
stack2[stackptr2 - 1] = acos(stack2[stackptr2 - 1]);
break;
case ABS:
stack2[stackptr2 - 1] = fabs(stack2[stackptr2 - 1]);
break;

View File

@ -422,7 +422,8 @@ int global_spice_netlist(int global) /* netlister driver */
my_strdup2(_ALLOC_ID_, &current_dirname_save, xctx->current_dirname);
unselect_all(1);
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* ensure all unused symbols purged before descending hierarchy */
if(!tclgetboolvar("keep_symbols")) remove_symbols();
/* reload data without popping undo stack, this populates embedded symbols if any */
dbg(1, "global_spice_netlist(): invoking pop_undo(2, 0)\n");
xctx->pop_undo(2, 0);
@ -485,7 +486,7 @@ int global_spice_netlist(int global) /* netlister driver */
xctx->currsch--;
unselect_all(1);
dbg(1, "global_spice_netlist(): invoking pop_undo(0, 0)\n");
remove_symbols();
if(!tclgetboolvar("keep_symbols")) remove_symbols();
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
if(web_url) {

View File

@ -199,7 +199,8 @@ int global_tedax_netlist(int global) /* netlister driver */
char *current_dirname_save = NULL;
unselect_all(1);
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* ensure all unused symbols purged before descending hierarchy */
if(!tclgetboolvar("keep_symbols")) remove_symbols();
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
@ -243,7 +244,7 @@ int global_tedax_netlist(int global) /* netlister driver */
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]);
xctx->currsch--;
unselect_all(1);
remove_symbols();
if(!tclgetboolvar("keep_symbols")) remove_symbols();
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
if(web_url) {

View File

@ -149,7 +149,7 @@ int global_verilog_netlist(int global) /* netlister driver */
fprintf(fd,"module %s (\n", get_cell( xctx->sch[xctx->currsch], 0) );
/* flush data structures (remove unused symbols) */
unselect_all(1);
remove_symbols(); /* removed 25122002, readded 04112003 */
if(!tclgetboolvar("keep_symbols")) remove_symbols();
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
@ -316,7 +316,8 @@ int global_verilog_netlist(int global) /* netlister driver */
char *current_dirname_save = NULL;
unselect_all(1);
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* ensure all unused symbols purged before descending hierarchy */
if(!tclgetboolvar("keep_symbols")) remove_symbols();
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
@ -364,7 +365,7 @@ int global_verilog_netlist(int global) /* netlister driver */
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]);
xctx->currsch--;
unselect_all(1);
remove_symbols();
if(!tclgetboolvar("keep_symbols")) remove_symbols();
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
if(web_url) {

View File

@ -184,7 +184,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
/* flush data structures (remove unused symbols) */
unselect_all(1);
remove_symbols(); /* removed 25122002, readded 04112003.. this removes unused symbols */
if(!tclgetboolvar("keep_symbols")) remove_symbols();
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
@ -404,7 +404,8 @@ int global_vhdl_netlist(int global) /* netlister driver */
str_hash_init(&subckt_table, HASHSIZE);
unselect_all(1);
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* ensure all unused symbols purged before descending hierarchy */
if(!tclgetboolvar("keep_symbols")) remove_symbols();
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
@ -453,7 +454,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]);
xctx->currsch--;
unselect_all(1);
remove_symbols();
if(!tclgetboolvar("keep_symbols")) remove_symbols();
xctx->pop_undo(4, 0);
xctx->prev_set_modify = save_prev_mod;
if(web_url) {

View File

@ -6705,7 +6705,7 @@ set tctx::global_list {
graph_change_done graph_digital graph_linewidth_mult graph_logx
graph_logy graph_rainbow graph_schname graph_sel_color graph_sel_wave
graph_selected graph_sort graph_unlocked hide_empty_graphs hide_symbols tctx::hsize
incr_hilight incremental_select infowindow_text launcher_default_program
incr_hilight incremental_select infowindow_text keep_symbols launcher_default_program
light_colors line_width live_cursor2_backannotate local_netlist_dir lvs_ignore
lvs_netlist measure_text netlist_dir netlist_show netlist_type no_ask_save
no_change_attrs nolist_libs noprint_libs old_selected_tok only_probes path pathlist
@ -8165,6 +8165,8 @@ set_ne xschem_listen_port {}
# set a port number in xschemrc if you want xschem to be able to cross-probe to bespice
set_ne bespice_listen_port {}
set_ne keep_symbols 0 ;# if set loaded symbols will not be purged when descending/netlisting.
# hide instance details (show only bbox)
set_ne hide_symbols 0
# show net names if symbol has attributes like @#n:net_name (where n = pin number or pin name)

View File

@ -247,6 +247,10 @@
#### instead of looking only in symbol directory. Default: disabled (0).
# set search_schematic 0
#### keep symbols encountered while netlisting / descending the hierarchy.
#### Default: not enabled (0)
# set keep_symbols 0
#### focus the schematic window if mouse goes over it, even if a dialog box
#### is displayed, without needing to click.
#### This allows to move/zoom/pan the schematic while editing attributes.