提交 3c15e709 编写于 作者: 饶先宏's avatar 饶先宏

202108111109

上级 526babc2
......@@ -49,7 +49,7 @@ unsigned long long clocks = 0;
static int running = 1;
#define VCDOUTPUT 1
#define VCDOUTPUT 0
int cnnInit();
......
......@@ -145,6 +145,7 @@ typedef struct sModuleFunction {
void* pobj;
MODULE_FUNC func;
MODULE_FUNC cur_func;
int callit;
PointerArray variables; /* 影响的variables */
}ModuleFunction;
......@@ -239,7 +240,16 @@ int hdl4seCheckVariableArray(PointerArray* array);
ModuleFunction* functionCreateFunc(MODULE_FUNC func, void * pobj);
ModuleFunction* functionCreateGetValue(ModuleVariable * var);
int functionDestroy(ModuleFunction* func);
int functionCallAndSetNone(ModuleFunction* func);
//int functionCallAndSetNone(ModuleFunction* func);
#define functionCallAndSetNone(obj) \
do { \
ModuleFunction * func = (ModuleFunction *)obj; \
int callit = LOCKED_SWAP(func->callit, 0); \
if (callit) { \
func->func(func->pobj, func->var); \
} \
} while (0)
int hdl4se_split_string(const char* string, char** substr, int substrcount, int gap);
unsigned int hdl4seGetParamUint32(const char* param);
......
......@@ -59,6 +59,7 @@ ModuleFunction* functionCreateFunc(MODULE_FUNC func, void* pobj)
function->func = function->cur_func = func;
function->pobj = pobj;
function->var = NULL;
function->callit = 1;
pointerarrayInit(&function->variables);
return function;
}
......@@ -77,12 +78,14 @@ static int gen_none(void* p, void* v)
return 0;
}
/*
int functionCallAndSetNone(ModuleFunction* func)
{
MODULE_FUNC genfunc;
genfunc = LOCKED_SWAP_POINTER(func->cur_func, gen_none);
return genfunc(func->pobj, func->var);
}
*/
int functionDestroy(ModuleFunction* func)
{
......
......@@ -110,16 +110,16 @@ do { \
#define UpdateVariable(v) \
do { \
if (v->type != VTYPE_REG) { \
threadlockLock(v->lock); \
if (v->updatefunc != 0) { \
if (v->updatefunc == 1) { \
int updatefunc; \
updatefunc = LOCKED_SWAP(v->updatefunc, 0); \
if (updatefunc != 0) { \
if (updatefunc == 1) { \
hdl4seUpdateVariableGenFunc(v); \
} \
else { \
hdl4seUpdateVariableGetValue(v); \
} \
} \
threadlockUnlock(v->lock); \
} \
} while (0)
#endif
......@@ -681,7 +681,8 @@ int hdl4se_module_Setup(sGeneralModule* pobj)
for (i = 0; i < pobj->funcs.itemcount; i++) {
ModuleFunction* function = (ModuleFunction *)pobj->funcs.array[i];
function->cur_func = function->func;
//function->cur_func = function->func;
function->callit = 1;
}
return 0;
......
......@@ -231,7 +231,7 @@ static int hdl4sesim_hdl4se_simulator_SetReset(HOBJECT object, int reset)
return 0;
}
#define THREADCOUNT 9
#define THREADCOUNT 2
static int hdl4sesim_hdl4se_simulator_ClkTick(HOBJECT object)
{
......@@ -297,6 +297,15 @@ softmax_168 complete
0.0356 n04505470 typewriter keyboard
clocks: 1884160, TSPD=1359.422799cps, LSPD=1170.285714cps
clocks: 1802240, TSPD=4681.142857cps, LSPD=4096.000000cps
softmax_168 complete
0.4901 n03085013 computer keyboard, keypad
0.1591 n04264628 space bar
0.0543 n04074963 remote control, remote
0.0438 n03832673 notebook, notebook computer
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=4687.175258cps, LSPD=5461.333333cps
threadcount=3
clocks : 1867776, TSPD = 1552.598504cps, LSPD = 2048.000000cps
softmax_168 complete
......@@ -317,6 +326,14 @@ softmax_168 complete
0.0356 n04505470 typewriter keyboard
clocks: 1884160, TSPD=1312.089136cps, LSPD=1260.307692cps
clocks: 1802240, TSPD=4767.830688cps, LSPD=4096.000000cps
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: 1818624, TSPD=4760.795812cps, LSPD=4096.000000cps
threadcount=2
clocks: 1867776, TSPD=1562.992469cps, LSPD=1365.333333cps
......@@ -338,6 +355,25 @@ softmax_168 complete
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=1752.046243cps, LSPD=1820.444444cps
usebigint == 0
clocks: 1802240, TSPD=3746.860707cps, LSPD=4096.000000cps
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: 1818624, TSPD=3749.740206cps, LSPD=4096.000000cps
clocks: 1802240, TSPD=4114.703196cps, LSPD=4096.000000cps
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: 1818624, TSPD=4114.533937cps, LSPD=4096.000000cps
threadcount=1
clocks: 1867776, TSPD=993.497872cps, LSPD=963.764706cps
softmax_168 complete
......@@ -348,6 +384,25 @@ softmax_168 complete
0.0356 n04505470 typewriter keyboard
clocks: 1884160, TSPD=993.755274cps, LSPD=1024.000000cps
usebitint == 0
clocks: 1802240, TSPD=2549.137199cps, LSPD=2730.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: 1818624, TSPD=2547.092437cps, LSPD=2340.571429cps
clocks: 1802240, TSPD=2802.861586cps, LSPD=2730.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: 1818624, TSPD=2802.194145cps, LSPD=2730.666667cps
i9 10900 32G
threadcount=32
clocks: 1867776, TSPD=8768.901408cps, LSPD=8192.000000cps
......
......@@ -61,7 +61,7 @@ void mt_free(void*);
#define LOCKED_INCREMENT(p) InterlockedIncrement(&p)
#define LOCKED_DECREMENT(p) InterlockedDecrement(&p)
#define LOCKED_SWAP_POINTER(p, v) InterlockedExchangePointer(&p, v)
#define LOCKED_SWAP(p, v) InterlockedExchange(&p, v)
#define STRDUP _strdup
#endif
......@@ -69,7 +69,7 @@ void mt_free(void*);
#define LOCKED_INCREMENT(p) __sync_fetch_and_add(&p, 1);
#define LOCKED_DECREMENT(p) __sync_fetch_and_sub(&p, 1);
#define LOCKED_SWAP_POINTER(p, v) __sync_val_compare_and_swap(&p, p, v)
#define LOCKED_SWAP(p, v) __sync_val_compare_and_swap(&p, p, v)
#define STRDUP strdup
#endif
......@@ -78,7 +78,14 @@ void mt_free(void*);
#define LOCKED_DECREMENT(p) p--
static void* locked_swap_pointer(void** p, void* v)
{
void* ret = v;
void* ret = *p;
*p = v;
return ret;
}
#define LOCKED_SWAP_POINTER(p, v) locked_swap_pointer(&p, v)
static long locked_swap(long * p, long v)
{
long ret = *p;
*p = v;
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册