added operator "cph()" to transform discontinuous phase ph(xxx) in AC analyses to aontinuous phase, like ngspice cph() function. Usage: instead of ph(out) use "ph(out) cph()"
This commit is contained in:
parent
fa699fe2f1
commit
8de9004468
13
src/save.c
13
src/save.c
|
|
@ -1557,6 +1557,7 @@ static double ravg_store(int what , int i, int p, int last, double value)
|
|||
#define GE 45
|
||||
#define LE 46
|
||||
#define COND 47 /* conditional expression: X cond Y ? --> X if conf == 1 else Y */
|
||||
#define CPH 48 /* continuous phase. Instead of -180..+180 avoid discontinuities */
|
||||
|
||||
|
||||
#define ORDER_DERIV 1 /* 1 or 2: 1st order or 2nd order differentiation. 1st order is faster */
|
||||
|
|
@ -1614,6 +1615,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr, c
|
|||
else if(!strcmp(n, "**")) stack1[stackptr1++].i = POW;
|
||||
else if(!strcmp(n, "?")) stack1[stackptr1++].i = COND; /* conditional expression */
|
||||
else if(!strcmp(n, "atan()")) stack1[stackptr1++].i = ATAN;
|
||||
else if(!strcmp(n, "cph()")) stack1[stackptr1++].i = CPH;
|
||||
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;
|
||||
|
|
@ -1970,6 +1972,17 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr, c
|
|||
stack1[i].prev = stack2[stackptr2 - 1];
|
||||
stack2[stackptr2 - 1] = result;
|
||||
break;
|
||||
case CPH:
|
||||
if(p == first) {
|
||||
result = stack2[stackptr2 - 1];
|
||||
} else {
|
||||
double ph = stack2[stackptr2 - 1];
|
||||
double prev_ph = stack1[i].prev;
|
||||
result = ph - (360.) * floor((ph - prev_ph)/(360.) + 0.5);
|
||||
}
|
||||
stack1[i].prev = result;
|
||||
stack2[stackptr2 - 1] = result;
|
||||
break;
|
||||
case SQRT:
|
||||
stack2[stackptr2 - 1] = sqrt(stack2[stackptr2 - 1]);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
v {xschem version=3.4.4 file_version=1.2
|
||||
v {xschem version=3.4.6RC file_version=1.2
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
|
|
@ -25,10 +25,11 @@ spice_ignore=true
|
|||
verilog_ignore=true
|
||||
tedax_ignore=true
|
||||
vhdl_ignore=true
|
||||
template=" nothing here, use global schematic properties "}
|
||||
template="code=ARCHITECTURE
|
||||
\\"Use global schematic properties for code\\""}
|
||||
V {}
|
||||
S {}
|
||||
E {}
|
||||
L 4 0 -10 355 -10 {}
|
||||
T {ARCHITECTURE} 5 -30 0 0 0.3 0.3 {}
|
||||
T {@code} 5 -30 0 0 0.3 0.3 {}
|
||||
T {@schprop@schverilogprop@schvhdlprop@schsymbolprop} 45 5 0 0 0.3 0.3 {font=monospace layer=8}
|
||||
|
|
|
|||
Loading…
Reference in New Issue