Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
饶先宏
hdl4se
提交
85a95817
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,发现更多精彩内容 >>
提交
85a95817
编写于
5月 24, 2021
作者:
饶先宏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
202105242056
上级
889b0fd2
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
187 addition
and
46 deletion
+187
-46
examples/counter/src/counter.c
examples/counter/src/counter.c
+2
-6
examples/counter/src/main.c
examples/counter/src/main.c
+20
-0
examples/digitled/src/digitled.c
examples/digitled/src/digitled.c
+8
-5
hdl4secell/include/hdl4secell.h
hdl4secell/include/hdl4secell.h
+7
-3
hdl4secell/src/hdl4se_bind2.c
hdl4secell/src/hdl4se_bind2.c
+6
-4
hdl4secell/src/hdl4se_bind3.c
hdl4secell/src/hdl4se_bind3.c
+6
-4
hdl4secell/src/hdl4se_bind4.c
hdl4secell/src/hdl4se_bind4.c
+6
-4
hdl4secell/src/hdl4se_binop.c
hdl4secell/src/hdl4se_binop.c
+2
-1
hdl4secell/src/hdl4se_const.c
hdl4secell/src/hdl4se_const.c
+2
-1
hdl4secell/src/hdl4se_module.c
hdl4secell/src/hdl4se_module.c
+2
-1
hdl4secell/src/hdl4se_mux16.c
hdl4secell/src/hdl4se_mux16.c
+2
-1
hdl4secell/src/hdl4se_mux2.c
hdl4secell/src/hdl4se_mux2.c
+2
-1
hdl4secell/src/hdl4se_mux4.c
hdl4secell/src/hdl4se_mux4.c
+2
-1
hdl4secell/src/hdl4se_mux8.c
hdl4secell/src/hdl4se_mux8.c
+2
-1
hdl4secell/src/hdl4se_reg.c
hdl4secell/src/hdl4se_reg.c
+2
-1
hdl4secell/src/hdl4se_split2.c
hdl4secell/src/hdl4se_split2.c
+7
-3
hdl4secell/src/hdl4se_split4.c
hdl4secell/src/hdl4se_split4.c
+7
-3
hdl4secell/src/hdl4se_unop.c
hdl4secell/src/hdl4se_unop.c
+7
-3
hdl4secell/src/hdl4se_wire.c
hdl4secell/src/hdl4se_wire.c
+2
-1
hdl4secell/src/hdl4secell.c
hdl4secell/src/hdl4secell.c
+33
-1
hdl4sesim/src/hdl4sesim.c
hdl4sesim/src/hdl4sesim.c
+60
-1
未找到文件。
examples/counter/src/counter.c
浏览文件 @
85a95817
...
@@ -42,7 +42,6 @@
...
@@ -42,7 +42,6 @@
#include "hdl4secell.h"
#include "hdl4secell.h"
static
IHDL4SEUnit
**
hdl4seCreateDec2seg
(
IHDL4SEModule
**
parent
,
char
*
instanceparam
,
char
*
name
)
{
/* module dec2seg */
static
IHDL4SEUnit
**
hdl4seCreateDec2seg
(
IHDL4SEModule
**
parent
,
char
*
instanceparam
,
char
*
name
)
{
/* module dec2seg */
IHDL4SEUnit
**
wire_const
[
11
];
IHDL4SEUnit
**
unit_const
[
11
];
IHDL4SEUnit
**
unit_const
[
11
];
IHDL4SEUnit
**
unit_mux16
=
NULL
;
IHDL4SEUnit
**
unit_mux16
=
NULL
;
IHDL4SEModule
**
module_dec2seg
=
NULL
;
IHDL4SEModule
**
module_dec2seg
=
NULL
;
...
@@ -73,21 +72,18 @@ static IHDL4SEUnit** hdl4seCreateDec2seg(IHDL4SEModule** parent, char* instancep
...
@@ -73,21 +72,18 @@ static IHDL4SEUnit** hdl4seCreateDec2seg(IHDL4SEModule** parent, char* instancep
for
(
i
=
0
;
i
<
11
;
i
++
)
{
for
(
i
=
0
;
i
<
11
;
i
++
)
{
char
tempname
[
32
];
char
tempname
[
32
];
sprintf
(
tempname
,
"wire_cst%d"
,
i
);
wire_const
[
i
]
=
hdl4seCreateUnit
(
module_dec2seg
,
CLSID_HDL4SE_WIRE
,
"8"
,
tempname
);
sprintf
(
tempname
,
"const_cst%d"
,
i
);
sprintf
(
tempname
,
"const_cst%d"
,
i
);
unit_const
[
i
]
=
hdl4seCreateUnit
(
module_dec2seg
,
CLSID_HDL4SE_CONST
,
constparam
[
i
],
tempname
);
unit_const
[
i
]
=
hdl4seCreateUnit
(
module_dec2seg
,
CLSID_HDL4SE_CONST
,
constparam
[
i
],
tempname
);
objectCall3
(
wire_const
[
i
],
Connect
,
0
,
unit_const
[
i
],
0
);
}
}
/* 生成数据选择器unit_mux */
/* 生成数据选择器unit_mux */
unit_mux16
=
hdl4seCreateUnit
(
module_dec2seg
,
CLSID_HDL4SE_MUX16
,
"8"
,
"mux_dec"
);
unit_mux16
=
hdl4seCreateUnit
(
module_dec2seg
,
CLSID_HDL4SE_MUX16
,
"8"
,
"mux_dec"
);
/*mux的输入连接到输入端口dec和线网constall上*/
/*mux的输入连接到输入端口dec和线网constall上*/
objectCall3
(
unit_mux16
,
Connect
,
0
,
unit_dec2seg
,
0
);
objectCall3
(
unit_mux16
,
Connect
,
0
,
unit_dec2seg
,
0
);
for
(
i
=
0
;
i
<
10
;
i
++
)
{
for
(
i
=
0
;
i
<
10
;
i
++
)
{
objectCall3
(
unit_mux16
,
Connect
,
i
+
1
,
wire
_const
[
i
],
0
);
objectCall3
(
unit_mux16
,
Connect
,
i
+
1
,
unit
_const
[
i
],
0
);
}
}
for
(;
i
<
16
;
i
++
)
{
for
(;
i
<
16
;
i
++
)
{
objectCall3
(
unit_mux16
,
Connect
,
i
+
1
,
wire
_const
[
10
],
0
);
objectCall3
(
unit_mux16
,
Connect
,
i
+
1
,
unit
_const
[
10
],
0
);
}
}
/* 译码模块的输出seg连接到数据先择器的输出*/
/* 译码模块的输出seg连接到数据先择器的输出*/
objectCall3
(
unit_dec2seg
,
Connect
,
1
,
unit_mux16
,
17
);
objectCall3
(
unit_dec2seg
,
Connect
,
1
,
unit_mux16
,
17
);
...
...
examples/counter/src/main.c
浏览文件 @
85a95817
...
@@ -55,14 +55,34 @@ int StopRunning()
...
@@ -55,14 +55,34 @@ int StopRunning()
return
0
;
return
0
;
}
}
static
int
hdl4se_print_all_signal
(
IHDL4SEDetector
**
detector
,
const
char
*
pathname
,
int
*
pwidth
)
{
int
i
;
int
count
;
int
width
;
const
char
*
name
;
count
=
objectCall0
(
detector
,
GetSignalCount
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
objectCall3
(
detector
,
GetSignalInfo
,
i
,
&
name
,
&
width
);
printf
(
"%s/%s, %d
\n
"
,
pathname
,
name
,
width
);
*
pwidth
+=
(
width
+
31
)
/
32
;
}
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
int
width
;
sim
=
hdl4sesimCreateSimulator
();
sim
=
hdl4sesimCreateSimulator
();
topmodule
=
hdl4seCreateMain
(
NULL
,
""
,
"main"
);
topmodule
=
hdl4seCreateMain
(
NULL
,
""
,
"main"
);
gui
=
guiCreate
(
0xf0000000
,
"digitled"
);
gui
=
guiCreate
(
0xf0000000
,
"digitled"
);
objectCall1
(
sim
,
SetTopModule
,
topmodule
);
objectCall1
(
sim
,
SetTopModule
,
topmodule
);
objectCall1
(
sim
,
AddDevice
,
gui
);
objectCall1
(
sim
,
AddDevice
,
gui
);
objectCall1
(
sim
,
SetReset
,
0
);
objectCall1
(
sim
,
SetReset
,
0
);
width
=
0
;
hdl4sedetectorTraversal
(
sim
,
hdl4se_print_all_signal
,
""
,
&
width
);
printf
(
"Total width=%d bits, %d word
\n
"
,
width
*
32
,
width
);
do
{
do
{
objectCall0
(
sim
,
RunClockTick
);
objectCall0
(
sim
,
RunClockTick
);
clocks
++
;
clocks
++
;
...
...
examples/digitled/src/digitled.c
浏览文件 @
85a95817
...
@@ -544,13 +544,19 @@ static const char* digitled_dataname[9] = {
...
@@ -544,13 +544,19 @@ static const char* digitled_dataname[9] = {
"bReadData"
,
"bReadData"
,
"BASEADDR"
"BASEADDR"
};
};
static
int
digitled_hdl4se_detector_GetSignalName
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
const
char
*
digitled_datawidth
[
9
]
=
{
1
,
1
,
32
,
32
,
4
,
1
,
32
,
32
,
32
};
static
int
digitled_hdl4se_detector_GetSignalInfo
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sDigitLed
*
pobj
;
sDigitLed
*
pobj
;
pobj
=
(
sDigitLed
*
)
objectThis
(
object
);
pobj
=
(
sDigitLed
*
)
objectThis
(
object
);
if
(
index
<
0
||
index
>=
9
)
if
(
index
<
0
||
index
>=
9
)
return
-
1
;
return
-
1
;
*
pname
=
digitled_dataname
[
index
];
*
pname
=
digitled_dataname
[
index
];
*
width
=
digitled_datawidth
[
index
];
return
0
;
return
0
;
}
}
...
@@ -565,10 +571,7 @@ static int digitled_hdl4se_detector_GetSignalValue(HOBJECT object, int index, IB
...
@@ -565,10 +571,7 @@ static int digitled_hdl4se_detector_GetSignalValue(HOBJECT object, int index, IB
objectCall1
(
value
,
AssignInt
,
pobj
->
portdata
[
index
]);
objectCall1
(
value
,
AssignInt
,
pobj
->
portdata
[
index
]);
if
(
index
==
8
)
if
(
index
==
8
)
objectCall1
(
value
,
AssignInt
,
pobj
->
baseaddr
);
objectCall1
(
value
,
AssignInt
,
pobj
->
baseaddr
);
if
(
index
==
0
||
index
==
1
||
index
==
5
)
objectCall2
(
value
,
SetWidth
,
digitled_datawidth
[
index
],
0
);
objectCall2
(
value
,
SetWidth
,
1
,
0
);
if
(
index
==
4
)
objectCall2
(
value
,
SetWidth
,
4
,
0
);
return
0
;
return
0
;
}
}
...
...
hdl4secell/include/hdl4secell.h
浏览文件 @
85a95817
...
@@ -79,7 +79,7 @@ typedef struct sIHDL4SEDetector {
...
@@ -79,7 +79,7 @@ typedef struct sIHDL4SEDetector {
OBJECT_INTERFACE
OBJECT_INTERFACE
int
(
*
GetName
)(
HOBJECT
object
,
const
char
**
pname
);
int
(
*
GetName
)(
HOBJECT
object
,
const
char
**
pname
);
int
(
*
GetSignalCount
)(
HOBJECT
object
);
int
(
*
GetSignalCount
)(
HOBJECT
object
);
int
(
*
GetSignal
Name
)(
HOBJECT
object
,
int
index
,
const
char
**
pname
);
int
(
*
GetSignal
Info
)(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
);
int
(
*
GetSignalValue
)(
HOBJECT
object
,
int
index
,
IBigNumber
**
value
);
int
(
*
GetSignalValue
)(
HOBJECT
object
,
int
index
,
IBigNumber
**
value
);
int
(
*
GetUnitCount
)(
HOBJECT
object
);
int
(
*
GetUnitCount
)(
HOBJECT
object
);
int
(
*
GetUnit
)(
HOBJECT
object
,
int
index
,
HOBJECT
*
unit
);
int
(
*
GetUnit
)(
HOBJECT
object
,
int
index
,
HOBJECT
*
unit
);
...
@@ -91,7 +91,7 @@ typedef struct sIHDL4SEDetector {
...
@@ -91,7 +91,7 @@ typedef struct sIHDL4SEDetector {
#define HDL4SEDETECTOR_FUNCDECLARE(_obj, _clsid, _localstruct) \
#define HDL4SEDETECTOR_FUNCDECLARE(_obj, _clsid, _localstruct) \
static int _obj##_hdl4se_detector_GetName(HOBJECT object, const char ** pname); \
static int _obj##_hdl4se_detector_GetName(HOBJECT object, const char ** pname); \
static int _obj##_hdl4se_detector_GetSignalCount(HOBJECT object); \
static int _obj##_hdl4se_detector_GetSignalCount(HOBJECT object); \
static int _obj##_hdl4se_detector_GetSignal
Name(HOBJECT object, int index, const char** pname
); \
static int _obj##_hdl4se_detector_GetSignal
Info(HOBJECT object, int index, const char** pname, int * width
); \
static int _obj##_hdl4se_detector_GetSignalValue(HOBJECT object, int index, IBigNumber** value); \
static int _obj##_hdl4se_detector_GetSignalValue(HOBJECT object, int index, IBigNumber** value); \
static int _obj##_hdl4se_detector_GetUnitCount(HOBJECT object); \
static int _obj##_hdl4se_detector_GetUnitCount(HOBJECT object); \
static int _obj##_hdl4se_detector_GetUnit(HOBJECT object, int index, HOBJECT* unit); \
static int _obj##_hdl4se_detector_GetUnit(HOBJECT object, int index, HOBJECT* unit); \
...
@@ -99,12 +99,16 @@ typedef struct sIHDL4SEDetector {
...
@@ -99,12 +99,16 @@ typedef struct sIHDL4SEDetector {
INTERFACE_HEADER(_obj, IHDL4SEDetector, _localstruct) \
INTERFACE_HEADER(_obj, IHDL4SEDetector, _localstruct) \
_obj##_hdl4se_detector_GetName, \
_obj##_hdl4se_detector_GetName, \
_obj##_hdl4se_detector_GetSignalCount, \
_obj##_hdl4se_detector_GetSignalCount, \
_obj##_hdl4se_detector_GetSignal
Name
, \
_obj##_hdl4se_detector_GetSignal
Info
, \
_obj##_hdl4se_detector_GetSignalValue, \
_obj##_hdl4se_detector_GetSignalValue, \
_obj##_hdl4se_detector_GetUnitCount, \
_obj##_hdl4se_detector_GetUnitCount, \
_obj##_hdl4se_detector_GetUnit, \
_obj##_hdl4se_detector_GetUnit, \
};
};
/* return 0 to continue traversal, or stop traversal */
typedef
int
(
*
hdl4se_detector_TraversalFunc
)(
IHDL4SEDetector
**
detector
,
const
char
*
pathname
,
void
*
param
);
int
hdl4sedetectorTraversal
(
HOBJECT
object
,
hdl4se_detector_TraversalFunc
func
,
const
char
*
pathname
,
void
*
param
);
DEFINE_GUID
(
IID_HDL4SEMODULE
,
0x88cf84f9
,
0x17ac
,
0x4edf
,
0xbf
,
0x0
,
0xc7
,
0x32
,
0xd5
,
0x26
,
0x99
,
0x2a
);
DEFINE_GUID
(
IID_HDL4SEMODULE
,
0x88cf84f9
,
0x17ac
,
0x4edf
,
0xbf
,
0x0
,
0xc7
,
0x32
,
0xd5
,
0x26
,
0x99
,
0x2a
);
...
...
hdl4secell/src/hdl4se_bind2.c
浏览文件 @
85a95817
...
@@ -67,6 +67,7 @@ typedef struct _sHDL4SEBind2 {
...
@@ -67,6 +67,7 @@ typedef struct _sHDL4SEBind2 {
IBigNumber
**
in_data
[
BINDCOUNT
];
IBigNumber
**
in_data
[
BINDCOUNT
];
IBigNumber
**
out_data
;
IBigNumber
**
out_data
;
int
out_width
;
int
datavalid
;
int
datavalid
;
...
@@ -144,14 +145,14 @@ static int hdl4se_bind2Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
...
@@ -144,14 +145,14 @@ static int hdl4se_bind2Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
}
}
}
}
}
}
output
width
=
0
;
pobj
->
out_
width
=
0
;
for
(
i
=
0
;
i
<
BINDCOUNT
;
i
++
)
{
for
(
i
=
0
;
i
<
BINDCOUNT
;
i
++
)
{
if
(
pobj
->
inputwidth
[
i
]
<=
0
)
if
(
pobj
->
inputwidth
[
i
]
<=
0
)
return
EIID_INVALIDPARAM
;
return
EIID_INVALIDPARAM
;
pobj
->
in_data
[
i
]
=
bigintegerCreate
(
pobj
->
inputwidth
[
i
]);
pobj
->
in_data
[
i
]
=
bigintegerCreate
(
pobj
->
inputwidth
[
i
]);
output
width
+=
pobj
->
inputwidth
[
i
];
pobj
->
out_
width
+=
pobj
->
inputwidth
[
i
];
}
}
pobj
->
out_data
=
bigintegerCreate
(
output
width
);
pobj
->
out_data
=
bigintegerCreate
(
pobj
->
out_
width
);
/* 返回生成的对象 */
/* 返回生成的对象 */
OBJECT_RETURN_GEN
(
hdl4se_bind2
,
pobj
,
pObject
,
CLSID_HDL4SE_BIND2
);
OBJECT_RETURN_GEN
(
hdl4se_bind2
,
pobj
,
pObject
,
CLSID_HDL4SE_BIND2
);
...
@@ -251,11 +252,12 @@ static int hdl4se_bind2_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -251,11 +252,12 @@ static int hdl4se_bind2_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_bind2_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_bind2_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEBind2
*
pobj
;
sHDL4SEBind2
*
pobj
;
pobj
=
(
sHDL4SEBind2
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEBind2
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
out_width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_bind3.c
浏览文件 @
85a95817
...
@@ -68,6 +68,7 @@ typedef struct _sHDL4SEBind3 {
...
@@ -68,6 +68,7 @@ typedef struct _sHDL4SEBind3 {
IBigNumber
**
in_data
[
BINDCOUNT
];
IBigNumber
**
in_data
[
BINDCOUNT
];
IBigNumber
**
out_data
;
IBigNumber
**
out_data
;
int
out_width
;
int
datavalid
;
int
datavalid
;
...
@@ -145,14 +146,14 @@ static int hdl4se_bind3Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
...
@@ -145,14 +146,14 @@ static int hdl4se_bind3Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
}
}
}
}
}
}
output
width
=
0
;
pobj
->
out_
width
=
0
;
for
(
i
=
0
;
i
<
BINDCOUNT
;
i
++
)
{
for
(
i
=
0
;
i
<
BINDCOUNT
;
i
++
)
{
if
(
pobj
->
inputwidth
[
i
]
<=
0
)
if
(
pobj
->
inputwidth
[
i
]
<=
0
)
return
EIID_INVALIDPARAM
;
return
EIID_INVALIDPARAM
;
pobj
->
in_data
[
i
]
=
bigintegerCreate
(
pobj
->
inputwidth
[
i
]);
pobj
->
in_data
[
i
]
=
bigintegerCreate
(
pobj
->
inputwidth
[
i
]);
output
width
+=
pobj
->
inputwidth
[
i
];
pobj
->
out_
width
+=
pobj
->
inputwidth
[
i
];
}
}
pobj
->
out_data
=
bigintegerCreate
(
output
width
);
pobj
->
out_data
=
bigintegerCreate
(
pobj
->
out_
width
);
/* 返回生成的对象 */
/* 返回生成的对象 */
OBJECT_RETURN_GEN
(
hdl4se_bind3
,
pobj
,
pObject
,
CLSID_HDL4SE_BIND3
);
OBJECT_RETURN_GEN
(
hdl4se_bind3
,
pobj
,
pObject
,
CLSID_HDL4SE_BIND3
);
...
@@ -252,11 +253,12 @@ static int hdl4se_bind3_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -252,11 +253,12 @@ static int hdl4se_bind3_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_bind3_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_bind3_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEBind3
*
pobj
;
sHDL4SEBind3
*
pobj
;
pobj
=
(
sHDL4SEBind3
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEBind3
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
out_width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_bind4.c
浏览文件 @
85a95817
...
@@ -68,6 +68,7 @@ typedef struct _sHDL4SEBind4 {
...
@@ -68,6 +68,7 @@ typedef struct _sHDL4SEBind4 {
IBigNumber
**
in_data
[
BINDCOUNT
];
IBigNumber
**
in_data
[
BINDCOUNT
];
IBigNumber
**
out_data
;
IBigNumber
**
out_data
;
int
out_width
;
int
datavalid
;
int
datavalid
;
...
@@ -145,14 +146,14 @@ static int hdl4se_bind4Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
...
@@ -145,14 +146,14 @@ static int hdl4se_bind4Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
}
}
}
}
}
}
output
width
=
0
;
pobj
->
out_
width
=
0
;
for
(
i
=
0
;
i
<
BINDCOUNT
;
i
++
)
{
for
(
i
=
0
;
i
<
BINDCOUNT
;
i
++
)
{
if
(
pobj
->
inputwidth
[
i
]
<=
0
)
if
(
pobj
->
inputwidth
[
i
]
<=
0
)
return
EIID_INVALIDPARAM
;
return
EIID_INVALIDPARAM
;
pobj
->
in_data
[
i
]
=
bigintegerCreate
(
pobj
->
inputwidth
[
i
]);
pobj
->
in_data
[
i
]
=
bigintegerCreate
(
pobj
->
inputwidth
[
i
]);
output
width
+=
pobj
->
inputwidth
[
i
];
pobj
->
out_
width
+=
pobj
->
inputwidth
[
i
];
}
}
pobj
->
out_data
=
bigintegerCreate
(
output
width
);
pobj
->
out_data
=
bigintegerCreate
(
pobj
->
out_
width
);
/* 返回生成的对象 */
/* 返回生成的对象 */
OBJECT_RETURN_GEN
(
hdl4se_bind4
,
pobj
,
pObject
,
CLSID_HDL4SE_BIND4
);
OBJECT_RETURN_GEN
(
hdl4se_bind4
,
pobj
,
pObject
,
CLSID_HDL4SE_BIND4
);
...
@@ -252,11 +253,12 @@ static int hdl4se_bind4_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -252,11 +253,12 @@ static int hdl4se_bind4_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_bind4_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_bind4_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEBind4
*
pobj
;
sHDL4SEBind4
*
pobj
;
pobj
=
(
sHDL4SEBind4
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEBind4
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
out_width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_binop.c
浏览文件 @
85a95817
...
@@ -336,11 +336,12 @@ static int hdl4se_binop_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -336,11 +336,12 @@ static int hdl4se_binop_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_binop_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_binop_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEBinop
*
pobj
;
sHDL4SEBinop
*
pobj
;
pobj
=
(
sHDL4SEBinop
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEBinop
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
out_width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_const.c
浏览文件 @
85a95817
...
@@ -188,11 +188,12 @@ static int hdl4se_const_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -188,11 +188,12 @@ static int hdl4se_const_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_const_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_const_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEConst
*
pobj
;
sHDL4SEConst
*
pobj
;
pobj
=
(
sHDL4SEConst
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEConst
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_module.c
浏览文件 @
85a95817
...
@@ -284,13 +284,14 @@ static int hdl4se_module_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -284,13 +284,14 @@ static int hdl4se_module_hdl4se_detector_GetSignalCount(HOBJECT object)
return
pobj
->
ports_count
;
return
pobj
->
ports_count
;
}
}
static
int
hdl4se_module_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_module_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEModule
*
pobj
;
sHDL4SEModule
*
pobj
;
pobj
=
(
sHDL4SEModule
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEModule
*
)
objectThis
(
object
);
if
(
index
<
0
||
index
>=
pobj
->
ports_count
)
if
(
index
<
0
||
index
>=
pobj
->
ports_count
)
return
-
1
;
return
-
1
;
*
pname
=
pobj
->
ports
[
index
].
name
;
*
pname
=
pobj
->
ports
[
index
].
name
;
*
width
=
pobj
->
ports
[
index
].
width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_mux16.c
浏览文件 @
85a95817
...
@@ -259,11 +259,12 @@ static int hdl4se_mux16_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -259,11 +259,12 @@ static int hdl4se_mux16_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_mux16_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_mux16_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEMux16
*
pobj
;
sHDL4SEMux16
*
pobj
;
pobj
=
(
sHDL4SEMux16
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEMux16
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_mux2.c
浏览文件 @
85a95817
...
@@ -262,11 +262,12 @@ static int hdl4se_mux2_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -262,11 +262,12 @@ static int hdl4se_mux2_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_mux2_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_mux2_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEMux2
*
pobj
;
sHDL4SEMux2
*
pobj
;
pobj
=
(
sHDL4SEMux2
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEMux2
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_mux4.c
浏览文件 @
85a95817
...
@@ -260,11 +260,12 @@ static int hdl4se_mux4_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -260,11 +260,12 @@ static int hdl4se_mux4_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_mux4_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_mux4_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEMux4
*
pobj
;
sHDL4SEMux4
*
pobj
;
pobj
=
(
sHDL4SEMux4
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEMux4
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_mux8.c
浏览文件 @
85a95817
...
@@ -259,11 +259,12 @@ static int hdl4se_mux8_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -259,11 +259,12 @@ static int hdl4se_mux8_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_mux8_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_mux8_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEMux8
*
pobj
;
sHDL4SEMux8
*
pobj
;
pobj
=
(
sHDL4SEMux8
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEMux8
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_reg.c
浏览文件 @
85a95817
...
@@ -212,11 +212,12 @@ static int hdl4se_reg_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -212,11 +212,12 @@ static int hdl4se_reg_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_reg_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_reg_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEReg
*
pobj
;
sHDL4SEReg
*
pobj
;
pobj
=
(
sHDL4SEReg
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEReg
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_split2.c
浏览文件 @
85a95817
...
@@ -280,16 +280,20 @@ static const char* outname[SPLITCOUNT] = {
...
@@ -280,16 +280,20 @@ static const char* outname[SPLITCOUNT] = {
"out0"
,
"out1"
"out0"
,
"out1"
};
};
static
int
hdl4se_split2_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_split2_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SESplit2
*
pobj
;
sHDL4SESplit2
*
pobj
;
pobj
=
(
sHDL4SESplit2
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SESplit2
*
)
objectThis
(
object
);
if
(
index
<
0
||
index
>
SPLITCOUNT
)
if
(
index
<
0
||
index
>
SPLITCOUNT
)
return
-
1
;
return
-
1
;
if
(
index
==
0
)
if
(
index
==
0
)
{
*
pname
=
"in"
;
*
pname
=
"in"
;
else
*
width
=
pobj
->
width
;
}
else
{
*
pname
=
outname
[
index
-
1
];
*
pname
=
outname
[
index
-
1
];
*
width
=
pobj
->
out_info
[
index
-
1
][
0
];
}
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_split4.c
浏览文件 @
85a95817
...
@@ -283,16 +283,20 @@ static const char* outname[SPLITCOUNT] = {
...
@@ -283,16 +283,20 @@ static const char* outname[SPLITCOUNT] = {
"out0"
,
"out1"
,
"out2"
,
"out3"
"out0"
,
"out1"
,
"out2"
,
"out3"
};
};
static
int
hdl4se_split4_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_split4_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SESplit4
*
pobj
;
sHDL4SESplit4
*
pobj
;
pobj
=
(
sHDL4SESplit4
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SESplit4
*
)
objectThis
(
object
);
if
(
index
<
0
||
index
>
SPLITCOUNT
)
if
(
index
<
0
||
index
>
SPLITCOUNT
)
return
-
1
;
return
-
1
;
if
(
index
==
0
)
if
(
index
==
0
)
{
*
pname
=
"in"
;
*
pname
=
"in"
;
else
*
width
=
pobj
->
width
;
}
else
{
*
pname
=
outname
[
index
-
1
];
*
pname
=
outname
[
index
-
1
];
*
width
=
pobj
->
out_info
[
index
-
1
][
0
];
}
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_unop.c
浏览文件 @
85a95817
...
@@ -286,14 +286,18 @@ static int hdl4se_unop_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -286,14 +286,18 @@ static int hdl4se_unop_hdl4se_detector_GetSignalCount(HOBJECT object)
return
2
;
return
2
;
}
}
static
int
hdl4se_unop_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_unop_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEUnop
*
pobj
;
sHDL4SEUnop
*
pobj
;
pobj
=
(
sHDL4SEUnop
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEUnop
*
)
objectThis
(
object
);
if
(
index
==
0
)
if
(
index
==
0
)
{
*
pname
=
"in"
;
*
pname
=
"in"
;
else
if
(
index
==
1
)
*
width
=
pobj
->
in_width
;
}
else
if
(
index
==
1
)
{
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
out_width
;
}
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4se_wire.c
浏览文件 @
85a95817
...
@@ -225,11 +225,12 @@ static int hdl4se_wire_hdl4se_detector_GetSignalCount(HOBJECT object)
...
@@ -225,11 +225,12 @@ static int hdl4se_wire_hdl4se_detector_GetSignalCount(HOBJECT object)
return
1
;
return
1
;
}
}
static
int
hdl4se_wire_hdl4se_detector_GetSignal
Name
(
HOBJECT
object
,
int
index
,
const
char
**
pname
)
static
int
hdl4se_wire_hdl4se_detector_GetSignal
Info
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
{
sHDL4SEWire
*
pobj
;
sHDL4SEWire
*
pobj
;
pobj
=
(
sHDL4SEWire
*
)
objectThis
(
object
);
pobj
=
(
sHDL4SEWire
*
)
objectThis
(
object
);
*
pname
=
"out"
;
*
pname
=
"out"
;
*
width
=
pobj
->
width
;
return
0
;
return
0
;
}
}
...
...
hdl4secell/src/hdl4secell.c
浏览文件 @
85a95817
...
@@ -102,4 +102,36 @@ IHDL4SEUnit** hdl4seCreateUnit(IHDL4SEModule** parent, IIDTYPE clsid, char* inst
...
@@ -102,4 +102,36 @@ IHDL4SEUnit** hdl4seCreateUnit(IHDL4SEModule** parent, IIDTYPE clsid, char* inst
return
result
;
return
result
;
}
}
int
hdl4sedetectorTraversal
(
HOBJECT
object
,
hdl4se_detector_TraversalFunc
func
,
const
char
*
pathname
,
void
*
param
)
{
IHDL4SEDetector
**
detector
;
if
(
0
==
objectQueryInterface
(
object
,
IID_HDL4SEDETECTOR
,
(
void
**
)
&
detector
))
{
int
count
,
i
,
pathlen
;
char
*
pname
;
const
char
*
unitname
=
NULL
;
pathlen
=
strlen
(
pathname
)
+
256
;
pname
=
(
char
*
)
malloc
(
pathlen
);
if
(
pname
==
NULL
)
return
-
2
;
strcpy
(
pname
,
pathname
);
strcat
(
pname
,
"/"
);
objectCall1
(
detector
,
GetName
,
&
unitname
);
if
(
unitname
==
NULL
)
{
free
(
pname
);
return
-
3
;
}
strcat
(
pname
,
unitname
);
if
(
func
(
detector
,
pname
,
param
)
!=
0
)
return
-
1
;
count
=
objectCall0
(
detector
,
GetUnitCount
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
HOBJECT
unit
;
objectCall2
(
detector
,
GetUnit
,
i
,
&
unit
);
if
(
hdl4sedetectorTraversal
(
unit
,
func
,
pname
,
param
)
!=
0
)
return
-
1
;
}
free
(
pname
);
objectRelease
(
detector
);
}
return
0
;
}
\ No newline at end of file
hdl4sesim/src/hdl4sesim.c
浏览文件 @
85a95817
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
* hdl4sesim.c
* hdl4sesim.c
修改记录:
修改记录:
202105180851: rxh, initial version
202105180851: rxh, initial version
202105241905:rxh, 增加Detector接口
*/
*/
#include "stdlib.h"
#include "stdlib.h"
#include "stdio.h"
#include "stdio.h"
...
@@ -49,6 +50,8 @@ typedef struct _sHDL4SESim {
...
@@ -49,6 +50,8 @@ typedef struct _sHDL4SESim {
OBJECT_HEADER
OBJECT_HEADER
INTERFACE_DECLARE
(
IHDL4SEUnit
)
INTERFACE_DECLARE
(
IHDL4SEUnit
)
HDL4SEUNIT_VARDECLARE
HDL4SEUNIT_VARDECLARE
INTERFACE_DECLARE
(
IHDL4SEDetector
)
HDL4SEDETECTOR_VARDECLARE
INTERFACE_DECLARE
(
IHDL4SESimulator
)
INTERFACE_DECLARE
(
IHDL4SESimulator
)
HDL4SESIMULATOR_VARDECLARE
HDL4SESIMULATOR_VARDECLARE
...
@@ -61,12 +64,14 @@ typedef struct _sHDL4SESim {
...
@@ -61,12 +64,14 @@ typedef struct _sHDL4SESim {
OBJECT_FUNCDECLARE
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
);
OBJECT_FUNCDECLARE
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
);
HDL4SEUNIT_FUNCDECLARE
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
,
sHDL4SESim
);
HDL4SEUNIT_FUNCDECLARE
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
,
sHDL4SESim
);
HDL4SEDETECTOR_FUNCDECLARE
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
,
sHDL4SESim
);
HDL4SESIMULATOR_FUNCDECLARE
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
,
sHDL4SESim
);
HDL4SESIMULATOR_FUNCDECLARE
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
,
sHDL4SESim
);
OBJECT_FUNCIMPL
(
hdl4sesim
,
sHDL4SESim
,
CLSID_HDL4SESIMULATOR
);
OBJECT_FUNCIMPL
(
hdl4sesim
,
sHDL4SESim
,
CLSID_HDL4SESIMULATOR
);
QUERYINTERFACE_BEGIN
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
)
QUERYINTERFACE_BEGIN
(
hdl4sesim
,
CLSID_HDL4SESIMULATOR
)
QUERYINTERFACE_ITEM
(
IID_HDL4SEUNIT
,
IHDL4SEUnit
,
sHDL4SESim
)
QUERYINTERFACE_ITEM
(
IID_HDL4SEUNIT
,
IHDL4SEUnit
,
sHDL4SESim
)
QUERYINTERFACE_ITEM
(
IID_HDL4SEDETECTOR
,
IHDL4SEDetector
,
sHDL4SESim
)
QUERYINTERFACE_ITEM
(
IID_HDL4SESIMULATOR
,
IHDL4SESimulator
,
sHDL4SESim
)
QUERYINTERFACE_ITEM
(
IID_HDL4SESIMULATOR
,
IHDL4SESimulator
,
sHDL4SESim
)
QUERYINTERFACE_END
QUERYINTERFACE_END
...
@@ -85,6 +90,7 @@ static int hdl4sesimCreate(const PARAMITEM* pParams, int paramcount, HOBJECT* pO
...
@@ -85,6 +90,7 @@ static int hdl4sesimCreate(const PARAMITEM* pParams, int paramcount, HOBJECT* pO
*
pObject
=
0
;
*
pObject
=
0
;
HDL4SEUNIT_VARINIT
(
pobj
,
CLSID_HDL4SESIMULATOR
);
HDL4SEUNIT_VARINIT
(
pobj
,
CLSID_HDL4SESIMULATOR
);
INTERFACE_INIT
(
IHDL4SEUnit
,
pobj
,
hdl4sesim
,
hdl4se_unit
);
INTERFACE_INIT
(
IHDL4SEUnit
,
pobj
,
hdl4sesim
,
hdl4se_unit
);
INTERFACE_INIT
(
IHDL4SEDetector
,
pobj
,
hdl4sesim
,
hdl4se_detector
);
INTERFACE_INIT
(
IHDL4SESimulator
,
pobj
,
hdl4sesim
,
hdl4se_simulator
);
INTERFACE_INIT
(
IHDL4SESimulator
,
pobj
,
hdl4sesim
,
hdl4se_simulator
);
for
(
i
=
0
;
i
<
MAXDEVICES
;
i
++
)
{
for
(
i
=
0
;
i
<
MAXDEVICES
;
i
++
)
{
...
@@ -226,6 +232,59 @@ static int hdl4sesim_hdl4se_simulator_RunClockTick(HOBJECT object)
...
@@ -226,6 +232,59 @@ static int hdl4sesim_hdl4se_simulator_RunClockTick(HOBJECT object)
return
0
;
return
0
;
}
}
static
int
hdl4sesim_hdl4se_detector_GetName
(
HOBJECT
object
,
const
char
**
pname
)
{
sHDL4SESim
*
pobj
;
pobj
=
(
sHDL4SESim
*
)
objectThis
(
object
);
*
pname
=
"simulator"
;
return
0
;
}
static
int
hdl4sesim_hdl4se_detector_GetSignalCount
(
HOBJECT
object
)
{
sHDL4SESim
*
pobj
;
pobj
=
(
sHDL4SESim
*
)
objectThis
(
object
);
return
1
;
}
static
int
hdl4sesim_hdl4se_detector_GetSignalInfo
(
HOBJECT
object
,
int
index
,
const
char
**
pname
,
int
*
width
)
{
sHDL4SESim
*
pobj
;
pobj
=
(
sHDL4SESim
*
)
objectThis
(
object
);
*
pname
=
"nwReset"
;
*
width
=
1
;
return
0
;
}
static
int
hdl4sesim_hdl4se_detector_GetSignalValue
(
HOBJECT
object
,
int
index
,
IBigNumber
**
value
)
{
sHDL4SESim
*
pobj
;
pobj
=
(
sHDL4SESim
*
)
objectThis
(
object
);
objectCall1
(
value
,
AssignInt
,
pobj
->
reset
);
objectCall2
(
value
,
SetWidth
,
1
,
1
);
return
0
;
}
static
int
hdl4sesim_hdl4se_detector_GetUnitCount
(
HOBJECT
object
)
{
sHDL4SESim
*
pobj
;
pobj
=
(
sHDL4SESim
*
)
objectThis
(
object
);
return
pobj
->
devicecount
+
1
;
}
static
int
hdl4sesim_hdl4se_detector_GetUnit
(
HOBJECT
object
,
int
index
,
HOBJECT
*
unit
)
{
sHDL4SESim
*
pobj
;
pobj
=
(
sHDL4SESim
*
)
objectThis
(
object
);
if
(
index
<
0
||
index
>
pobj
->
devicecount
)
return
-
1
;
if
(
index
==
0
)
*
unit
=
pobj
->
topmodule
;
else
*
unit
=
pobj
->
devices
[
index
-
1
];
return
0
;
}
IHDL4SESimulator
**
hdl4sesimCreateSimulator
()
IHDL4SESimulator
**
hdl4sesimCreateSimulator
()
{
{
...
@@ -234,4 +293,4 @@ IHDL4SESimulator** hdl4sesimCreateSimulator()
...
@@ -234,4 +293,4 @@ IHDL4SESimulator** hdl4sesimCreateSimulator()
A_u_t_o_registor_hdl4sesim
();
A_u_t_o_registor_hdl4sesim
();
ret
=
objectCreateEx
(
CLSID_HDL4SESIMULATOR
,
NULL
,
0
,
IID_HDL4SESIMULATOR
,
(
const
void
**
)
&
sim
);
ret
=
objectCreateEx
(
CLSID_HDL4SESIMULATOR
,
NULL
,
0
,
IID_HDL4SESIMULATOR
,
(
const
void
**
)
&
sim
);
return
sim
;
return
sim
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录