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

用宏来写HDL4SE模型

上级 72f4d86e
......@@ -230,10 +230,14 @@ static const IBigNumber _obj##_bn_interface = { \
_obj##_bn_SetBits32, \
_obj##_bn_GetBit, \
_obj##_bn_SetBit, \
_obj##_bn_GetInt32, \
_obj##_bn_GetInt32, \
_obj##_bn_GetInt64, \
_obj##_bn_GetUint32, \
_obj##_bn_GetUint64, \
_obj##_bn_ReadInt32, \
_obj##_bn_ReadInt64, \
_obj##_bn_ReadUint32, \
_obj##_bn_ReadUint64, \
_obj##_bn_GetStr, \
_obj##_bn_AssignInt32, \
_obj##_bn_AssignInt64, \
......
......@@ -31,7 +31,7 @@
/*
* Created by HDL4SE @ Fri Jul 9 05:44:45 2021
* Created by HDL4SE @ Sat Jul 10 18:49:48 2021
* Don't edit it.
*/
......
......@@ -45,59 +45,35 @@
#include "terris.h"
#define MODULE_VERSION_STRING "0.3.0-20210622.1411 Terris BlockWrite module"
#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)
H4S_IN (1, bCtrlState, 4)
H4S_OUT(2, wCtrlStateComplete, 1)
H4S_OUT(3, bBWReadAddr, 6)
H4S_IN (4, bBWReadData, 64)
H4S_OUT(5, wBWWrite, 1)
H4S_OUT(6, bBWWriteAddr, 6)
H4S_OUT(7, bBWWriteData, 64)
H4S_IN (8, bCurBlock, 64)
H4S_IN (9, bCurBlockPos, 16)
H4S_PORT(terris_blockwrite)
H4S_IN (0, wClk, 1)
H4S_IN (1, bCtrlState, 4)
H4S_OUT(2, wCtrlStateComplete, 1)
H4S_OUT(3, bBWReadAddr, 6)
H4S_IN (4, bBWReadData, 64)
H4S_OUT(5, wBWWrite, 1)
H4S_OUT(6, bBWWriteAddr, 6)
H4S_OUT(7, bBWWriteData, 64)
H4S_IN (8, bCurBlock, 64)
H4S_IN (9, bCurBlockPos, 16)
H4S_END_PORT
MODULE_DECLARE(terris_block_write)
MODULE_DECLARE(terris_blockwrite)
unsigned int index;
unsigned int readindex; /* 模拟读地址寄存器,比index晚一拍 */
unsigned int readindex_1;
END_MODULE_DECLARE(terris_block_write)
DEFINE_FUNC(terris_block_write, terris_block_write_Generate_Output)
END_DEFINE_FUNC
DEFINE_FUNC(terris_block_write, terris_block_write_UpdateReg)
pobj->readindex_1 = pobj->readindex;
pobj->readindex = pobj->index;
END_DEFINE_FUNC
MODULE_INIT(terris_block_write)
pobj->index = 0;
GEN_OUTPUT_FUNC(terris_block_write, "*", terris_block_write_Generate_Output);
AT_CLK_FUNC(terris_block_write, terris_block_write_UpdateReg);
END_MODULE_INIT(terris_block_write)
MODULE_DEINIT(terris_block_write)
END_MODULE_DEINIT(terris_block_write)
END_MODULE_DECLARE(terris_blockwrite)
#if 0
static unsigned long long terris_blockwrite_hdl4se_unit_GetWriteData(sTerrisBlockWrite* pobj, int blockx, int blocky)
static unsigned long long terris_blockwrite_hdl4se_unit_GetWriteData(MODULE_DATA_TYPE(terris_blockwrite)* pobj, int blockx, int blocky)
{
int i;
unsigned long long line, curblock, curblockline;
objectCall3(pobj->input_unit[1], GetValue, pobj->input_index[1], 64, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint64, &line);
objectCall3(pobj->input_unit[2], GetValue, pobj->input_index[2], 64, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint64, &curblock);
curblockline = (curblock >> ((3-pobj->readindex_1) * 16)) & 0xffff;
GetPortUint64(4, line);
GetPortUint64(8, curblock);
curblockline = (curblock >> ((3 - pobj->readindex_1) * 16)) & 0xffff;
if (blockx < 3)
curblockline >>= ((3 - blockx) * 4);
else
......@@ -105,62 +81,55 @@ static unsigned long long terris_blockwrite_hdl4se_unit_GetWriteData(sTerrisBloc
return line | curblockline;
}
static int terris_blockwrite_hdl4se_unit_GetValue(HOBJECT object, int index, int width, IBigNumber ** value)
{
sTerrisBlockWrite* pobj;
pobj = (sTerrisBlockWrite*)objectThis(object);
DEFINE_FUNC_INDEX(terris_blockwrite, do_Generate_WriteData) {
unsigned int blockpos;
unsigned int blockx, blocky;
objectCall3(pobj->input_unit[3], GetValue, pobj->input_index[3], 16, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &blockpos);
GetPortUint32(9, blockpos);
blockx = blockpos & 0xff;
blocky = blockpos >> 8;
if (index == 2) { /* wCtrlStateComplete */
objectCall1(value, AssignUint32, (pobj->readindex_1 >= 4)?1:0);
}
else if (index == 3) {/* bBWReadAddr */
objectCall1(value, AssignUint32, pobj->readindex + blocky - 4);
}
else if (index == 5) {/* wBWWrite */
objectCall1(value, AssignUint32, ( (pobj->readindex > 0) && (pobj->readindex_1 >= 0) && (pobj->readindex_1 <= 3) ) ? 1 : 0);
}
else if (index == 6) {/* bBWWriteAddr */
objectCall1(value, AssignUint32, pobj->readindex_1 + blocky - 4);
}
else if (index == 7) {/* bBWWriteData */
objectCall1(value, AssignUint64, terris_blockwrite_hdl4se_unit_GetWriteData(pobj, blockx, blocky));
}
return 0;
}
SetPortUint64(7, terris_blockwrite_hdl4se_unit_GetWriteData(pobj, blockx, blocky));
} END_DEFINE_FUNC
static int terris_blockwrite_hdl4se_unit_ClkTick(HOBJECT object)
{
sTerrisBlockWrite* pobj;
pobj = (sTerrisBlockWrite*)objectThis(object);
DEFINE_FUNC_INDEX(terris_blockwrite, do_Generate_Output_36) {
unsigned int blockpos;
unsigned int blocky;
GetPortUint32(9, blockpos);
blocky = blockpos >> 8;
SetPortUint32(3, pobj->readindex + blocky - 4);
SetPortUint32(6, pobj->readindex_1 + blocky - 4);
} END_DEFINE_FUNC
DEFINE_FUNC_INDEX(terris_blockwrite, do_Generate_Output_25) {
SetPortUint32(2, (pobj->readindex_1 >= 4) ? 1 : 0);
SetPortUint32(5, ((pobj->readindex > 0) && (pobj->readindex_1 >= 0) && (pobj->readindex_1 <= 3)) ? 1 : 0);
} END_DEFINE_FUNC
DEFINE_FUNC(terris_blockwrite, do_ClkTick) {
unsigned int ctrlstate;
objectCall3(pobj->input_unit[0], GetValue, pobj->input_index[0], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &ctrlstate);
GetPortUint32(1, ctrlstate);
if (ctrlstate == ST_BLOCKWRITE) {
pobj->index = pobj->readindex + 1;
}
else {
pobj->index = 0;
}
*pobj->a = rand() % 2;
*pobj->b = rand() % 2;
int a = pobj->a->read();
int b = pobj->b->read();
int s = pobj->s->read();
return 0;
}
} END_DEFINE_FUNC
static int terris_blockwrite_hdl4se_unit_Setup(HOBJECT object)
{
sTerrisBlockWrite* pobj;
pobj = (sTerrisBlockWrite*)objectThis(object);
DEFINE_FUNC(terris_blockwrite, do_UpdateReg) {
pobj->readindex_1 = pobj->readindex;
pobj->readindex = pobj->index;
return 0;
}
} END_DEFINE_FUNC
MODULE_INIT(terris_blockwrite) {
pobj->index = 0;
GENOUTPUT_FUNC("wCtrlStateComplete, wBWWrite", do_Generate_Output_25);
GENOUTPUT_FUNC("bBWReadAddr, bBWWriteAddr", do_Generate_Output_36);
GENOUTPUT_FUNC("bBWWriteData", do_Generate_WriteData);
CLKTICK_FUNC(do_ClkTick);
SETUP_FUNC(do_UpdateReg);
} END_MODULE_INIT(terris_blockwrite)
MODULE_DEINIT(terris_blockwrite)
END_MODULE_DEINIT(terris_blockwrite)
#endif
\ No newline at end of file
......@@ -41,158 +41,38 @@
#include "dlist.h"
#include "bignumber.h"
#include "hdl4secell.h"
#include "hdl4se_macros.h"
#include "terris.h"
/*
00, input wClk,
01, input[3:0] bCtrlState,
02, output wCtrlStateComplete,
03, output[5:0] bFlushReadAddr,
04, input[63:0] bFlushReadData,
05, output wWrite,
06, output[31:0] bWriteAddr,
07, output[31:0] bWriteData,
08, input[31:0] bCtrlSpeed,
09, input[31:0] bCtrlLevel,
10, input[31:0] bCtrlScore,
11, input[63:0] bNextBlock,
12, input[63:0] bCurBlock,
13, input[15:0] bCurBlockPos
*/
/* wClk不算 */
#define INPUTPORTCOUNT 8
typedef struct _sTerrisFlushToDisp {
OBJECT_HEADER
INTERFACE_DECLARE(IHDL4SEUnit)
HDL4SEUNIT_VARDECLARE
DLIST_VARDECLARE
IHDL4SEModule** parent;
char* name;
IBigNumber** inputdata;
IHDL4SEUnit** input_unit[INPUTPORTCOUNT];
int input_index[INPUTPORTCOUNT];
#define MODULE_VERSION_STRING "0.3.0-20210622.0539 Terris Flush to Disp module"
#define MODULE_CLSID CLSID_TERRIS_FLUSHTODISP
#define PORT_COUNT 14
#define PARAM_COUNT 0
H4S_PORT(terris_flushtodisp)
H4S_IN(0, wClk, 1)
H4S_IN(1, bCtrlState, 4)
H4S_OUT(2, wCtrlStateComplete, 1)
H4S_OUT(3, bFlushReadAddr, 6)
H4S_IN(4, bFlushReadData, 64)
H4S_OUT(5, wWrite, 1)
H4S_OUT(6, bWriteAddr, 32)
H4S_OUT(7, bWriteData, 32)
H4S_IN(8, bCtrlSpeed, 32)
H4S_IN(9, bCtrlLevel, 32)
H4S_IN(10, bCtrlScore, 32)
H4S_IN(11, bNextBlock, 64)
H4S_IN(12, bCurBlock, 64)
H4S_IN(13, bCurBlockPos, 16)
H4S_END_PORT
MODULE_DECLARE(terris_flushtodisp)
unsigned int index;
unsigned int flushreadaddr; /* 模拟读地址寄存器,比index晚一拍 */
unsigned int flushreadaddr_last; /* 模拟读地址寄存器,比flushreadaddr晚一拍 */
END_MODULE_DECLARE(terris_flushtodisp)
}sTerrisFlushToDisp;
OBJECT_FUNCDECLARE(terris_flushtodisp, CLSID_TERRIS_FLUSHTODISP);
HDL4SEUNIT_FUNCDECLARE(terris_flushtodisp, CLSID_TERRIS_FLUSHTODISP, sTerrisFlushToDisp);
DLIST_FUNCIMPL(terris_flushtodisp, CLSID_TERRIS_FLUSHTODISP, sTerrisFlushToDisp);
OBJECT_FUNCIMPL(terris_flushtodisp, sTerrisFlushToDisp, CLSID_TERRIS_FLUSHTODISP);
QUERYINTERFACE_BEGIN(terris_flushtodisp, CLSID_TERRIS_FLUSHTODISP)
QUERYINTERFACE_ITEM(IID_HDL4SEUNIT, IHDL4SEUnit, sTerrisFlushToDisp)
QUERYINTERFACE_ITEM(IID_DLIST, IDList, sTerrisFlushToDisp)
QUERYINTERFACE_END
static const char* terris_flushtodispModuleInfo()
{
return "0.3.0-20210622.0539 Terris Flush to Disp module";
}
static int terris_flushtodispCreate(const PARAMITEM* pParams, int paramcount, HOBJECT* pObject)
{
sTerrisFlushToDisp* pobj;
int i;
pobj = (sTerrisFlushToDisp*)malloc(sizeof(sTerrisFlushToDisp));
if (pobj == NULL)
return -1;
*pObject = 0;
HDL4SEUNIT_VARINIT(pobj, CLSID_TERRIS_FLUSHTODISP);
INTERFACE_INIT(IHDL4SEUnit, pobj, terris_flushtodisp, hdl4se_unit);
DLIST_VARINIT(pobj, terris_flushtodisp);
pobj->name = NULL;
pobj->parent = NULL;
for (i = 0;i< INPUTPORTCOUNT;i++)
pobj->input_unit[i] = NULL;
pobj->inputdata = bigintegerCreate(64);
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(pParams[i].pvalue);
}
else if (pParams[i].name == PARAMID_HDL4SE_UNIT_PARENT) {
pobj->parent = (IHDL4SEModule **)pParams[i].pvalue;
}
}
/* 返回生成的对象 */
OBJECT_RETURN_GEN(terris_flushtodisp, pobj, pObject, CLSID_TERRIS_FLUSHTODISP);
return EIID_OK;
}
static void terris_flushtodispDestroy(HOBJECT object)
{
sTerrisFlushToDisp* pobj;
int i;
pobj = (sTerrisFlushToDisp*)objectThis(object);
if (pobj->name != NULL)
free(pobj->name);
for (i = 0; i < INPUTPORTCOUNT; i++)
objectRelease(pobj->input_unit[i]);
objectRelease(pobj->inputdata);
memset(pobj, 0, sizeof(sTerrisFlushToDisp));
free(pobj);
}
static int terris_flushtodispValid(HOBJECT object)
{
sTerrisFlushToDisp* pobj;
pobj = (sTerrisFlushToDisp*)objectThis(object);
return 1;
}
static int terris_flushtodisp_hdl4se_unit_GetName(HOBJECT object, const char** pname)
{
sTerrisFlushToDisp* pobj;
pobj = (sTerrisFlushToDisp*)objectThis(object);
*pname = pobj->name;
return 0;
}
static int terris_flushtodisp_hdl4se_unit_ConnectInput(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; \
} \
}
sTerrisFlushToDisp* pobj;
IHDL4SEUnit** unit = NULL;
pobj = (sTerrisFlushToDisp*)objectThis(object);
CONNECTPORT( 1, 0); /* bCtrlState */
CONNECTPORT( 4, 1); /* bFlushReadData */
CONNECTPORT( 8, 2); /* bCtrlSpeed */
CONNECTPORT( 9, 3); /* bCtrlLevel */
CONNECTPORT(10, 4); /* bCtrlScore */
CONNECTPORT(11, 5); /* bNextBlock */
CONNECTPORT(12, 6); /* bCurBlock */
CONNECTPORT(13, 7); /* bCurBlockPos */
return 0;
}
static unsigned int terris_flushtodisp_hdl4se_unit_GetWriteData(sTerrisFlushToDisp* pobj)
{
DEFINE_FUNC_INDEX(terris_flushtodisp, do_Generate_WriteData) {
/*
* 按flushreadaddr_last的值
0 -- 47,面板内容, --> 7
......@@ -210,124 +90,100 @@ static unsigned int terris_flushtodisp_hdl4se_unit_GetWriteData(sTerrisFlushToDi
int i;
unsigned int y = pobj->flushreadaddr_last >> 1;
objectCall3(pobj->input_unit[7], GetValue, pobj->input_index[7], 16, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &blockpos);
GetPortUint32(13, blockpos);
blockx = blockpos & 0xff;
blocky = blockpos >> 8;
objectCall3(pobj->input_unit[6], GetValue, pobj->input_index[6], 64, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint64, &curblockdata);
objectCall3(pobj->input_unit[1], GetValue, pobj->input_index[1], 64, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint64, &data);
GetPortUint64(12, curblockdata);
GetPortUint64(4, data);
curblockline = 0;
for (i = 0; i < 4; i++) {
if (y == blocky + 0 - i) {
curblockline = (curblockdata >> (i * 16)) & 0xffff;
if (blockx < 3)
curblockline >>= ((3-blockx) * 4);
curblockline >>= ((3 - blockx) * 4);
else
curblockline <<= (blockx-3) * 4;
curblockline <<= (blockx - 3) * 4;
break;
}
}
data |= curblockline;
if (pobj->flushreadaddr_last & 1) {
return data >> 32;
SetPortUint32(7, data >> 32);
}
else {
return data & 0xffffffff;
SetPortUint32(7, data & 0xffffffff);
}
}
else if (pobj->flushreadaddr_last == 52 || pobj->flushreadaddr_last == 53) {
/*nextblock*/
unsigned long long nextblock;
objectCall3(pobj->input_unit[5], GetValue, pobj->input_index[5], 64, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint64, &nextblock);
GetPortUint64(11, nextblock);
if (pobj->flushreadaddr_last == 52) {
return nextblock & 0xffffffff;
SetPortUint32(7, nextblock & 0xffffffff);
}
else {
return nextblock >> 32;
SetPortUint32(7, nextblock >> 32);
}
}
else if (pobj->flushreadaddr_last == 56) {
/*score*/
unsigned int data;
objectCall3(pobj->input_unit[4], GetValue, pobj->input_index[4], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &data);
return data;
GetPortUint32(10, data);
SetPortUint32(7, data);
}
else if (pobj->flushreadaddr_last == 57) {
/*level*/
unsigned int data;
objectCall3(pobj->input_unit[3], GetValue, pobj->input_index[3], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &data);
return data;
GetPortUint32(9, data);
SetPortUint32(7, data);
}
else if (pobj->flushreadaddr_last == 58) {
/*speed*/
unsigned int data;
objectCall3(pobj->input_unit[2], GetValue, pobj->input_index[2], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &data);
return data;
GetPortUint32(8, data);
SetPortUint32(7, data);
}
return 0;
}
} END_DEFINE_FUNC
static int terris_flushtodisp_hdl4se_unit_GetValue(HOBJECT object, int index, int width, IBigNumber ** value)
{
int i;
sTerrisFlushToDisp* pobj;
pobj = (sTerrisFlushToDisp*)objectThis(object);
DEFINE_FUNC_INDEX(terris_flushtodisp, do_Generate_Output_236) {
SetPortUint32(2, (pobj->flushreadaddr == 60) ? 1 : 0);
SetPortUint32(3, (pobj->flushreadaddr >> 1));
SetPortUint32(6, 0xf0000010 + pobj->flushreadaddr_last * 4);
} END_DEFINE_FUNC
DEFINE_FUNC_INDEX(terris_flushtodisp, do_Generate_Output_5) {
unsigned int ctrlstate;
objectCall3(pobj->input_unit[0], GetValue, pobj->input_index[0], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &ctrlstate);
if (index == 2) { /* wCtrlStateComplete */
objectCall1(value, AssignUint32, (pobj->flushreadaddr == 60)?1:0);
}
else if (index == 3) {/* bFlushReadAddr */
objectCall1(value, AssignUint32, (pobj->flushreadaddr >> 1));
}
else if (index == 5) {/* wWrite */
if (ctrlstate == ST_FLUSHTODISP && (pobj->flushreadaddr_last < 48 || (pobj->flushreadaddr_last >= 52 && pobj->flushreadaddr_last <= 58)))
objectCall1(value, AssignUint32, 1);
else
objectCall1(value, AssignUint32, 0);
}
else if (index == 6) {/* wWriteAddr */
objectCall1(value, AssignUint32, 0xf0000010 + pobj->flushreadaddr_last * 4);
}
else if (index == 7) {/* wWriteData */
objectCall1(value, AssignUint32, terris_flushtodisp_hdl4se_unit_GetWriteData(pobj));
}
return 0;
}
GetPortUint32(1, ctrlstate);
SetPortUint32(5, (ctrlstate == ST_FLUSHTODISP && (pobj->flushreadaddr_last < 48 || (pobj->flushreadaddr_last >= 52 && pobj->flushreadaddr_last <= 58))) ? 1 : 0);
} END_DEFINE_FUNC
static int terris_flushtodisp_hdl4se_unit_ClkTick(HOBJECT object)
{
sTerrisFlushToDisp* pobj;
pobj = (sTerrisFlushToDisp*)objectThis(object);
DEFINE_FUNC(terris_flushtodisp, do_ClkTick) {
unsigned int ctrlstate;
objectCall3(pobj->input_unit[0], GetValue, pobj->input_index[0], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &ctrlstate);
GetPortUint32(1, ctrlstate);
if (ctrlstate == ST_FLUSHTODISP) {
pobj->index = pobj->flushreadaddr + 1;
}
else {
pobj->index = 0;
}
return 0;
}
} END_DEFINE_FUNC
static int terris_flushtodisp_hdl4se_unit_Setup(HOBJECT object)
{
sTerrisFlushToDisp* pobj;
pobj = (sTerrisFlushToDisp*)objectThis(object);
DEFINE_FUNC(terris_flushtodisp, do_UpdateReg) {
pobj->flushreadaddr_last = pobj->flushreadaddr;
pobj->flushreadaddr = pobj->index;
return 0;
}
} END_DEFINE_FUNC
MODULE_INIT(terris_flushtodisp) {
pobj->index = 0;
GENOUTPUT_FUNC("wWrite", do_Generate_Output_5);
GENOUTPUT_FUNC("wCtrlStateComplete, bWriteAddr, bFlushReadAddr", do_Generate_Output_236);
GENOUTPUT_FUNC("bWriteData", do_Generate_WriteData);
CLKTICK_FUNC(do_ClkTick);
SETUP_FUNC(do_UpdateReg);
} END_MODULE_INIT(terris_flushtodisp)
MODULE_DEINIT(terris_flushtodisp)
END_MODULE_DEINIT(terris_flushtodisp)
......@@ -30,9 +30,9 @@
*/
/*
* panelinit.c
* terris_init.c
修改记录:
202106231422: rxh, initial version
202106220539: rxh, initial version
*/
#include "stdlib.h"
#include "stdio.h"
......@@ -41,179 +41,57 @@
#include "dlist.h"
#include "bignumber.h"
#include "hdl4secell.h"
#include "hdl4se_macros.h"
#include "terris.h"
/*
00 input wClk,
01 input [3:0] bCtrlState,
02 output wCtrlStateComplete,
03 output wInitWrite,
04 output [5:0] bInitWriteAddr,
05 output [63:0] bInitWriteData
*/
/* wClk不算 */
#define INPUTPORTCOUNT 1
typedef struct _sTerrisInit {
OBJECT_HEADER
INTERFACE_DECLARE(IHDL4SEUnit)
HDL4SEUNIT_VARDECLARE
DLIST_VARDECLARE
IHDL4SEModule** parent;
char* name;
IBigNumber** inputdata;
IHDL4SEUnit** input_unit[INPUTPORTCOUNT];
int input_index[INPUTPORTCOUNT];
#define MODULE_VERSION_STRING "0.3.0-20210623.1422 Terris Panel Init module"
#define MODULE_CLSID CLSID_TERRIS_INIT
#define PORT_COUNT 6
#define PARAM_COUNT 0
H4S_PORT(terris_init)
H4S_IN(0, wClk, 1)
H4S_IN(1, bCtrlState, 4)
H4S_OUT(2, wCtrlStateComplete, 1)
H4S_OUT(3, wWrite, 1)
H4S_OUT(4, bWriteAddr, 6)
H4S_OUT(5, bWriteData, 64)
H4S_END_PORT
MODULE_DECLARE(terris_init)
unsigned int index;
unsigned int writeindex;
}sTerrisInit;
OBJECT_FUNCDECLARE(terris_init, CLSID_TERRIS_INIT);
HDL4SEUNIT_FUNCDECLARE(terris_init, CLSID_TERRIS_INIT, sTerrisInit);
DLIST_FUNCIMPL(terris_init, CLSID_TERRIS_INIT, sTerrisInit);
OBJECT_FUNCIMPL(terris_init, sTerrisInit, CLSID_TERRIS_INIT);
QUERYINTERFACE_BEGIN(terris_init, CLSID_TERRIS_INIT)
QUERYINTERFACE_ITEM(IID_HDL4SEUNIT, IHDL4SEUnit, sTerrisInit)
QUERYINTERFACE_ITEM(IID_DLIST, IDList, sTerrisInit)
QUERYINTERFACE_END
static const char* terris_initModuleInfo()
{
return "0.3.0-20210623.1422 Terris Panel Init module";
}
static int terris_initCreate(const PARAMITEM* pParams, int paramcount, HOBJECT* pObject)
{
sTerrisInit* pobj;
int i;
pobj = (sTerrisInit*)malloc(sizeof(sTerrisInit));
if (pobj == NULL)
return -1;
*pObject = 0;
HDL4SEUNIT_VARINIT(pobj, CLSID_TERRIS_INIT);
INTERFACE_INIT(IHDL4SEUnit, pobj, terris_init, hdl4se_unit);
DLIST_VARINIT(pobj, terris_init);
pobj->name = NULL;
pobj->parent = NULL;
for (i = 0;i< INPUTPORTCOUNT;i++)
pobj->input_unit[i] = NULL;
pobj->inputdata = bigintegerCreate(64);
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(pParams[i].pvalue);
}
else if (pParams[i].name == PARAMID_HDL4SE_UNIT_PARENT) {
pobj->parent = (IHDL4SEModule **)pParams[i].pvalue;
}
}
unsigned int writeindex;
END_MODULE_DECLARE(terris_init)
/* 返回生成的对象 */
OBJECT_RETURN_GEN(terris_init, pobj, pObject, CLSID_TERRIS_INIT);
return EIID_OK;
}
DEFINE_FUNC_INDEX(terris_init, do_Generate_Output) {
SetPortUint32(2, (pobj->writeindex > YCOUNT + 1) ? 1 : 0);
SetPortUint32(3, ((pobj->writeindex >= 0) && (pobj->writeindex <= YCOUNT)) ? 1 : 0);
SetPortUint32(4, pobj->writeindex);
SetPortUint64(5, 0);
} END_DEFINE_FUNC
static void terris_initDestroy(HOBJECT object)
{
sTerrisInit* pobj;
int i;
pobj = (sTerrisInit*)objectThis(object);
if (pobj->name != NULL)
free(pobj->name);
for (i = 0; i < INPUTPORTCOUNT; i++)
objectRelease(pobj->input_unit[i]);
objectRelease(pobj->inputdata);
memset(pobj, 0, sizeof(sTerrisInit));
free(pobj);
}
static int terris_initValid(HOBJECT object)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
return 1;
}
static int terris_init_hdl4se_unit_GetName(HOBJECT object, const char** pname)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
*pname = pobj->name;
return 0;
}
static int terris_init_hdl4se_unit_ConnectInput(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; \
} \
}
sTerrisInit* pobj;
IHDL4SEUnit** unit = NULL;
pobj = (sTerrisInit*)objectThis(object);
CONNECTPORT( 1, 0); /* bCtrlState */
return 0;
}
static int terris_init_hdl4se_unit_GetValue(HOBJECT object, int index, int width, IBigNumber ** value)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
if (index == 2) { /* wCtrlStateComplete */
objectCall1(value, AssignUint32, (pobj->writeindex > YCOUNT+1)?1:0);
}
else if (index == 3) {/* wWrite */
objectCall1(value, AssignUint32, ( (pobj->writeindex >= 0) && (pobj->writeindex <= YCOUNT) ) ? 1 : 0);
}
else if (index == 4) {/* bWriteAddr */
objectCall1(value, AssignUint32, pobj->writeindex);
}
else if (index == 5) {/* bWriteData */
objectCall1(value, AssignUint64, 0);
}
return 0;
}
static int terris_init_hdl4se_unit_ClkTick(HOBJECT object)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
DEFINE_FUNC(terris_init, do_ClkTick) {
unsigned int ctrlstate;
objectCall3(pobj->input_unit[0], GetValue, pobj->input_index[0], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &ctrlstate);
GetPortUint32(1, ctrlstate);
if (ctrlstate == ST_INIT) {
pobj->index = pobj->writeindex + 1;
}
else {
pobj->index = 0;
}
return 0;
}
} END_DEFINE_FUNC
static int terris_init_hdl4se_unit_Setup(HOBJECT object)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
DEFINE_FUNC(terris_init, do_Setup) {
pobj->writeindex = pobj->index;
return 0;
}
} END_DEFINE_FUNC
MODULE_INIT(terris_init) {
pobj->index = 0;
GENOUTPUT_FUNC("*", do_Generate_Output);
CLKTICK_FUNC(do_ClkTick);
SETUP_FUNC(do_Setup);
} END_MODULE_INIT(terris_init)
MODULE_DEINIT(terris_init)
END_MODULE_DEINIT(terris_init)
/*
** HDL4SE: 软件Verilog综合仿真平台
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** LCOM: 轻量级组件对象模型
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** * The name of the author may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
** THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* panelinit.c
修改记录:
202106231422: rxh, initial version
*/
#include "stdlib.h"
#include "stdio.h"
#include "string.h"
#include "object.h"
#include "dlist.h"
#include "bignumber.h"
#include "hdl4secell.h"
#include "terris.h"
/*
00 input wClk,
01 input [3:0] bCtrlState,
02 output wCtrlStateComplete,
03 output wInitWrite,
04 output [5:0] bInitWriteAddr,
05 output [63:0] bInitWriteData
*/
/* wClk不算 */
#define INPUTPORTCOUNT 1
typedef struct _sTerrisInit {
OBJECT_HEADER
INTERFACE_DECLARE(IHDL4SEUnit)
HDL4SEUNIT_VARDECLARE
DLIST_VARDECLARE
IHDL4SEModule** parent;
char* name;
IBigNumber** inputdata;
IHDL4SEUnit** input_unit[INPUTPORTCOUNT];
int input_index[INPUTPORTCOUNT];
unsigned int index;
unsigned int writeindex;
}sTerrisInit;
OBJECT_FUNCDECLARE(terris_init, CLSID_TERRIS_INIT);
HDL4SEUNIT_FUNCDECLARE(terris_init, CLSID_TERRIS_INIT, sTerrisInit);
DLIST_FUNCIMPL(terris_init, CLSID_TERRIS_INIT, sTerrisInit);
OBJECT_FUNCIMPL(terris_init, sTerrisInit, CLSID_TERRIS_INIT);
QUERYINTERFACE_BEGIN(terris_init, CLSID_TERRIS_INIT)
QUERYINTERFACE_ITEM(IID_HDL4SEUNIT, IHDL4SEUnit, sTerrisInit)
QUERYINTERFACE_ITEM(IID_DLIST, IDList, sTerrisInit)
QUERYINTERFACE_END
static const char* terris_initModuleInfo()
{
return "0.3.0-20210623.1422 Terris Panel Init module";
}
static int terris_initCreate(const PARAMITEM* pParams, int paramcount, HOBJECT* pObject)
{
sTerrisInit* pobj;
int i;
pobj = (sTerrisInit*)malloc(sizeof(sTerrisInit));
if (pobj == NULL)
return -1;
*pObject = 0;
HDL4SEUNIT_VARINIT(pobj, CLSID_TERRIS_INIT);
INTERFACE_INIT(IHDL4SEUnit, pobj, terris_init, hdl4se_unit);
DLIST_VARINIT(pobj, terris_init);
pobj->name = NULL;
pobj->parent = NULL;
for (i = 0;i< INPUTPORTCOUNT;i++)
pobj->input_unit[i] = NULL;
pobj->inputdata = bigintegerCreate(64);
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(pParams[i].pvalue);
}
else if (pParams[i].name == PARAMID_HDL4SE_UNIT_PARENT) {
pobj->parent = (IHDL4SEModule **)pParams[i].pvalue;
}
}
/* 返回生成的对象 */
OBJECT_RETURN_GEN(terris_init, pobj, pObject, CLSID_TERRIS_INIT);
return EIID_OK;
}
static void terris_initDestroy(HOBJECT object)
{
sTerrisInit* pobj;
int i;
pobj = (sTerrisInit*)objectThis(object);
if (pobj->name != NULL)
free(pobj->name);
for (i = 0; i < INPUTPORTCOUNT; i++)
objectRelease(pobj->input_unit[i]);
objectRelease(pobj->inputdata);
memset(pobj, 0, sizeof(sTerrisInit));
free(pobj);
}
static int terris_initValid(HOBJECT object)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
return 1;
}
static int terris_init_hdl4se_unit_GetName(HOBJECT object, const char** pname)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
*pname = pobj->name;
return 0;
}
static int terris_init_hdl4se_unit_ConnectInput(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; \
} \
}
sTerrisInit* pobj;
IHDL4SEUnit** unit = NULL;
pobj = (sTerrisInit*)objectThis(object);
CONNECTPORT( 1, 0); /* bCtrlState */
return 0;
}
static int terris_init_hdl4se_unit_GetValue(HOBJECT object, int index, int width, IBigNumber ** value)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
if (index == 2) { /* wCtrlStateComplete */
objectCall1(value, AssignUint32, (pobj->writeindex > YCOUNT+1)?1:0);
}
else if (index == 3) {/* wWrite */
objectCall1(value, AssignUint32, ( (pobj->writeindex >= 0) && (pobj->writeindex <= YCOUNT) ) ? 1 : 0);
}
else if (index == 4) {/* bWriteAddr */
objectCall1(value, AssignUint32, pobj->writeindex);
}
else if (index == 5) {/* bWriteData */
objectCall1(value, AssignUint64, 0);
}
return 0;
}
static int terris_init_hdl4se_unit_ClkTick(HOBJECT object)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
unsigned int ctrlstate;
objectCall3(pobj->input_unit[0], GetValue, pobj->input_index[0], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &ctrlstate);
if (ctrlstate == ST_INIT) {
pobj->index = pobj->writeindex + 1;
}
else {
pobj->index = 0;
}
return 0;
}
static int terris_init_hdl4se_unit_Setup(HOBJECT object)
{
sTerrisInit* pobj;
pobj = (sTerrisInit*)objectThis(object);
pobj->writeindex = pobj->index;
return 0;
}
......@@ -37,7 +37,7 @@
这一行如果存在,连接的就是c语言版本。
*/
(*
//HDL4SE="LCOM",
HDL4SE="LCOM",
CLSID="d588064-fcd3-43cc-b131-1a64c74d9e86",
softmodule="hdl4se"
*)
......
......@@ -32,7 +32,7 @@
/* panelinit.v */
(*
// HDL4SE="LCOM",
HDL4SE="LCOM",
CLSID="d6ef2a03-4c58-4b50-a966-44e156694304",
softmodule="hdl4se"
*)
......
......@@ -789,6 +789,7 @@ endmodule
(*
HDL4SE = "LCOM",
CLSID = "d588064-fcd3-43cc-b131-1a64c74d9e86",
softmodule = "hdl4se"
*)
......@@ -1055,6 +1056,7 @@ endmodule
(*
HDL4SE = "LCOM",
CLSID = "d6ef2a03-4c58-4b50-a966-44e156694304",
softmodule = "hdl4se"
*)
......
......@@ -60,15 +60,18 @@ 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_OUT(index, name, width) {index, PORT_OUTPUT, #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_OUT_SIGNED(index, name, width) {index, PORT_OUTPUT, #name, width, 0},
#define H4S_END_PORT };
#define MODULE_DATA_TYPE(module_name) sHDL4SE_##module_name
#define MODULE_DECLARE(module_name) \
struct _sHDL4SE_##module_name; \
typedef struct _sHDL4SE_##module_name sHDL4SE_##module_name; \
typedef int (*module_name##_func)(sHDL4SE_##module_name * pobj); \
typedef int (*module_name##_index_func)(sHDL4SE_##module_name * pobj, int index); \
struct _sHDL4SE_##module_name{ \
OBJECT_HEADER \
INTERFACE_DECLARE(IHDL4SEUnit) \
......@@ -79,14 +82,17 @@ struct _sHDL4SE_##module_name{ \
char* __name; \
int __datavalid; \
char * __parameters[PARAM_COUNT + 1]; \
const ModulePortInfo *__port_info_list; \
int __port_count; \
\
IBigNumber** __inputdata; \
int __port_datavalid[PORT_COUNT]; \
IBigNumber** __port_data[PORT_COUNT];\
IHDL4SEUnit** __input_unit[PORT_COUNT]; \
module_name##_func __output_gen_func[PORT_COUNT]; \
module_name##_index_func __output_gen_func[PORT_COUNT]; \
int __input_index[PORT_COUNT]; \
module_name##_func __clock_setup_func;
module_name##_func __setup_func; \
module_name##_func __clktick_func;
#define END_MODULE_DECLARE(module_name) }; \
\
......@@ -114,7 +120,7 @@ static int module_name##Create(const PARAMITEM* pParams, int paramcount, HOBJECT
pobj = (sHDL4SE_##module_name*)malloc(sizeof(sHDL4SE_##module_name)); \
if (pobj == NULL) \
return -1; \
memset(pobj, 0, sizeof(sizeof(sHDL4SE_##module_name))); \
memset(pobj, 0, sizeof(sHDL4SE_##module_name)); \
*pObject = 0; \
HDL4SEUNIT_VARINIT(pobj, clsid); \
INTERFACE_INIT(IHDL4SEUnit, pobj, module_name, hdl4se_unit); \
......@@ -131,6 +137,8 @@ static int module_name##Create(const PARAMITEM* pParams, int paramcount, HOBJECT
pobj->__name = NULL; \
pobj->__parent = NULL; \
pobj->__datavalid = 0; \
pobj->__port_info_list = module_name##_port_info_list; \
pobj->__port_count = PORT_COUNT; \
for (__i = 0; __i < paramcount; __i++) { \
if (pParams[__i].name == PARAMID_HDL4SE_UNIT_NAME) { \
if (pobj->__name != NULL) \
......@@ -155,7 +163,7 @@ static int hdl4se_set_output_func(const ModulePortInfo* portlist, int portcount,
char name[256];
const char* inp = signal_list;
char* namep = name;
while (*inp != 0) {
do {
int ch = *inp;
if (ch == '_' || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
*namep++ = ch;
......@@ -174,6 +182,7 @@ static int hdl4se_set_output_func(const ModulePortInfo* portlist, int portcount,
|| portlist[i].portdirect == PORT_INOUT) {
if (ch == '*' || strcmp(name, portlist[i].name) == 0) {
function_list[i] = func;
break;
}
}
}
......@@ -181,18 +190,28 @@ static int hdl4se_set_output_func(const ModulePortInfo* portlist, int portcount,
}
}
}
if (*inp == 0)
break;
inp++;
}
} while (1);
return 0;
}
#define GEN_OUTPUT_FUNC(module_name, signal_list, func) hdl4se_set_output_func(module_name##_port_info_list, PORT_COUNT, signal_list, (void *)func, (void **)pobj->__output_gen_func)
#define AT_CLK_FUNC(module_name, func) pobj->__clock_setup_func = func
#define GENOUTPUT_FUNC(signal_list, func) hdl4se_set_output_func(pobj->__port_info_list, pobj->__port_count, signal_list, (void *)func, (void **)pobj->__output_gen_func)
#define SETUP_FUNC(func) pobj->__setup_func = func
#define CLKTICK_FUNC(func) pobj->__clktick_func = func
#define DEFINE_FUNC(module_name, funcname) \
static int funcname(sHDL4SE_##module_name* pobj) {
#define END_DEFINE_FUNC return 0; }
#define DEFINE_FUNC_INDEX(module_name, funcname) \
static int funcname(sHDL4SE_##module_name* pobj, int index) {
#define END_DEFINE_FUNC return 0; }
#define MODULE_DEINIT(module_name) \
static void module_name##Destroy(HOBJECT object) \
{ \
......@@ -231,29 +250,131 @@ static int module_name##_hdl4se_unit_GetName(HOBJECT object, const char** pname)
\
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*/ \
} \
if (index < 0 || index >= pobj->__port_count) \
return -1; \
if (pobj->__port_info_list[index].portdirect == PORT_INPUT) { \
if (0 == objectQueryInterface(from, IID_HDL4SEUNIT, (void**)&unit)) { \
\
objectRelease(pobj->__input_unit[index]); \
pobj->__input_unit[index] = unit; \
pobj->__input_index[index] = fromindex; \
} \
} \
return 0; \
} \
\
static int module_name##_hdl4se_unit_GetValue(HOBJECT object, int index, int width, IBigNumber ** value) \
{ \
sHDL4SE_##module_name* pobj; \
pobj = (sHDL4SE_##module_name*)objectThis(object); \
if (index < 0 || index >= pobj->__port_count) \
return -1; \
if (pobj->__port_info_list[index].portdirect != PORT_OUTPUT) \
return -2; \
if (pobj->__port_datavalid[index] == 0) { \
if (pobj->__output_gen_func[index] != NULL) \
pobj->__output_gen_func[index](pobj, index); \
} \
if (width <= 0) { \
objectCall1(value, SetUnsigned, pobj->__port_info_list[index].isunsigned); \
objectCall1(value, SetWidth, pobj->__port_info_list[index].width); \
} \
objectCall1(value, Assign, pobj->__port_data[index]); \
return 0; \
} \
\
static int module_name##_hdl4se_unit_ClkTick(HOBJECT object) \
{ \
sHDL4SE_##module_name* pobj; \
pobj = (sHDL4SE_##module_name*)objectThis(object); \
if (pobj->__clktick_func != NULL) \
return pobj->__clktick_func(pobj); \
return 0; \
} \
\
static int module_name##_hdl4se_unit_Setup(HOBJECT object) \
{ \
int i; \
sHDL4SE_##module_name* pobj; \
pobj = (sHDL4SE_##module_name*)objectThis(object); \
if (pobj->__setup_func != 0) \
pobj->__setup_func(pobj); \
for (i = 0; i < pobj->__port_count; i++) { \
pobj->__port_datavalid[i] = 0; \
} \
return 0; \
}
#define UpdatePortData(portindex) \
do { \
if (portindex >= 0 && portindex < pobj->__port_count) { \
if (pobj->__port_datavalid[portindex] == 0) { \
if (pobj->__port_info_list[portindex].portdirect == PORT_INPUT) { \
objectCall3(pobj->__input_unit[portindex], \
GetValue, \
pobj->__input_index[portindex], \
pobj->__port_info_list[portindex].width, \
pobj->__port_data[portindex]); \
pobj->__port_datavalid[portindex] = 1; \
} \
else if (pobj->__port_info_list[portindex].portdirect == PORT_OUTPUT) { \
if (pobj->__output_gen_func[portindex] != NULL) \
pobj->__output_gen_func[portindex](pobj, portindex); \
pobj->__port_datavalid[portindex] = 1; \
} \
} \
#define GetPortUint32(portindex, v) \
UpdatePortData(portindex) \
v = objectCall0(pobj->__port_data[portindex], ReadUint32); \
} \
} while (0)
#define GetPortInt32(portindex, v) \
UpdatePortData(portindex) \
v = objectCall0(pobj->__port_data[portindex], ReadInt32); \
} \
} while (0)
#define GetPortUint64(portindex, v) \
UpdatePortData(portindex) \
v = objectCall0(pobj->__port_data[portindex], ReadUint64); \
} \
} while (0)
#define GetPortInt64(portindex, v) \
UpdatePortData(portindex) \
v = objectCall0(pobj->__port_data[portindex], ReadInt64); \
} \
} while (0)
#define SetPortUint32(portindex, v) \
do { \
objectCall1(pobj->__port_data[portindex], AssignUint32, v); \
pobj->__port_datavalid[portindex] = 1; \
} while (0)
#define SetPortInt32(portindex, v) \
do { \
objectCall1(pobj->__port_data[portindex], AssignInt32, v); \
pobj->__port_datavalid[portindex] = 1; \
} while (0)
#define SetPortUint64(portindex, v) \
do { \
objectCall1(pobj->__port_data[portindex], AssignUint64, v); \
pobj->__port_datavalid[portindex] = 1; \
} while (0)
#define SetPortInt64(portindex, v) \
do { \
objectCall1(pobj->__port_data[portindex], AssignInt64, v); \
pobj->__port_datavalid[portindex] = 1; \
} while (0)
int hdl4se_split_string(const char * string, char ** substr, int substrcount, int gap);
......
......@@ -150,4 +150,9 @@ int hdl4sedetectorTraversal(HOBJECT object, hdl4se_detector_TraversalFunc func,
objectRelease(detector);
}
return 0;
}
\ No newline at end of file
}
int hdl4se_split_string(const char* string, char** substr, int substrcount, int gap)
{
return 0;
}
......@@ -18,8 +18,8 @@ extern char* yytext;
static char logbuf[64 * 1024];
#define GOOGLENET 1
#define TERRIS 0
#define GOOGLENET 0
#define TERRIS 1
#define COUNTER 0
#ifdef WIN32
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册