From 54820d0428aa0855dc689fee5253382f0bfce301 Mon Sep 17 00:00:00 2001 From: m0_56903617 Date: Tue, 17 Aug 2021 18:03:56 +0800 Subject: [PATCH] 202108171803 long int module --- hdl4secell/include/hdl4secell.h | 27 +++++-- hdl4secell/src/hdl4se_fifo.c | 2 +- hdl4secell/src/hdl4se_module.c | 34 ++++----- hdl4secell/src/hdl4se_mux4.c | 2 + hdl4secell/src/hdl4se_variable.c | 126 +++++++++++++++++++------------ hdl4sesim/src/hdl4sesim.c | 59 ++++++--------- hdl4sesim/src/hdl4sevcdfile.c | 4 +- hdl4seutils/src/threadlock.c | 12 +-- 8 files changed, 143 insertions(+), 123 deletions(-) diff --git a/hdl4secell/include/hdl4secell.h b/hdl4secell/include/hdl4secell.h index 2aefe15..1027bf9 100644 --- a/hdl4secell/include/hdl4secell.h +++ b/hdl4secell/include/hdl4secell.h @@ -106,6 +106,10 @@ enum varupdatefunc { VUF_UPDATING, }; +#ifndef VARBITS +#define VARBITS 256 +#endif + typedef struct sModuleVariable { struct sModuleVariable * pNext, *pLast; int index; @@ -121,7 +125,7 @@ typedef struct sModuleVariable { PointerArray functions; /* 依赖它的函数 */ PointerArray variables; /* 依赖它的变量 */ PointerArray dependvar; - long long updatedisset; + int updatedisset; int genfuncindex; #if USEBIGINT IBigNumber** data; @@ -134,7 +138,9 @@ typedef struct sModuleVariable { unsigned int uint32; long long int64; unsigned long long uint64; - unsigned long long data; + //unsigned long long data; + unsigned int data[VARBITS / 32]; + unsigned long long data64[VARBITS / 64]; }; union { short int16_reg; @@ -143,7 +149,9 @@ typedef struct sModuleVariable { unsigned int uint32_reg; long long int64_reg; unsigned long long uint64_reg; - unsigned long long data_reg; + //unsigned long long data_reg; + unsigned int data_reg[VARBITS / 32]; + unsigned long long data64_reg[VARBITS / 64]; }; #endif @@ -151,6 +159,10 @@ typedef struct sModuleVariable { long updatefunc; }ModuleVariable; +#define VAR_COPYDATA(dst, src) memcpy(dst, src, VARBITS/8) +#define VAR_NEQ(dst, src) memcmp(dst, src, VARBITS/8) + + typedef struct sModuleFunction { ModuleVariable* var; /* getvalue对应的变量 */ void* pobj; @@ -221,8 +233,8 @@ ModuleVariable * varUOr(ModuleVariable * a); ModuleVariable * varUNOr(ModuleVariable * a); ModuleVariable * varUXor(ModuleVariable * a); ModuleVariable * varUNXor(ModuleVariable * a); -ModuleVariable * varBit(ModuleVariable * a, int bit); -ModuleVariable * varBits(ModuleVariable * a, int lsb, int width); +ModuleVariable * varBit(ModuleVariable * a, unsigned int bit); +ModuleVariable * varBits(ModuleVariable * a, unsigned int lsb, unsigned int width); ModuleVariable * varSelect(ModuleVariable * a, ModuleVariable * b, ModuleVariable * c); int varAssign(ModuleVariable * a, ModuleVariable * b); @@ -231,8 +243,8 @@ int varCopy(ModuleVariable * a, ModuleVariable * b); int varIsZero(ModuleVariable * a); int varIsNotZero(ModuleVariable * a); -int varSetBits32(ModuleVariable* a, int index, unsigned int v); -unsigned int varGetBits32(ModuleVariable* a, int index); +int varSetBits32(ModuleVariable* a, unsigned int index, unsigned int v); +unsigned int varGetBits32(ModuleVariable* a, unsigned int index); int varAssign_S32(ModuleVariable * a, int v); int varAssign_U32(ModuleVariable * a, unsigned int v); @@ -324,7 +336,6 @@ IHDL4SEModuleVar* hdl4seCreateModule3(HOBJECT parent, const char* clsid, const c #define IDLIST enum M_ID(id_list) { #define END_IDLIST }; - #define MODULE_DATA_TYPE M_ID(sHDL4SE_data) #define MODULE_DATA_STRUCT M_ID(_sHDL4SE_data) diff --git a/hdl4secell/src/hdl4se_fifo.c b/hdl4secell/src/hdl4se_fifo.c index daa4162..d896ab9 100644 --- a/hdl4secell/src/hdl4se_fifo.c +++ b/hdl4secell/src/hdl4se_fifo.c @@ -255,7 +255,7 @@ DEFINE_FUNC(hdl4se_fifo_ClkTick, "reset, nwReset, readpos, writepos, wRead, wRea vput(outputcount, vget(outputcount) + 1); } if (vget(wWrite) && vget(wWriteEn)) { - int j; + unsigned int j; var writedata = Var(bWriteData); for (j = 0; j < pobj->wordsize; j++) { pobj->fifo_data[writeaddr * pobj->wordsize + j] = varGetBits32(writedata, j); diff --git a/hdl4secell/src/hdl4se_module.c b/hdl4secell/src/hdl4se_module.c index 54fd6c6..df17eb2 100644 --- a/hdl4secell/src/hdl4se_module.c +++ b/hdl4secell/src/hdl4se_module.c @@ -268,9 +268,9 @@ int hdl4se_module_Assign(sGeneralModule* pobj, int dstind, int srcind) varsrc = (ModuleVariable*)pobj->variables.array[srcind]; UpdateVariable(varsrc); if (vardst->type == VTYPE_REG) - vardst->data_reg = varsrc->data; + VAR_COPYDATA(vardst->data_reg, varsrc->data); else - vardst->data = varsrc->data; + VAR_COPYDATA(vardst->data, varsrc->data); return 0; } @@ -281,9 +281,9 @@ int hdl4se_module_AssignVar(sGeneralModule* pobj, int dstind, ModuleVariable* va return -1; vardst = (ModuleVariable*)pobj->variables.array[dstind]; if (vardst->type == VTYPE_REG) - vardst->data_reg = varsrc->data; + VAR_COPYDATA(vardst->data_reg, varsrc->data); else - vardst->data = varsrc->data; + VAR_COPYDATA(vardst->data, varsrc->data); return 0; } @@ -340,9 +340,9 @@ void hdl4se_module_SetVarUint32(sGeneralModule* pobj, int varindex, unsigned int { ModuleVariable* var = (ModuleVariable*)pobj->variables.array[varindex]; if (var->type == VTYPE_REG) - var->data_reg = v; + var->uint64_reg = v; else - var->data = v; + var->uint64 = v; } void hdl4se_module_SetVarInt32(sGeneralModule* pobj, int varindex, int v) @@ -358,9 +358,9 @@ void hdl4se_module_SetVarUint64(sGeneralModule* pobj, int varindex, unsigned lon { ModuleVariable* var = (ModuleVariable*)pobj->variables.array[varindex]; if (var->type == VTYPE_REG) - var->data_reg = v; + var->uint64_reg = v; else - var->data = v; + var->uint64 = v; } void hdl4se_module_SetVarInt64(sGeneralModule* pobj, int varindex, long long v) @@ -645,10 +645,10 @@ inline int hdl4se_module_GetValue(sGeneralModule* pobj, int index, int width, Mo value->width = var->width; } if (value->type == VTYPE_REG) { - value->data_reg = var->data; + VAR_COPYDATA(value->data_reg, var->data); } else { - value->data = var->data; + VAR_COPYDATA(value->data, var->data); } #endif return 0; @@ -687,7 +687,7 @@ int hdl4se_module_ClkTick(sGeneralModule* pobj) return 0; } -#define LOCKED_UPDATE 0 +#define LOCKED_UPDATE 1 #if LOCKED_UPDATE static int hdl4se_var_set_update(ModuleVariable* v) @@ -698,9 +698,6 @@ static int hdl4se_var_set_update(ModuleVariable* v) if (LOCKED_SWAP(v->updatedisset, 1)) { return 0; } -#if DEBUGDEPEND - printf("->%s.%s", v->moduledata->name, v->name); -#endif if (v->genfuncindex >= 0 || v->module != NULL) LOCKED_SWAP(v->updatefunc, VUF_WAITUPDATE); for (i = 0; i < v->variables.itemcount; i++) { @@ -718,9 +715,6 @@ static int hdl4se_var_set_update(ModuleVariable* v) return 0; } v->updatedisset = 1; -#if DEBUGDEPEND - printf("->%s.%s", v->moduledata->name, v->name); -#endif if (v->genfuncindex >= 0 || v->module != NULL) v->updatefunc = VUF_WAITUPDATE; for (i = 0; i < v->variables.itemcount; i++) { @@ -746,8 +740,8 @@ int hdl4se_module_Setup(sGeneralModule* pobj) #if USEBIGINT objectCall1(var->data, Clone, var->data_reg); #else - if (var->data != var->data_reg) { - var->data = var->data_reg; + if (VAR_NEQ(var->data, var->data_reg)) { + VAR_COPYDATA(var->data, var->data_reg); #endif #if DEPEND_OPT @@ -845,7 +839,7 @@ int hdl4se_module_path_Traversal(HOBJECT object, hdl4se_module_path_TraversalFun count = hdl4se_module_GetModuleCount(&detector->data); for (i = 0; i < count; i++) { HOBJECT unit; - hdl4se_module_GetModule(&detector->data, i, (void**)&unit); + hdl4se_module_GetModule(&detector->data, i, (IHDL4SEModuleVar**)&unit); if (hdl4se_module_path_Traversal(unit, func, pname, param) != 0) return -1; } diff --git a/hdl4secell/src/hdl4se_mux4.c b/hdl4secell/src/hdl4se_mux4.c index f958c7f..95872c1 100644 --- a/hdl4secell/src/hdl4se_mux4.c +++ b/hdl4secell/src/hdl4se_mux4.c @@ -49,6 +49,8 @@ #define hdl4se_mux4_MODULE_VERSION_STRING "0.4.0-20210714.0931 HDL4SE Mux4 cell" #define hdl4se_mux4_MODULE_CLSID CLSID_HDL4SE_MUX4 +static MODULE_CREATOR_DECLARE(hdl4se_mux4); + IDLIST VID(sel), VID(in0), diff --git a/hdl4secell/src/hdl4se_variable.c b/hdl4secell/src/hdl4se_variable.c index 31469b4..100e56a 100644 --- a/hdl4secell/src/hdl4se_variable.c +++ b/hdl4secell/src/hdl4se_variable.c @@ -77,11 +77,9 @@ ModuleVariable* variableCreate(int type, int width, int portdirect, int isunsign var->genfuncindex = -1; var->module = NULL; var->moduleportindex = 0; - var->data = 0; pointerarrayInit(&var->functions); pointerarrayInit(&var->variables); pointerarrayInit(&var->dependvar); - var->data_reg = 0; #if USEBIGINT { var->data = bigintegerCreate2(width, isunsigned); @@ -111,7 +109,6 @@ int variableDestroy(ModuleVariable* var) #endif if (var->depend_list != NULL) free(var->depend_list); - var->data = 0; mt_free(var); return 0; } @@ -329,6 +326,9 @@ long long varGet_S64(ModuleVariable* a); unsigned long long varGet_U64(ModuleVariable* a); #else + + + enum TOKEN_STATE { TOKEN_INITIAL, TOKEN_NUM, @@ -341,10 +341,15 @@ enum TOKEN_STATE { #define MAXNUMWIDTH (1 << 30) +void varSetWidth(ModuleVariable* v, int width) +{ + +} + ModuleVariable* varConstStr(const char* str) { ModuleVariable* temp = varTemp(64, 1); - + /* support 64bits only, fixed me*/ int width; enum TOKEN_STATE state; const char* strt = str; @@ -383,19 +388,19 @@ ModuleVariable* varConstStr(const char* str) temp->isunsigned = 0; } else if (ch == 'b' || ch == 'B') { - temp->data = 0; + temp->uint64 = 0; state = TOKEN_BIN; } else if (ch == 'h' || ch == 'H') { - temp->data = 0; + temp->uint64 = 0; state = TOKEN_HEX; } else if (ch == 'o' || ch == 'O') { - temp->data = 0; + temp->uint64 = 0; state = TOKEN_OCT; } else if (ch == 'd' || ch == 'D') { - temp->data = 0; + temp->uint64 = 0; state = TOKEN_DEC; } else if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') { @@ -407,7 +412,7 @@ ModuleVariable* varConstStr(const char* str) }break; case TOKEN_BIN: { if (ch == '0' || ch == '1') { - temp->data = temp->data * 2 + ch - '0'; + temp->uint64 = temp->uint64 * 2 + ch - '0'; numvalid = 1; } else if (ch == '_') { @@ -418,7 +423,7 @@ ModuleVariable* varConstStr(const char* str) }break; case TOKEN_OCT: { if (ch >= '0' && ch <= '7') { - temp->data = temp->data * 8 + ch - '0'; + temp->uint64 = temp->uint64 * 8 + ch - '0'; numvalid = 1; } else if (ch == '_') { @@ -429,7 +434,7 @@ ModuleVariable* varConstStr(const char* str) }break; case TOKEN_DEC: { if (ch >= '0' && ch <= '9') { - temp->data = temp->data * 10 + ch - '0'; + temp->uint64 = temp->uint64 * 10 + ch - '0'; numvalid = 1; } else if (ch == '_') { @@ -440,13 +445,13 @@ ModuleVariable* varConstStr(const char* str) }break; case TOKEN_HEX: { if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')) { - temp->data = temp->data * 16; + temp->uint64 = temp->uint64 * 16; if (ch > '0' && ch <= '9') - temp->data += ch - '0'; + temp->uint64 += ch - '0'; else if (ch >= 'a' && ch <= 'f') - temp->data += ch - 'a' + 10; + temp->uint64 += ch - 'a' + 10; else if (ch >= 'A' && ch <= 'F') - temp->data += ch - 'A' + 10; + temp->uint64 += ch - 'A' + 10; } else if (ch == '_') { } @@ -464,8 +469,8 @@ lastnum: width = 1; temp->width = width; if (width < 64 && temp->isunsigned == 0) { - if (temp->data & (1llu << (width - 1))) { - temp->data |= 0xffffffffffffffffllu << width; + if (temp->uint64 & (1llu << (width - 1))) { + temp->uint64 |= 0xffffffffffffffffllu << width; } } return temp; @@ -486,22 +491,22 @@ int varGetStr(ModuleVariable* pobj, int base, char* str, int buflen) buflen = pobj->width; } for (i = 0; i < buflen; i++) { - str[buflen - 1 - i] = (pobj->data & (1llu << i)) ? '1' : '0'; + str[buflen - 1 - i] = (pobj->uint64 & (1llu << i)) ? '1' : '0'; } str[buflen] = '\0'; } else if (base == 10) { if (pobj->isunsigned) - sprintf(str, "%llu", pobj->data); + sprintf(str, "%llu", pobj->uint64); else sprintf(str, "%lld", pobj->int64); } else { if (pobj->isunsigned) - sprintf(str, "%d'h%llx", bc, pobj->data); + sprintf(str, "%d'h%llx", bc, pobj->uint64); else - sprintf(str, "%d'sh%llx", bc, pobj->data); + sprintf(str, "%d'sh%llx", bc, pobj->uint64); } return 0; } @@ -523,6 +528,7 @@ ModuleVariable* varConstSigned(int width, long long v) ModuleVariable* varConcat(int multicount, ...) { + /* support 64 bits only, fixed me */ va_list argptr; int i; int width = 0; @@ -534,8 +540,8 @@ ModuleVariable* varConcat(int multicount, ...) if (item == NULL) break; width += itemwidth = item->width; - temp->data <<= itemwidth; - temp->data |= item->data & (0xffffffffffffffffllu >> (64 - itemwidth)); + temp->uint64 <<= itemwidth; + temp->uint64 |= item->uint64 & (0xffffffffffffffffllu >> (64 - itemwidth)); } while (1); va_end(argptr); temp->width = width; @@ -544,8 +550,8 @@ ModuleVariable* varConcat(int multicount, ...) ModuleVariable* temp1 = temp; temp = varTemp(multicount * width, 1); for (i = 0; i < multicount; i++) { - temp->data <<= width; - temp->data |= temp1->data; + temp->uint64 <<= width; + temp->uint64 |= temp1->uint64; } } return temp; @@ -555,7 +561,7 @@ ModuleVariable* varAdd(ModuleVariable* a, ModuleVariable* b) { ModuleVariable* temp; temp = varTemp(max(a->width, b->width), a->isunsigned || b->isunsigned); - temp->data = a->data + b->data; + temp->uint64 = a->uint64 + b->uint64; return temp; } @@ -580,7 +586,7 @@ ModuleVariable* varEQ(ModuleVariable* a, ModuleVariable* b) { ModuleVariable* temp; temp = varTemp(1, 1); - temp->data = (a->data == b->data)?1:0; + temp->uint64 = VAR_NEQ(a->data, b->data)?0:1; return temp; } @@ -597,58 +603,80 @@ ModuleVariable* varUNOr(ModuleVariable* a); ModuleVariable* varUXor(ModuleVariable* a); ModuleVariable* varUNXor(ModuleVariable* a); -ModuleVariable* varBit(ModuleVariable* a, int bit) +ModuleVariable* varBit(ModuleVariable* a, unsigned int bit) { ModuleVariable* temp; + int ind; + int bitind; + if (bit >= VARBITS) + return 0; + ind = bit / 64; + bitind = bit % 64; temp = varTemp(1, 1); - temp->data = (a->data & (1llu << bit)) ? 1 : 0; + temp->uint64 = (a->data64[ind] & (1llu << bitind)) ? 1 : 0; return temp; } -ModuleVariable* varBits(ModuleVariable* a, int from, int width) +ModuleVariable* varBits(ModuleVariable* a, unsigned int from, unsigned int width) { ModuleVariable* temp; temp = varTemp(width, 1); - temp->data = (a->data >> from) & (0xffffffffffffffffllu >> (64 - width)); + if (from >= a->width) + return temp; + if (width + from > a->width) + width = a->width - from; + if (width <= 0) + return temp; +#if VARBITS <= 64 + temp->uint64 = (a->uint64 >> from) & (0xffffffffffffffffllu >> (64 - width)); +#else + { + int i; + temp = varSHR(a, from); + temp->isunsigned = 1; + varSetWidth(temp, width); + } +#endif return temp; } ModuleVariable* varSelect(ModuleVariable* a, ModuleVariable* b, ModuleVariable* c) { - if (a->data) + if (a->uint64) return b; else return c; } -int varAssign(ModuleVariable* a, ModuleVariable* b); +int varAssign(ModuleVariable* a, ModuleVariable* b) +{ + if (a->type = VTYPE_REG) + VAR_COPYDATA(a->data_reg, b->data); + else + VAR_COPYDATA(a->data, b->data); + return 0; +} + int varIsZero(ModuleVariable* a); int varIsNotZero(ModuleVariable* a); -int varSetBits32(ModuleVariable* a, int index, unsigned int v) +int varSetBits32(ModuleVariable* a, unsigned int index, unsigned int v) { + if (index >= VARBITS / 32) + return -1; if (a->type == VTYPE_REG) { - if (index == 0) - a->uint32_reg = v; - else - a->data_reg = (a->data_reg & 0xffffffff) | (((unsigned long long)v) << 32); + a->data_reg[index] = v; } else { - if (index == 0) - a->uint32 = v; - else - a->data = (a->data & 0xffffffff) | (((unsigned long long)v) << 32); + a->data[index] = v; } return 0; } -unsigned int varGetBits32(ModuleVariable* a, int index) +unsigned int varGetBits32(ModuleVariable* a, unsigned int index) { - unsigned int v; - if (index == 0) - v = a->uint32; - else - v = (unsigned int)(a->data >> 32); - return v; + if (index >= VARBITS / 32) + return 0; + return a->data[index]; } int varAssign_S32(ModuleVariable* a, int v) diff --git a/hdl4sesim/src/hdl4sesim.c b/hdl4sesim/src/hdl4sesim.c index e2240ea..e42cb5d 100644 --- a/hdl4sesim/src/hdl4sesim.c +++ b/hdl4sesim/src/hdl4sesim.c @@ -241,7 +241,7 @@ static int hdl4sesim_hdl4se_simulator_SetReset(HOBJECT object, int reset) return 0; } -#define THREADCOUNT 9 +#define THREADCOUNT 3 static int hdl4sesim_hdl4se_simulator_ClkTick(HOBJECT object) { @@ -281,9 +281,6 @@ static int hdl4sesim_hdl4se_simulator_Setup(HOBJECT object) pobj->clk = 1; pobj->clocks++; vartempClean(); -#if DEBUGDEPEND - printf("%lld:\n", pobj->clocks); -#endif hdl4se_module_Setup(&pobj->data); for (i = 0; i < pobj->singlethreadmodules.itemcount; i++) { hdl4se_module_Setup(&((IHDL4SEModuleVar*)(pobj->singlethreadmodules.array[i]))->data); @@ -292,11 +289,6 @@ static int hdl4sesim_hdl4se_simulator_Setup(HOBJECT object) for (i = 0; i < pobj->multithreadmodules.itemcount; i++) { hdl4se_module_Setup(&((IHDL4SEModuleVar*)(pobj->multithreadmodules.array[i]))->data); } -#if 0 - for (i = 0; i < pobj->multithreadmodules.itemcount; i++) { - checkmodule(&((IHDL4SEModuleVar*)(pobj->multithreadmodules.array[i]))->data); - } -#endif return 0; } @@ -318,89 +310,82 @@ IHDL4SESimulator** hdl4sesimCreateSimulator() /* i5 6200U 2.3G -threadcount=4 -DEPEND_OPT=1 -clocks: 1769472, TSPD=4874.578512cps, LSPD=4681.142857cps +threadcount=5 +LOCKED_UPDATE=0 DEPEND_OPT=1 +clocks: 1769472, TSPD=7134.967742cps, LSPD=7281.777778cps softmax_168 complete 0.4901 n03085013 computer keyboard, keypad 0.1591 n04264628 space bar 0.0543 n04074963 remote control, remote 0.0439 n03832673 notebook, notebook computer 0.0356 n04505470 typewriter keyboard -clocks: 1835008, TSPD=4959.481081cps, LSPD=9362.285714cps -DEPEND_OPT=0 -clocks: 1769472, TSPD=3701.824268cps, LSPD=3449.263158cps +threadcount=4 +LOCKED_UPDATE=0 DEPEND_OPT=1 +clocks: 1769472, TSPD=8891.819095cps, LSPD=10922.666667cps softmax_168 complete 0.4901 n03085013 computer keyboard, keypad 0.1591 n04264628 space bar 0.0543 n04074963 remote control, remote 0.0439 n03832673 notebook, notebook computer 0.0356 n04505470 typewriter keyboard -clocks: 1835008, TSPD=3707.086869cps, LSPD=3855.058824cps -threadcount=3 -DEPEND_OPT=1 -clocks: 1769472, TSPD=6505.411765cps, LSPD=9362.285714cps +LOCKED_UPDATE=1 DEPEND_OPT=1 +clocks: 1769472, TSPD=9120.989691cps, LSPD=10922.666667cps softmax_168 complete 0.4901 n03085013 computer keyboard, keypad 0.1591 n04264628 space bar 0.0543 n04074963 remote control, remote 0.0439 n03832673 notebook, notebook computer 0.0356 n04505470 typewriter keyboard -clocks: 1835008, TSPD=6461.295775cps, LSPD=5461.333333cps -DEPEND_OPT=0 -clocks: 1769472, TSPD=4021.527273cps, LSPD=5957.818182cps +threadcount=3 +LOCKED_UPDATE=0 DEPEND_OPT=1 +clocks: 1769472, TSPD=9830.400000cps, LSPD=10922.666667cps softmax_168 complete 0.4901 n03085013 computer keyboard, keypad 0.1591 n04264628 space bar 0.0543 n04074963 remote control, remote 0.0439 n03832673 notebook, notebook computer 0.0356 n04505470 typewriter keyboard -clocks: 1835008, TSPD=4015.334792cps, LSPD=3855.058824cps -threadcount=2 -DEPEND_OPT=1 -clocks: 1769472, TSPD=6652.150376cps, LSPD=5461.333333cps +LOCKED_UPDATE=1 DEPEND_OPT=1 +clocks: 1769472, TSPD=10053.818182cps, LSPD=10922.666667cps softmax_168 complete 0.4901 n03085013 computer keyboard, keypad 0.1591 n04264628 space bar 0.0543 n04074963 remote control, remote 0.0439 n03832673 notebook, notebook computer 0.0356 n04505470 typewriter keyboard -clocks: 1835008, TSPD=6746.352941cps, LSPD=10922.666667cps -DEPEND_OPT=0 -clocks: 1769472, TSPD=4086.540416cps, LSPD=4369.066667cps +threadcount=2 +LOCKED_UPDATE=0 DEPEND_OPT=1 +clocks: 1769472, TSPD=8631.570732cps, LSPD=9362.285714cps softmax_168 complete 0.4901 n03085013 computer keyboard, keypad 0.1591 n04264628 space bar 0.0543 n04074963 remote control, remote 0.0439 n03832673 notebook, notebook computer 0.0356 n04505470 typewriter keyboard -clocks: 1835008, TSPD=4086.877506cps, LSPD=4096.000000cps -threadcount=1 -DEPEND_OPT=1 -clocks: 1769472, TSPD=4915.200000cps, LSPD=5957.818182cps +LOCKED_UPDATE=1 DEPEND_OPT=1 +clocks: 1769472, TSPD=8759.762376cps, LSPD=9362.285714cps softmax_168 complete 0.4901 n03085013 computer keyboard, keypad 0.1591 n04264628 space bar 0.0543 n04074963 remote control, remote 0.0439 n03832673 notebook, notebook computer 0.0356 n04505470 typewriter keyboard -clocks: 1835008, TSPD=4932.817204cps, LSPD=5461.333333cps -DEPEND_OPT=0 -clocks: 1769472, TSPD=2886.577488cps, LSPD=2978.909091cps +threadcount=1 +LOCKED_UPDATE=1 DEPEND_OPT=1 +clocks: 1769472, TSPD=6365.007194cps, LSPD=6553.600000cps softmax_168 complete 0.4901 n03085013 computer keyboard, keypad 0.1591 n04264628 space bar 0.0543 n04074963 remote control, remote 0.0439 n03832673 notebook, notebook computer 0.0356 n04505470 typewriter keyboard -clocks: 1835008, TSPD=2894.334385cps, LSPD=3120.761905cps i9 10900 32G threadcount=32 diff --git a/hdl4sesim/src/hdl4sevcdfile.c b/hdl4sesim/src/hdl4sevcdfile.c index 6272913..16d4273 100644 --- a/hdl4sesim/src/hdl4sevcdfile.c +++ b/hdl4sesim/src/hdl4sevcdfile.c @@ -225,8 +225,8 @@ static int hdl4sevcdfile_output_item_data(IDListVarPtr item, sHDL4SEVcdFile* pob #else pobj->tempvar->width = pitem->width; hdl4se_module_GetValue(&pitem->detector->data, pitem->index, pitem->width, pobj->tempvar); - if (pobj->tempvar->data != pitem->lastvalue->data) { - pitem->lastvalue->data = pobj->tempvar->data; + if (VAR_NEQ(pobj->tempvar->data, pitem->lastvalue->data)) { + VAR_COPYDATA(pitem->lastvalue->data, pobj->tempvar->data); varGetStr(pitem->lastvalue, 2, pobj->tempbuf, MAXWIDTH); fprintf(pobj->pFile, "b%s %s\n", pobj->tempbuf, pitem->vcdname); } diff --git a/hdl4seutils/src/threadlock.c b/hdl4seutils/src/threadlock.c index 77c5377..635d399 100644 --- a/hdl4seutils/src/threadlock.c +++ b/hdl4seutils/src/threadlock.c @@ -51,7 +51,7 @@ typedef struct _ThreadLock { THREADLOCK threadlockCreate() { ThreadLock* pSection = NULL; - pSection = (ThreadLock *)mt_malloc(sizeof(ThreadLock)); + pSection = (ThreadLock *)malloc(sizeof(ThreadLock)); if (pSection != NULL) { InitializeCriticalSection(&pSection->section); pSection->refcount = 1; @@ -78,7 +78,7 @@ int threadlockUnlock(THREADLOCK lock) int threadlockDestroy(THREADLOCK lock) { if (lock != NULL) - mt_free(((ThreadLock*)lock)); + free(((ThreadLock*)lock)); return 0; } @@ -180,14 +180,14 @@ int crtinit() void* mt_malloc(size_t size) { - threadlockLock(crtlock); + //threadlockLock(crtlock); void* ret = malloc(size); - threadlockUnlock(crtlock); + //threadlockUnlock(crtlock); return ret; } void mt_free(void* data) { - threadlockLock(crtlock); + //threadlockLock(crtlock); free(data); - threadlockUnlock(crtlock); + //threadlockUnlock(crtlock); } -- GitLab