Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
饶先宏
hdl4se
提交
5377edad
H
hdl4se
项目概览
饶先宏
/
hdl4se
通知
12
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hdl4se
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5377edad
编写于
7月 10, 2021
作者:
饶先宏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
202107101141
上级
e10b7c82
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
155 addition
and
351 deletion
+155
-351
bignumber/include/bignumber.h
bignumber/include/bignumber.h
+1
-0
bignumber/src/bignumber.c
bignumber/src/bignumber.c
+7
-0
examples/terris/CMakeLists.txt
examples/terris/CMakeLists.txt
+4
-3
examples/terris/src/blockwrite.c
examples/terris/src/blockwrite.c
+18
-130
hdl4secell/include/hdl4se_macros.h
hdl4secell/include/hdl4se_macros.h
+125
-218
未找到文件。
bignumber/include/bignumber.h
浏览文件 @
5377edad
...
...
@@ -297,6 +297,7 @@ DEFINE_GUID(CLSID_BIGINTEGER, 0xabde0235, 0x8f00, 0x4f30, 0x92, 0xbf, 0x95, 0x2e
DEFINE_GUID
(
PARAMID_BIGINTEGERWIDTH
,
0xb3a21034
,
0x27d5
,
0x4e09
,
0xba
,
0xfd
,
0x2
,
0xeb
,
0x0
,
0xfc
,
0x28
,
0xfb
);
IBigNumber
**
bigintegerCreate
(
int
width
);
IBigNumber
**
bigintegerCreate2
(
int
width
,
int
isunsigned
);
#endif
/* _ASMLANGUAGE */
...
...
bignumber/src/bignumber.c
浏览文件 @
5377edad
...
...
@@ -1918,3 +1918,10 @@ IBigNumber** bigintegerCreate(int width)
ret
=
objectCreateEx
(
CLSID_BIGINTEGER
,
&
param
,
1
,
IID_BIGNUMBER
,
(
const
void
**
)
&
bn
);
return
bn
;
}
IBigNumber
**
bigintegerCreate2
(
int
width
,
int
isunsigned
)
{
IBigNumber
**
bn
=
bigintegerCreate
(
width
);
objectCall1
(
bn
,
SetUnsigned
,
isunsigned
);
return
bn
;
}
\ No newline at end of file
examples/terris/CMakeLists.txt
浏览文件 @
5377edad
...
...
@@ -11,7 +11,7 @@ add_executable (terris
"glad/include/KHR/khrplatform.h"
"glad/include/glad/gl.h"
"src/terris_main_module.c"
"src/blockwrite.c
pp
"
"src/blockwrite.c"
"src/flushtodisp.c"
"src/canblocksetto.c"
"src/terisctrl.c"
...
...
@@ -20,7 +20,8 @@ add_executable (terris
"src/terris_ctrl.c"
"src/checkline.c"
"src/panelinit.c"
"src/copylines.c"
)
"src/copylines.c"
)
target_link_libraries
(
terris SystemC::systemc hdl4sesim hdl4secell bignumber digitled hdl4seutils verilog_preprocess verilog_parser glui glfw lcom
)
...
...
examples/terris/src/blockwrite.c
浏览文件 @
5377edad
...
...
@@ -48,6 +48,7 @@
#define MODULE_NAME terris_block_write
#define MODULE_CLSID CLSID_TERRIS_BLOCKWRITE
#define PORT_COUNT 10
#define PARAM_COUNT 0
H4S_PORT
(
terris_block_write
)
H4S_IN
(
0
,
wClk
,
1
)
...
...
@@ -62,149 +63,36 @@ H4S_PORT(terris_block_write)
H4S_IN
(
9
,
bCurBlockPos
,
16
)
H4S_END_PORT
#if 0
MODULE_DECLARE
typedef struct _sTerrisBlockWrite {
OBJECT_HEADER
INTERFACE_DECLARE(IHDL4SEUnit)
HDL4SEUNIT_VARDECLARE
DLIST_VARDECLARE
IHDL4SEModule** parent;
char* name;
sc_signal <bool> *a, *b, *s, *c;
half_adder1 *padder;
IBigNumber** inputdata;
IHDL4SEUnit** input_unit[INPUTPORTCOUNT];
int input_index[INPUTPORTCOUNT];
MODULE_DECLARE
(
terris_block_write
)
unsigned
int
index
;
unsigned
int
readindex
;
/* 模拟读地址寄存器,比index晚一拍 */
unsigned
int
readindex_1
;
}sTerrisBlockWrite;
OBJECT_FUNCDECLARE(terris_blockwrite, CLSID_TERRIS_BLOCKWRITE);
END_MODULE_DECLARE
(
terris_block_write
)
HDL4SEUNIT_FUNCDECLARE(terris_blockwrite, CLSID_TERRIS_BLOCKWRITE, sTerrisBlockWrite);
DLIST_FUNCIMPL(terris_blockwrite, CLSID_TERRIS_BLOCKWRITE, sTerrisBlockWrite);
OBJECT_FUNCIMPL(terris_blockwrite, sTerrisBlockWrite, CLSID_TERRIS_BLOCKWRITE);
QUERYINTERFACE_BEGIN(terris_blockwrite, CLSID_TERRIS_BLOCKWRITE)
QUERYINTERFACE_ITEM(IID_HDL4SEUNIT, IHDL4SEUnit, sTerrisBlockWrite)
QUERYINTERFACE_ITEM(IID_DLIST, IDList, sTerrisBlockWrite)
QUERYINTERFACE_END
static const char* terris_blockwriteModuleInfo()
{
return "0.3.0-20210622.1411 Terris BlockWrite module";
}
static int terris_blockwriteCreate(const PARAMITEM* pParams, int paramcount, HOBJECT* pObject)
{
sTerrisBlockWrite* pobj;
int i;
pobj = (sTerrisBlockWrite*)malloc(sizeof(sTerrisBlockWrite));
if (pobj == NULL)
return -1;
*pObject = 0;
HDL4SEUNIT_VARINIT(pobj, CLSID_TERRIS_BLOCKWRITE);
INTERFACE_INIT(IHDL4SEUnit, pobj, terris_blockwrite, hdl4se_unit);
DLIST_VARINIT(pobj, terris_blockwrite);
pobj->name = NULL;
pobj->parent = NULL;
#if 1
pobj->padder = new half_adder1("adder_test1");
pobj->a = new sc_signal <bool>;
pobj->b = new sc_signal <bool>;
pobj->s = new sc_signal <bool>;
pobj->c = new sc_signal <bool>;
//pobj->padder->a(*pobj->a);
//pobj->padder->b(*pobj->b);
//pobj->padder->sum(*pobj->s);
//pobj->padder->carry(*pobj->c);
(*pobj->padder) << *pobj->a << *pobj->b << *pobj->s << *pobj->c;
#endif
for (i = 0;i< INPUTPORTCOUNT;i++)
pobj->input_unit[i] = NULL;
pobj->inputdata = bigintegerCreate(64);
MODULE_INIT
(
terris_block_write
)
pobj
->
index
=
0
;
for (i = 0; i < paramcount; i++) {
if (pParams[i].name == PARAMID_HDL4SE_UNIT_NAME) {
if (pobj->name != NULL)
free(pobj->name);
pobj->name = strdup((const char *)pParams[i].pvalue);
}
else if (pParams[i].name == PARAMID_HDL4SE_UNIT_PARENT) {
pobj->parent = (IHDL4SEModule **)pParams[i].pvalue;
}
}
/* 返回生成的对象 */
OBJECT_RETURN_GEN(terris_blockwrite, pobj, pObject, CLSID_TERRIS_BLOCKWRITE);
return EIID_OK;
}
static void terris_blockwriteDestroy(HOBJECT object)
{
sTerrisBlockWrite* pobj;
int i;
pobj = (sTerrisBlockWrite*)objectThis(object);
if (pobj->name != NULL)
free(pobj->name);
for (i = 0; i < INPUTPORTCOUNT; i++)
objectRelease(pobj->input_unit[i]);
objectRelease(pobj->inputdata);
ALWAYS_AT_CHANGED
(
terris_block_write
,
(
*
),
Generate_Output
)
END_ALWAYS_AT_CHANGED
(
terris_block_write
)
memset(pobj, 0, sizeof(sTerrisBlockWrite));
free(pobj);
}
ALWAYS_AT_POSEDGE
(
terris_block_write
,
wClk
,
UpdateReg
)
END_ALWAYS_AT_POSEDGE
(
terris_block_write
)
END_MODULE_INIT
(
terris_block_write
)
static int terris_blockwriteValid(HOBJECT object)
{
sTerrisBlockWrite* pobj;
pobj = (sTerrisBlockWrite*)objectThis(object);
return 1;
}
MODULE_DEINIT
(
terris_block_write
)
END_MODULE_DEINIT
(
terris_block_write
)
static int terris_blockwrite_hdl4se_unit_GetName(HOBJECT object, const char** pname)
{
sTerrisBlockWrite* pobj;
pobj = (sTerrisBlockWrite*)objectThis(object);
*pname = pobj->name;
return 0;
}
static int terris_blockwrite_hdl4se_unit_ConnectInput(HOBJECT object, int index, HOBJECT from, int fromindex)
{
#define CONNECTPORT(ind, innerind) \
if (index == ind) { \
if (0 == objectQueryInterface(from, IID_HDL4SEUNIT, (const void**)&unit)) { \
objectRelease(pobj->input_unit[innerind]); \
pobj->input_unit[innerind] = unit; \
pobj->input_index[innerind] = fromindex; \
} \
}
FUNC_DEFINE
(
terris_block_write
,
Generate_Output
)
END_FUNC_DEFINE
sTerrisBlockWrite* pobj;
IHDL4SEUnit** unit = NULL;
pobj = (sTerrisBlockWrite*)objectThis(object);
CONNECTPORT( 1, 0); /* bCtrlState */
CONNECTPORT( 4, 1); /* bBWReadData */
CONNECTPORT( 8, 2); /* bCurBlock */
CONNECTPORT( 9, 3); /* bCurBlockPos */
return 0;
}
FUNC_DEFINE
(
terris_block_write
,
UpdateReg
)
pobj
->
readindex_1
=
pobj
->
readindex
;
pobj
->
readindex
=
pobj
->
index
;
END_FUNC_DEFINE
#if 0
static unsigned long long terris_blockwrite_hdl4se_unit_GetWriteData(sTerrisBlockWrite* pobj, int blockx, int blocky)
{
int i;
...
...
hdl4secell/include/hdl4se_macros.h
浏览文件 @
5377edad
...
...
@@ -62,6 +62,8 @@ typedef struct sModulePortInfo {
#define H4S_PORT(module_name) static const ModulePortInfo module_name##_port_info_list[PORT_COUNT] = {
#define H4S_IN(index, name, width) {index, PORT_INPUT, #name, width, 1},
#define H4S_OUT(index, name, width) {index, PORT_INPUT, #name, width, 1},
#define H4S_IN_SIGNED(index, name, width) {index, PORT_INPUT, #name, width, 0},
#define H4S_OUT_SIGNED(index, name, width) {index, PORT_INPUT, #name, width, 0},
#define H4S_END_PORT };
typedef
struct
sHDL4SEREG
{
...
...
@@ -82,256 +84,161 @@ typedef struct sHDL4SEREG {
#define REG_SETUP(r) objectCall1(pobj->__reg_##r.vout, Assign, pobj->__reg_##r.vin)
#define REG_KEEP(r) objectCall1(pobj->__reg_##r.vin, Assign, pobj->__reg_##r.vout)
#define MODULE_DECLARE \
typedef struct _sHDL4SE_##
MODULE_NAME
{ \
#define MODULE_DECLARE
(module_name)
\
typedef struct _sHDL4SE_##
module_name
{ \
OBJECT_HEADER \
INTERFACE_DECLARE(IHDL4SEUnit) \
HDL4SEUNIT_VARDECLARE \
DLIST_VARDECLARE \
\
IHDL4SEModule * *parent; \
char* name; \
int datavalid; \
IHDL4SEModule **__parent; \
char* __name; \
int __datavalid; \
char * __parameters[PARAM_COUNT + 1]; \
\
IBigNumber** __data[PORT_COUNT];\
IHDL4SEUnit** input_unit[PORT_COUNT]; \
int input_index[PORT_COUNT]; \
IBigNumber** __inputdata; \
int __port_datavalid[PORT_COUNT]; \
IBigNumber** __port_data[PORT_COUNT];\
IHDL4SEUnit** __input_unit[PORT_COUNT]; \
int __input_index[PORT_COUNT]; \
#define END_DECLARE }_sHDL4SE_##MODULE_NAME; \
#define END_MODULE_DECLARE(module_name) }sHDL4SE_##module_name; \
\
OBJECT_FUNCDECLARE(
MODULE_NAME
, MODULE_CLSID); \
HDL4SEUNIT_FUNCDECLARE(
MODULE_NAME, MODULE_CLSID, _sHDL4SE_##MODULE_NAME
); \
DLIST_FUNCIMPL(
MODULE_NAME, clsid, _sHDL4SE_##MODULE_NAME
); \
OBJECT_FUNCDECLARE(
module_name
, MODULE_CLSID); \
HDL4SEUNIT_FUNCDECLARE(
module_name, MODULE_CLSID, sHDL4SE_##module_name
); \
DLIST_FUNCIMPL(
module_name, clsid, sHDL4SE_##module_name
); \
\
OBJECT_FUNCIMPL(
MODULE_NAME, _sHDL4SE_##MODULE_NAME
, MODULE_CLSID); \
OBJECT_FUNCIMPL(
module_name, sHDL4SE_##module_name
, MODULE_CLSID); \
\
QUERYINTERFACE_BEGIN(
MODULE_NAME
, MODULE_CLSID) \
QUERYINTERFACE_ITEM(IID_HDL4SEUNIT, IHDL4SEUnit,
_sHDL4SE_##MODULE_NAME
) \
QUERYINTERFACE_ITEM(IID_DLIST, IDList,
_sHDL4SE_##MODULE_NAME
) \
QUERYINTERFACE_BEGIN(
module_name
, MODULE_CLSID) \
QUERYINTERFACE_ITEM(IID_HDL4SEUNIT, IHDL4SEUnit,
sHDL4SE_##module_name
) \
QUERYINTERFACE_ITEM(IID_DLIST, IDList,
sHDL4SE_##module_name
) \
QUERYINTERFACE_END \
\
static const char*
MODULE_NAME
##ModuleInfo() \
static const char*
module_name
##ModuleInfo() \
{ \
return MODULE_VERSION_STRING; \
}
\
}
#define MODULE_INIT \
static int
MODULE_NAME
##Create(const PARAMITEM* pParams, int paramcount, HOBJECT* pObject) \
#define MODULE_INIT
(module_name)
\
static int
module_name
##Create(const PARAMITEM* pParams, int paramcount, HOBJECT* pObject) \
{ \
_sHDL4SE_##
name* pobj; \
int i; \
pobj = (
_sHDL4SE_##name*)malloc(sizeof(_sHDL4SE_##
name)); \
sHDL4SE_##module_
name* pobj; \
int
__
i; \
pobj = (
sHDL4SE_##module_name*)malloc(sizeof(sHDL4SE_##module_
name)); \
if (pobj == NULL) \
return -1; \
memset(pobj, 0, sizeof(sizeof(sHDL4SE_##module_name))); \
*pObject = 0; \
HDL4SEUNIT_VARINIT(pobj, clsid); \
INTERFACE_INIT(IHDL4SEUnit, pobj, name, hdl4se_unit); \
DLIST_VARINIT(pobj, name); \
INTERFACE_INIT(IHDL4SEUnit, pobj,
module_
name, hdl4se_unit); \
DLIST_VARINIT(pobj,
module_
name); \
\
for (i = 0; i < PORTCOUNT; i++) \
pobj->input_unit[i] = NULL; \
pobj->inputdata = bigintegerCreate(64); \
pobj->name = NULL; \
pobj->parent = NULL; \
pobj->datavalid = 0; \
#define PARAM_INIT \
{ \
for (i = 0; i < paramcount; i++) { \
if (pParams[i].name == PARAMID_HDL4SE_UNIT_NAME) { \
if (pobj->name != NULL) \
free(pobj->name); \
pobj->name = strdup(pParams[i].pvalue); \
for (__i = 0; __i < PORT_COUNT; __i++) {\
pobj->__input_unit[__i] = NULL; \
pobj->__port_data[__i] = bigintegerCreate2( \
module_name##_port_info_list[__i].width, \
module_name##_port_info_list[__i].isunsigned \
); \
} \
else if (pParams[i].name == PARAMID_HDL4SE_UNIT_PARENT) { \
pobj->parent = (IHDL4SEModule**)pParams[i].pvalue; \
pobj->__inputdata = bigintegerCreate(64); \
pobj->__name = NULL; \
pobj->__parent = NULL; \
pobj->__datavalid = 0; \
for (__i = 0; __i < paramcount; __i++) { \
if (pParams[__i].name == PARAMID_HDL4SE_UNIT_NAME) { \
if (pobj->__name != NULL) \
free(pobj->__name); \
pobj->__name = strdup(pParams[__i].pvalue); \
} \
else if (pParams[i].name == PARAMID_HDL4SE_UNIT_INSTANCE_PARAMETERS) {
#define PARAM_ITEM pParams[i]
#define END_PARAM_INIT \
else if (pParams[__i].name == PARAMID_HDL4SE_UNIT_PARENT) { \
pobj->__parent = (IHDL4SEModule**)pParams[__i].pvalue; \
} \
else if (pParams[__i].name == PARAMID_HDL4SE_UNIT_INSTANCE_PARAMETERS) { \
hdl4se_split_string((const char*)pParams[__i].pvalue, pobj->__parameters, PARAM_COUNT, ','); \
} \
}
#define END_MODULE_INIT \
OBJECT_RETURN_GEN(
MODULE_NAME
, pobj, pObject, MODULE_CLSID); \
#define END_MODULE_INIT
(module_name)
\
OBJECT_RETURN_GEN(
module_name
, pobj, pObject, MODULE_CLSID); \
return EIID_OK; \
} \
#if 0
static void cnncell_coeffbufDestroy(HOBJECT object) \
{ \
sCNNCellCoeffBuf* pobj;
int i;
pobj = (sCNNCellCoeffBuf*)objectThis(object);
if (pobj->name != NULL)
free(pobj->name);
for (i = 0; i < INPUTPORTCOUNT; i++)
objectRelease(pobj->input_unit[i]);
objectRelease(pobj->inputdata);
if (pobj->pCoeffFile != NULL)
fclose(pobj->pCoeffFile);
memset(pobj, 0, sizeof(sCNNCellCoeffBuf));
free(pobj);
}
static int cnncell_coeffbufValid(HOBJECT object)
{
sCNNCellCoeffBuf* pobj;
pobj = (sCNNCellCoeffBuf*)objectThis(object);
if (pobj->pCoeffFile == NULL)
return 0;
return 1;
}
static int cnncell_coeffbuf_hdl4se_unit_GetName(HOBJECT object, const char** pname)
{
sCNNCellCoeffBuf* pobj;
pobj = (sCNNCellCoeffBuf*)objectThis(object);
*pname = pobj->name;
return 0;
}
static int cnncell_coeffbuf_hdl4se_unit_Connect(HOBJECT object, int index, HOBJECT from, int fromindex)
{
#define CONNECTPORT(ind, innerind) \
if (index == ind) { \
if (0 == objectQueryInterface(from, IID_HDL4SEUNIT, (void**)&unit)) { \
objectRelease(pobj->input_unit[innerind]); \
pobj->input_unit[innerind] = unit; \
pobj->input_index[innerind] = fromindex; \
} \
}
sCNNCellCoeffBuf* pobj;
IHDL4SEUnit** unit = NULL;
pobj = (sCNNCellCoeffBuf*)objectThis(object);
CONNECTPORT(1, 0); /* nwReset */
CONNECTPORT(2, 1); /* wCoeffRead */
CONNECTPORT(4, 2); /* bCoeffReadAddr */
return 0;
}
MODULE(cnncell_coeffbuf, CLSID_CNN_COEFFBUF)
MODULE_PARAM
HDL_STRING_PARAM(filename, "");
END_PARAM
MODULE_PORT
HDL_IN(wClk, 1);
HDL_IN(nwReset, 1);
HDL_IN(wCoeffRead, 1);
HDL_OUT(wCoeffReadValid, 1);
HDL_IN(bCoeffReadAddr, 32);
HDL_OUT(bCoeffReadData, 32);
END_PORT
MODULE_VARIABLE
HDL_REG(readcmd, 1);
HDL_REG(read_addr, 32);
HDL_INT(tt, 32);
HDL_UINT(utt, 58);
FILE * pFile;
END_VARIABLE
DEFINE_SUBMODULE
END_SUBMODULE
pFile = fopen(GET_PARAM(filename), "r");
if (pFile == NULL) {
HDL_RETURN(-1);
}
ENDMODULE
ON_DESTROY
if (OBJ(pFile) != NULL) {
fclose(OBJ(pFile));
OBJ(pFile) = NULL;
}
END_DESTROY
GENERATE_OUTPUT
END_GENERATE_OUTPUT
ON_CLOCK
END_ON_CLOCK
*/
#ifdef WIN32
#define DATADIR "d:/gitwork/hdl4se/examples/hdl4secnn/googlenet/model-data"
#else
#define DATADIR "/media/raoxianhong/_dde_data/gitwork/hdl4se/examples/hdl4secnn/googlenet/model-data"
#endif
#define ALWAYS_AT_CHANGED(module_name, changed_list, callbackfunc)
#define END_ALWAYS_AT_CHANGED(module_name)
#define ALWAYS_AT_POSEDGE(module_name, signal, callbackfunc)
#define END_ALWAYS_AT_POSEDGE(module_name)
#define ALWAYS_AT_NEGEDGE(module_name, signal, callbackfunc)
#define END_ALWAYS_AT_NEGEDGE(module_name)
/* wClk不算 */
#define INPUTPORTCOUNT 3
static
int
cnncell_coeffbuf_hdl4se_unit_GetValue
(
HOBJECT
object
,
int
index
,
int
width
,
IBigNumber
**
value
)
{
sCNNCellCoeffBuf
*
pobj
;
pobj
=
(
sCNNCellCoeffBuf
*
)
objectThis
(
object
);
if
(
pobj
->
read_reg
)
{
if
(
fseek
(
pobj
->
pCoeffFile
,
pobj
->
read_addr_reg
,
SEEK_SET
)
==
0
)
{
if
(
index
==
3
)
{
if
(
width
<=
0
)
{
objectCall1
(
value
,
SetUnsigned
,
1
);
objectCall1
(
value
,
SetWidth
,
1
);
}
objectCall1
(
value
,
AssignInt32
,
1
);
}
else
if
(
index
==
5
)
{
unsigned
int
v
;
fread
(
&
v
,
4
,
1
,
pobj
->
pCoeffFile
);
if
(
width
<=
0
)
{
objectCall1
(
value
,
SetUnsigned
,
1
);
objectCall1
(
value
,
SetWidth
,
32
);
}
objectCall1
(
value
,
AssignUint32
,
v
);
}
return
0
;
}
}
if
(
index
==
3
)
{
if
(
width
<=
0
)
{
objectCall1
(
value
,
SetUnsigned
,
1
);
objectCall1
(
value
,
SetWidth
,
1
);
}
objectCall1
(
value
,
AssignInt32
,
0
);
}
return
0
;
}
#define FUNC_DEFINE(module_name, funcname) \
static int module_name_func_##funcname(sHDL4SE_##module_name* pobj) {
static
int
cnncell_coeffbuf_hdl4se_unit_ClkTick
(
HOBJECT
object
)
{
#define GetInputValue(ind, v) \
do { \
objectCall3(pobj->input_unit[ind], GetValue, pobj->input_index[ind], 32, pobj->inputdata); \
objectCall1(pobj->inputdata, GetUint32, &v); \
} while (0)
#define END_FUNC_DEFINE return 0; }
sCNNCellCoeffBuf
*
pobj
;
pobj
=
(
sCNNCellCoeffBuf
*
)
objectThis
(
object
);
GetInputValue
(
1
,
pobj
->
readcmd
);
GetInputValue
(
2
,
pobj
->
read_addr
);
}
#define MODULE_DEINIT(module_name) \
static void module_name##Destroy(HOBJECT object) \
{ \
sHDL4SE_##module_name* pobj; \
int i; \
pobj = (sHDL4SE_##module_name*)objectThis(object); \
if (pobj->__name != NULL) \
free(pobj->__name); \
for (i = 0; i < PORT_COUNT; i++) { \
objectRelease(pobj->__input_unit[i]); \
objectRelease(pobj->__port_data[i]); \
} \
for (i = 0; i < PARAM_COUNT + 1; i++) { \
if (pobj->__parameters[i] != NULL) \
free(pobj->__parameters[i]); \
} \
objectRelease(pobj->__inputdata); \
static
int
cnncell_coeffbuf_hdl4se_unit_Setup
(
HOBJECT
object
)
{
sCNNCellCoeffBuf
*
pobj
;
#define END_MODULE_DEINIT(module_name) \
memset(pobj, 0, sizeof(sHDL4SE_##module_name)); \
free(pobj); \
} \
\
static int module_name##Valid(HOBJECT object) \
{ \
return 1; \
} \
\
static int module_name##_hdl4se_unit_GetName(HOBJECT object, const char** pname) \
{ \
sHDL4SE_##module_name* pobj; \
pobj = (sHDL4SE_##module_name*)objectThis(object); \
*pname = pobj->__name; \
return 0; \
} \
\
static int module_name##_hdl4se_unit_ConnectInput(HOBJECT object, int index, HOBJECT from, int fromindex) \
{ \
int i; \
sHDL4SE_##module_name* pobj; \
IHDL4SEUnit** unit = NULL; \
pobj = (sHDL4SE_##module_name*)objectThis(object); \
for (i = 0; i < PORT_COUNT; i++) { \
if (index == i) { \
if (module_name##_port_info_list[i].portdirect == PORT_INPUT) { \
\
if (0 == objectQueryInterface(from, IID_HDL4SEUNIT, (void**)&unit)) { \
\
objectRelease(pobj->__input_unit[i]); \
pobj->__input_unit[i] = unit; \
pobj->__input_index[i] = fromindex; \
} \
} \
else { \
/* error: connect output port to driver*/
\
} \
} \
} \
return 0; \
} \
pobj
=
(
sCNNCellCoeffBuf
*
)
objectThis
(
object
);
pobj
->
read_reg
=
pobj
->
readcmd
;
pobj
->
read_addr_reg
=
pobj
->
read_addr
;
return
0
;
}
#endif
int
hdl4se_split_string
(
const
char
*
string
,
char
**
substr
,
int
substrcount
,
int
gap
);
#endif
/* _ASMLANGUAGE */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录