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

202108092003

上级 c8ecc720
......@@ -120,7 +120,8 @@ typedef struct sModuleVariable {
unsigned long long data_reg;
#endif
THREADLOCK lock;
void (*func_UpdateVariable)(struct sModuleVariable* var);
//void (*func_UpdateVariable)(struct sModuleVariable* var);
int updatefunc;
}ModuleVariable;
typedef struct sModuleFunction {
......
......@@ -65,6 +65,26 @@ sGeneralModule* hdl4seModuleGetData(HOBJECT object)
FILE* recordfileGet();
void recordfileRelease();
inline static void hdl4seUpdateVariableNone(ModuleVariable* var)
{
}
inline static void hdl4seUpdateVariableGenFunc(ModuleVariable* var)
{
//var->func_UpdateVariable = hdl4seUpdateVariableNone;
var->updatefunc = 0;
functionCallAndSetNone(var->moduledata->funcs.array[var->genfuncindex]);
}
inline static void hdl4seUpdateVariableGetValue(ModuleVariable* var)
{
// var->func_UpdateVariable = hdl4seUpdateVariableNone;
//functionCallAndSetNone(var->moduledata->funcs.array[var->genfuncindex]);
var->updatefunc = 0;
hdl4se_module_GetValue(&var->module->data, var->moduleportindex, var->width, (var->type == VTYPE_REG) ? var->data_reg : var->data);
}
#if HDL4SE_DEBUG
#define UpdateVariable(v) \
do { \
......@@ -89,9 +109,16 @@ do { \
#define UpdateVariable(v) \
do { \
if (v->type != VTYPE_REG) { \
threadlockLock(v->lock); \
v->func_UpdateVariable(v); \
threadlockUnlock(v->lock); \
if (v->updatefunc != 0) { \
threadlockLock(v->lock); \
if (v->updatefunc == 1) { \
hdl4seUpdateVariableGenFunc(v); \
} \
else { \
hdl4seUpdateVariableGetValue(v); \
} \
threadlockUnlock(v->lock); \
} \
} \
} while (0)
#endif
......@@ -452,7 +479,7 @@ int hdl4se_module_ConnectInput(sGeneralModule* pobj, int index, HOBJECT from, in
return 0;
}
int hdl4se_module_GetValue(sGeneralModule* pobj, int index, int width, IBigNumber** value)
inline int hdl4se_module_GetValue(sGeneralModule* pobj, int index, int width, IBigNumber** value)
{
ModuleVariable* var;
if (index < 0 || index >= pobj->variables.itemcount)
......@@ -467,24 +494,6 @@ int hdl4se_module_GetValue(sGeneralModule* pobj, int index, int width, IBigNumbe
return 0;
}
static void hdl4seUpdateVariableNone(ModuleVariable* var)
{
}
static void hdl4seUpdateVariableGenFunc(ModuleVariable* var)
{
var->func_UpdateVariable = hdl4seUpdateVariableNone;
functionCallAndSetNone(var->moduledata->funcs.array[var->genfuncindex]);
}
static void hdl4seUpdateVariableGetValue(ModuleVariable* var)
{
var->func_UpdateVariable = hdl4seUpdateVariableNone;
//functionCallAndSetNone(var->moduledata->funcs.array[var->genfuncindex]);
hdl4se_module_GetValue(&var->module->data, var->moduleportindex, var->width, (var->type == VTYPE_REG) ? var->data_reg : var->data);
}
int hdl4se_module_ClkTick(sGeneralModule* pobj)
{
int i;
......@@ -517,16 +526,21 @@ int hdl4se_module_Setup(sGeneralModule* pobj)
continue;
if (var->type == VTYPE_REG) {
objectCall1(var->data, Clone, var->data_reg);
var->func_UpdateVariable = hdl4seUpdateVariableNone;
//var->func_UpdateVariable = hdl4seUpdateVariableNone;
var->updatefunc = 0;
}
else if (var->genfuncindex >= 0) {
var->func_UpdateVariable = hdl4seUpdateVariableGenFunc;
//var->func_UpdateVariable = hdl4seUpdateVariableGenFunc;
var->updatefunc = 1;
}
else if (var->module != NULL) {
var->func_UpdateVariable = hdl4seUpdateVariableGetValue;
//var->func_UpdateVariable = hdl4seUpdateVariableGetValue;
var->updatefunc = 2;
}
else {
var->func_UpdateVariable = hdl4seUpdateVariableNone;
//var->func_UpdateVariable = hdl4seUpdateVariableNone;
var->updatefunc = 0;
}
}
......
......@@ -77,7 +77,8 @@ ModuleVariable* variableCreate(int type, int width, int portdirect, int isunsign
if (type == VTYPE_REG)
var->data_reg = bigintegerCreate2(width, isunsigned);
}
var->func_UpdateVariable = hdl4seUpdateVariableNone;
//var->func_UpdateVariable = hdl4seUpdateVariableNone;
var->updatefunc = 0;
var->lock = threadlockCreate();
return var;
}
......
......@@ -231,7 +231,7 @@ static int hdl4sesim_hdl4se_simulator_SetReset(HOBJECT object, int reset)
return 0;
}
#define THREADCOUNT 2
#define THREADCOUNT 9
static int hdl4sesim_hdl4se_simulator_ClkTick(HOBJECT object)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册