From 69ccefe09259201da9e0ba5e095c50d7c73406f5 Mon Sep 17 00:00:00 2001 From: dwarning Date: Sun, 12 Feb 2023 08:35:29 +0100 Subject: [PATCH 1/4] ret variable only used for openMP enabled --- src/osdi/osdiload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osdi/osdiload.c b/src/osdi/osdiload.c index 6612323d4..43d20a05d 100644 --- a/src/osdi/osdiload.c +++ b/src/osdi/osdiload.c @@ -174,13 +174,13 @@ extern int OSDIload(GENmodel *inModel, CKTcircuit *ckt) { sim_info.flags |= CALC_NOISE | ANALYSIS_NOISE; } - int ret = OK; - OsdiRegistryEntry *entry = osdi_reg_entry_model(inModel); const OsdiDescriptor *descr = entry->descriptor; uint32_t eval_flags = 0; #ifdef USE_OMP + int ret = OK; + /* use openmp 3.0 tasks to parallelize linked list transveral */ #pragma omp parallel #pragma omp single From 6726489f4a8006361057d141504c6a9eaeff0ff1 Mon Sep 17 00:00:00 2001 From: dwarning Date: Wed, 15 Feb 2023 15:24:55 +0100 Subject: [PATCH 2/4] correct fft dc scaling bug #620 --- src/frontend/com_fft.c | 6 ++++-- src/maths/cmaths/cmath4.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/frontend/com_fft.c b/src/frontend/com_fft.c index 0dc42ddc6..2d592525b 100644 --- a/src/frontend/com_fft.c +++ b/src/frontend/com_fft.c @@ -179,7 +179,9 @@ com_fft(wordlist *wl) fftw_execute(plan_forward); scale = (double) fpts - 1.0; - for (j = 0; j < fpts; j++) { + fdvec[i][0].cx_real = out[0][0]/scale/2.0; + fdvec[i][0].cx_imag = 0.0; + for (j = 1; j < fpts; j++) { fdvec[i][j].cx_real = out[j][0]/scale; fdvec[i][j].cx_imag = out[j][1]/scale; } @@ -212,7 +214,7 @@ com_fft(wordlist *wl) scale = (double) fpts - 1.0; /* Re(x[0]), Re(x[N/2]), Re(x[1]), Im(x[1]), Re(x[2]), Im(x[2]), ... Re(x[N/2-1]), Im(x[N/2-1]). */ - fdvec[i][0].cx_real = in[0]/scale; + fdvec[i][0].cx_real = in[0]/scale/2.0; fdvec[i][0].cx_imag = 0.0; for (j = 1; j < fpts-1; j++) { fdvec[i][j].cx_real = in[2*j]/scale; diff --git a/src/maths/cmaths/cmath4.c b/src/maths/cmaths/cmath4.c index b3dd42f9a..11d7bf8f7 100644 --- a/src/maths/cmaths/cmath4.c +++ b/src/maths/cmaths/cmath4.c @@ -713,7 +713,9 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp outdata = alloc_c(fpts); scale = (double) fpts; - for (i = 0; i < fpts; i++) { + outdata[0].cx_real = out[0][0]/scale/2.0; + outdata[0].cx_imag = out[0][1]/scale/2.0; + for (i = 1; i < fpts; i++) { outdata[i].cx_real = out[i][0]/scale; outdata[i].cx_imag = out[i][1]/scale; } @@ -744,7 +746,9 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp outdata = alloc_c(N); scale = (double) N; - for (i = 0; i < N; i++) { + outdata[0].cx_real = datax[0]/scale/2.0; + outdata[0].cx_imag = datax[1]/scale/2.0; + for (i = 1; i < N; i++) { outdata[i].cx_real = datax[2*i]/scale; outdata[i].cx_imag = datax[2*i+1]/scale; } @@ -773,7 +777,9 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp fftw_execute(plan_forward); scale = (double) fpts - 1.0; - for (i = 0; i < fpts; i++) { + outdata[0].cx_real = out[0][0]/scale/2.0; + outdata[0].cx_imag = 0.0; + for (i = 1; i < fpts; i++) { outdata[i].cx_real = out[i][0]/scale; outdata[i].cx_imag = out[i][1]/scale; } @@ -798,7 +804,7 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp scale = (double) fpts - 1.0; /* Re(x[0]), Re(x[N/2]), Re(x[1]), Im(x[1]), Re(x[2]), Im(x[2]), ... Re(x[N/2-1]), Im(x[N/2-1]). */ - outdata[0].cx_real = datax[0]/scale; + outdata[0].cx_real = datax[0]/scale/2.0; outdata[0].cx_imag = 0.0; for (i = 1; i < fpts-1; i++) { outdata[i].cx_real = datax[2*i]/scale; From b780201eeca5256926b8dfac9456251b80437de7 Mon Sep 17 00:00:00 2001 From: dwarning Date: Sat, 18 Feb 2023 17:14:13 +0100 Subject: [PATCH 3/4] partly revert last commit: only real input vector get special scaling for dc component --- src/maths/cmaths/cmath4.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/maths/cmaths/cmath4.c b/src/maths/cmaths/cmath4.c index 11d7bf8f7..fa2b7cb6f 100644 --- a/src/maths/cmaths/cmath4.c +++ b/src/maths/cmaths/cmath4.c @@ -713,9 +713,7 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp outdata = alloc_c(fpts); scale = (double) fpts; - outdata[0].cx_real = out[0][0]/scale/2.0; - outdata[0].cx_imag = out[0][1]/scale/2.0; - for (i = 1; i < fpts; i++) { + for (i = 0; i < fpts; i++) { outdata[i].cx_real = out[i][0]/scale; outdata[i].cx_imag = out[i][1]/scale; } @@ -746,9 +744,7 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp outdata = alloc_c(N); scale = (double) N; - outdata[0].cx_real = datax[0]/scale/2.0; - outdata[0].cx_imag = datax[1]/scale/2.0; - for (i = 1; i < N; i++) { + for (i = 0; i < N; i++) { outdata[i].cx_real = datax[2*i]/scale; outdata[i].cx_imag = datax[2*i+1]/scale; } From e06ad94eb641e28fc396f4ad8bc9edf2e4c1c25f Mon Sep 17 00:00:00 2001 From: dwarning Date: Sat, 18 Feb 2023 18:28:59 +0100 Subject: [PATCH 4/4] Revert "implement typedpnjlim as optional limiter for verilog-a models" This reverts commit f73d3b20a07cd206db8d7c7dd8679e6eecb02391. --- src/osdi/osdicallbacks.c | 12 ------------ src/osdi/osdidefs.h | 3 +-- src/osdi/osdiregistry.c | 1 - 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/osdi/osdicallbacks.c b/src/osdi/osdicallbacks.c index 1efecf212..de7b1dc97 100644 --- a/src/osdi/osdicallbacks.c +++ b/src/osdi/osdicallbacks.c @@ -50,18 +50,6 @@ double osdi_pnjlim(bool init, bool *check, double vnew, double vold, double vt, return res; } -double osdi_typedpnjlim(bool init, bool *check, double vnew, double vold, double vt, - double vcrit, double type) { - if (init) { - *check = true; - return vcrit; - } - int icheck = 0; - double res = DEVpnjlim(type*vnew, vold, vt, vcrit, &icheck); - *check = icheck != 0; - return res; -} - double osdi_limvds(bool init, bool *check, double vnew, double vold) { if (init) { *check = true; diff --git a/src/osdi/osdidefs.h b/src/osdi/osdidefs.h index d1108b666..6130482ad 100644 --- a/src/osdi/osdidefs.h +++ b/src/osdi/osdidefs.h @@ -96,8 +96,7 @@ typedef void (*osdi_log_ptr)(void *handle, char *msg, uint32_t lvl); double osdi_pnjlim(bool init, bool *icheck, double vnew, double vold, double vt, double vcrit); -double osdi_typedpnjlim(bool init, bool *icheck, double vnew, double vold, double vt, - double vcrit, double type); + double osdi_limvds(bool init, bool *icheck, double vnew, double vold); double osdi_limitlog(bool init, bool *icheck, double vnew, double vold, double LIM_TOL); diff --git a/src/osdi/osdiregistry.c b/src/osdi/osdiregistry.c index 66d14704b..6da846451 100644 --- a/src/osdi/osdiregistry.c +++ b/src/osdi/osdiregistry.c @@ -338,7 +338,6 @@ extern OsdiObjectFile load_object_file(const char *input) { for (uint32_t i = 0; i < lim_table_len; i++) { int expected_args = -1; IS_LIM_FUN("pnjlim", 2, osdi_pnjlim) - IS_LIM_FUN("typedpnjlim", 3, osdi_typedpnjlim) IS_LIM_FUN("limvds", 0, osdi_limvds) IS_LIM_FUN("fetlim", 1, osdi_fetlim) IS_LIM_FUN("limitlog", 1, osdi_limitlog)