Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
饶先宏
hdl4se
提交
a9b1f348
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 搜索 >>
提交
a9b1f348
编写于
5月 26, 2021
作者:
饶先宏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
202105261711 不正确的版本,仅供存储
上级
1989c92d
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
972 addition
and
521 deletion
+972
-521
bignumber/include/bignumber.h
bignumber/include/bignumber.h
+21
-7
bignumber/src/bignumber.c
bignumber/src/bignumber.c
+875
-431
examples/counter/src/main.c
examples/counter/src/main.c
+2
-2
examples/digitled/src/digitled.c
examples/digitled/src/digitled.c
+4
-4
examples/testbignumber/testbignumber.c
examples/testbignumber/testbignumber.c
+4
-4
hdl4secell/src/hdl4se_bind2.c
hdl4secell/src/hdl4se_bind2.c
+3
-3
hdl4secell/src/hdl4se_bind3.c
hdl4secell/src/hdl4se_bind3.c
+3
-3
hdl4secell/src/hdl4se_bind4.c
hdl4secell/src/hdl4se_bind4.c
+3
-3
hdl4secell/src/hdl4se_binop.c
hdl4secell/src/hdl4se_binop.c
+22
-29
hdl4secell/src/hdl4se_const.c
hdl4secell/src/hdl4se_const.c
+1
-1
hdl4secell/src/hdl4se_mux16.c
hdl4secell/src/hdl4se_mux16.c
+2
-2
hdl4secell/src/hdl4se_mux2.c
hdl4secell/src/hdl4se_mux2.c
+2
-2
hdl4secell/src/hdl4se_mux4.c
hdl4secell/src/hdl4se_mux4.c
+2
-2
hdl4secell/src/hdl4se_mux8.c
hdl4secell/src/hdl4se_mux8.c
+2
-2
hdl4secell/src/hdl4se_reg.c
hdl4secell/src/hdl4se_reg.c
+1
-1
hdl4secell/src/hdl4se_split2.c
hdl4secell/src/hdl4se_split2.c
+4
-4
hdl4secell/src/hdl4se_split4.c
hdl4secell/src/hdl4se_split4.c
+4
-4
hdl4secell/src/hdl4se_unop.c
hdl4secell/src/hdl4se_unop.c
+14
-14
hdl4secell/src/hdl4se_wire.c
hdl4secell/src/hdl4se_wire.c
+1
-1
hdl4sesim/src/hdl4sesim.c
hdl4sesim/src/hdl4sesim.c
+2
-2
未找到文件。
bignumber/include/bignumber.h
浏览文件 @
a9b1f348
...
...
@@ -52,8 +52,11 @@ typedef struct sIBigNumber {
int
(
*
GetWidth
)(
HOBJECT
object
);
int
(
*
SetWidth
)(
HOBJECT
object
,
int
width
,
int
signexpand
);
int
(
*
GetBits32
)(
HOBJECT
object
,
int
index
,
unsigned
int
*
pbits
);
int
(
*
SetBits32
)(
HOBJECT
object
,
int
index
,
unsigned
int
bits
);
int
(
*
GetBits32
)(
HOBJECT
object
,
int
ind32
,
unsigned
int
*
pbits
);
int
(
*
SetBits32
)(
HOBJECT
object
,
int
ind32
,
unsigned
int
bits
);
int
(
*
GetBit
)(
HOBJECT
object
,
int
indbit
);
int
(
*
SetBit
)(
HOBJECT
object
,
int
indbit
,
int
bit
);
int
(
*
GetInt32
)(
HOBJECT
object
,
int
*
pvalue
);
int
(
*
GetInt64
)(
HOBJECT
object
,
long
long
*
pvalue
);
...
...
@@ -101,6 +104,7 @@ typedef struct sIBigNumber {
int
(
*
ModU
)(
HOBJECT
object
,
HOBJECT
src0
,
HOBJECT
src1
);
int
(
*
Neg
)(
HOBJECT
object
,
HOBJECT
src
);
int
(
*
Abs
)(
HOBJECT
object
,
HOBJECT
src
);
int
(
*
IsGT
)(
HOBJECT
object
,
HOBJECT
src
);
int
(
*
IsGE
)(
HOBJECT
object
,
HOBJECT
src
);
...
...
@@ -118,10 +122,11 @@ typedef struct sIBigNumber {
int
(
*
IsZero
)(
HOBJECT
object
);
int
(
*
IsNotZero
)(
HOBJECT
object
);
int
(
*
IsNeg
)(
HOBJECT
object
);
int
(
*
AndL
)(
HOBJECT
object
,
HOBJECT
src
);
int
(
*
OrL
)(
HOBJECT
object
,
HOBJECT
src
);
int
(
*
NotL
)(
HOBJECT
object
,
HOBJECT
src
);
int
(
*
NotL
)(
HOBJECT
object
);
int
(
*
And
)(
HOBJECT
object
,
HOBJECT
src0
,
HOBJECT
src1
);
int
(
*
Or
)(
HOBJECT
object
,
HOBJECT
src0
,
HOBJECT
src1
);
...
...
@@ -148,8 +153,10 @@ typedef struct sIBigNumber {
#define BIGNUMBER_FUNCDECLARE(_obj, _clsid, _localstruct) \
static int _obj##_bn_GetWidth(HOBJECT object); \
static int _obj##_bn_SetWidth(HOBJECT object, int width, int signexpand); \
static int _obj##_bn_GetBits32(HOBJECT object, int index, unsigned int* pbits); \
static int _obj##_bn_SetBits32(HOBJECT object, int index, unsigned int bits); \
static int _obj##_bn_GetBits32(HOBJECT object, int ind32, unsigned int* pbits); \
static int _obj##_bn_SetBits32(HOBJECT object, int ind32, unsigned int bits); \
static int _obj##_bn_GetBit(HOBJECT object, int indbit); \
static int _obj##_bn_SetBit(HOBJECT object, int indbit, int bit); \
static int _obj##_bn_GetInt32(HOBJECT object, int* pvalue); \
static int _obj##_bn_GetInt64(HOBJECT object, long long* pvalue); \
static int _obj##_bn_GetUint32(HOBJECT object, unsigned int* pvalue); \
...
...
@@ -187,6 +194,7 @@ typedef struct sIBigNumber {
static int _obj##_bn_DivU(HOBJECT object, HOBJECT src0, HOBJECT src1); \
static int _obj##_bn_ModU(HOBJECT object, HOBJECT src0, HOBJECT src1); \
static int _obj##_bn_Neg(HOBJECT object, HOBJECT src); \
static int _obj##_bn_Abs(HOBJECT object, HOBJECT src); \
static int _obj##_bn_IsGT(HOBJECT object, HOBJECT src); \
static int _obj##_bn_IsGE(HOBJECT object, HOBJECT src); \
static int _obj##_bn_IsLT(HOBJECT object, HOBJECT src); \
...
...
@@ -201,9 +209,10 @@ typedef struct sIBigNumber {
static int _obj##_bn_IsNEU(HOBJECT object, HOBJECT src); \
static int _obj##_bn_IsZero(HOBJECT object); \
static int _obj##_bn_IsNotZero(HOBJECT object); \
static int _obj##_bn_IsNeg(HOBJECT object); \
static int _obj##_bn_AndL(HOBJECT object, HOBJECT src); \
static int _obj##_bn_OrL(HOBJECT object, HOBJECT src); \
static int _obj##_bn_NotL(HOBJECT object
, HOBJECT src
); \
static int _obj##_bn_NotL(HOBJECT object); \
static int _obj##_bn_And(HOBJECT object, HOBJECT src0, HOBJECT src1); \
static int _obj##_bn_Or(HOBJECT object, HOBJECT src0, HOBJECT src1); \
static int _obj##_bn_Xor(HOBJECT object, HOBJECT src0, HOBJECT src1); \
...
...
@@ -224,7 +233,9 @@ static const IBigNumber _obj##_bn_interface = { \
_obj##_bn_SetWidth, \
_obj##_bn_GetBits32, \
_obj##_bn_SetBits32, \
_obj##_bn_GetInt32, \
_obj##_bn_GetBit, \
_obj##_bn_SetBit, \
_obj##_bn_GetInt32, \
_obj##_bn_GetInt64, \
_obj##_bn_GetUint32, \
_obj##_bn_GetUint64, \
...
...
@@ -248,6 +259,7 @@ static const IBigNumber _obj##_bn_interface = { \
_obj##_bn_AddUint32, \
_obj##_bn_SubUint32, \
_obj##_bn_MulUint32, \
_obj##_bn_DivUint32, \
_obj##_bn_ModUint32, \
_obj##_bn_Add, \
_obj##_bn_Sub, \
...
...
@@ -260,6 +272,7 @@ static const IBigNumber _obj##_bn_interface = { \
_obj##_bn_DivU, \
_obj##_bn_ModU, \
_obj##_bn_Neg, \
_obj##_bn_Abs, \
_obj##_bn_IsGT, \
_obj##_bn_IsGE, \
_obj##_bn_IsLT, \
...
...
@@ -274,6 +287,7 @@ static const IBigNumber _obj##_bn_interface = { \
_obj##_bn_IsNEU, \
_obj##_bn_IsZero, \
_obj##_bn_IsNotZero, \
_obj##_bn_IsNeg, \
_obj##_bn_AndL, \
_obj##_bn_OrL, \
_obj##_bn_NotL, \
...
...
bignumber/src/bignumber.c
浏览文件 @
a9b1f348
此差异已折叠。
点击以展开。
examples/counter/src/main.c
浏览文件 @
a9b1f348
...
...
@@ -162,7 +162,7 @@ static int hdl4se_print_signal_list_detector()
unsigned
int
v
;
objectCall2
(
signal_value
,
SetWidth
,
32
,
0
);
objectCall2
(
signal_list
[
6
].
detector
,
GetSignalValue
,
signal_list
[
6
].
index
,
signal_value
);
objectCall1
(
signal_value
,
GetInt
,
&
v
);
objectCall1
(
signal_value
,
GetInt
32
,
&
v
);
if
(
v
!=
4
)
/* 只有F3按下的时候才记录 */
return
0
;
}
...
...
@@ -172,7 +172,7 @@ static int hdl4se_print_signal_list_detector()
objectCall2
(
signal_value
,
SetWidth
,
32
,
0
);
objectCall2
(
signal_list
[
i
].
detector
,
GetSignalValue
,
signal_list
[
i
].
index
,
signal_value
);
objectCall2
(
signal_value
,
SetWidth
,
signal_list
[
i
].
width
,
1
);
objectCall1
(
signal_value
,
GetInt
,
&
v
);
objectCall1
(
signal_value
,
GetInt
32
,
&
v
);
if
(
signal_list
[
i
].
width
<
9
)
{
fprintf
(
pSignalFile
,
",%d"
,
v
&
(
(
1
<<
signal_list
[
i
].
width
)
-
1
));
}
...
...
examples/digitled/src/digitled.c
浏览文件 @
a9b1f348
...
...
@@ -260,7 +260,7 @@ static int digitled_hdl4se_unit_GetValue(HOBJECT object, int index, int width, I
return
-
2
;
/* 上周期没有读命令,不响应,高阻状态 */
if
(
pobj
->
bReadAddr
==
0
)
{
/* 偏移地址为0,读按键状态 */
objectCall1
(
value
,
AssignInt
,
pobj
->
keypressed
);
objectCall1
(
value
,
AssignInt
32
,
pobj
->
keypressed
);
pobj
->
portdata
[
7
]
=
pobj
->
keypressed
;
return
0
;
}
...
...
@@ -278,7 +278,7 @@ static int digitled_hdl4se_unit_ClkTick(HOBJECT object)
for
(
i
=
0
;
i
<
7
;
i
++
)
{
if
(
0
==
objectCall3
(
pobj
->
fromunit
[
i
],
GetValue
,
i
,
32
,
temp
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
portdata
[
i
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
portdata
[
i
]);
}
}
objectRelease
(
temp
);
...
...
@@ -569,9 +569,9 @@ static int digitled_hdl4se_detector_GetSignalValue(HOBJECT object, int index, IB
return
-
1
;
objectCall2
(
value
,
SetWidth
,
32
,
0
);
if
(
index
<
8
)
objectCall1
(
value
,
AssignInt
,
pobj
->
portdata
[
index
]);
objectCall1
(
value
,
AssignInt
32
,
pobj
->
portdata
[
index
]);
if
(
index
==
8
)
objectCall1
(
value
,
AssignInt
,
pobj
->
baseaddr
);
objectCall1
(
value
,
AssignInt
32
,
pobj
->
baseaddr
);
objectCall2
(
value
,
SetWidth
,
digitled_datawidth
[
index
],
0
);
return
0
;
}
...
...
examples/testbignumber/testbignumber.c
浏览文件 @
a9b1f348
...
...
@@ -53,16 +53,16 @@ int main(int argc, char* argv[])
objectCall1
(
bignumber
,
AssignInt64
,
0x102435425566ll
);
objectCall3
(
bignumber
,
GetStr
,
16
,
buf
,
256
);
printf
(
"n=%s
\n
"
,
buf
);
objectCall
1
(
bignumber
,
AddInt
,
-
12
);
objectCall
2
(
bignumber
,
AddInt32
,
bignumber
,
-
12
);
objectCall3
(
bignumber
,
GetStr
,
16
,
buf
,
256
);
printf
(
"n=%s
\n
"
,
buf
);
objectCall1
(
bignumber2
,
AssignInt
,
-
12524
);
objectCall1
(
bignumber2
,
AssignInt
32
,
-
12524
);
objectCall3
(
bignumber2
,
GetStr
,
16
,
buf
,
256
);
printf
(
"n=%s
\n
"
,
buf
);
objectCall
1
(
bignumber
,
Mul
,
bignumber2
);
objectCall
2
(
bignumber
,
Mul
,
bignumber
,
bignumber2
);
objectCall3
(
bignumber
,
GetStr
,
16
,
buf
,
256
);
printf
(
"n=%s
\n
"
,
buf
);
objectCall
1
(
bignumber
,
SHR
,
8
);
objectCall
2
(
bignumber
,
SHR
,
bignumber
,
8
);
objectCall3
(
bignumber
,
GetStr
,
16
,
buf
,
256
);
printf
(
"n=%s
\n
"
,
buf
);
return
0
;
...
...
hdl4secell/src/hdl4se_bind2.c
浏览文件 @
a9b1f348
...
...
@@ -138,7 +138,7 @@ static int hdl4se_bind2Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
lstr
=
(
const
char
*
)
pParams
[
i
].
pvalue
;
for
(
j
=
0
;
j
<
BINDCOUNT
;
j
++
)
{
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
inputwidth
[
j
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
inputwidth
[
j
]);
lstr
=
nstr
;
}
}
...
...
@@ -214,8 +214,8 @@ static int hdl4se_bind2_hdl4se_unit_GetValue(HOBJECT object, int index, int widt
objectCall3
(
pobj
->
in
[
i
],
GetValue
,
pobj
->
in_index
[
i
],
pobj
->
inputwidth
[
i
],
pobj
->
in_data
[
i
]);
}
for
(
i
=
BINDCOUNT
-
1
;
i
>=
0
;
i
--
)
{
objectCall
1
(
pobj
->
out_data
,
SHL
,
pobj
->
inputwidth
[
i
]);
objectCall
1
(
pobj
->
out_data
,
Or
,
pobj
->
in_data
[
i
]);
objectCall
2
(
pobj
->
out_data
,
SHL
,
pobj
->
out_data
,
pobj
->
inputwidth
[
i
]);
objectCall
2
(
pobj
->
out_data
,
Or
,
pobj
->
out_data
,
pobj
->
in_data
[
i
]);
}
pobj
->
datavalid
=
1
;
}
...
...
hdl4secell/src/hdl4se_bind3.c
浏览文件 @
a9b1f348
...
...
@@ -138,7 +138,7 @@ static int hdl4se_bind3Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
lstr
=
(
const
char
*
)
pParams
[
i
].
pvalue
;
for
(
j
=
0
;
j
<
BINDCOUNT
;
j
++
)
{
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
inputwidth
[
j
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
inputwidth
[
j
]);
lstr
=
nstr
;
}
}
...
...
@@ -214,8 +214,8 @@ static int hdl4se_bind3_hdl4se_unit_GetValue(HOBJECT object, int index, int widt
objectCall3
(
pobj
->
in
[
i
],
GetValue
,
pobj
->
in_index
[
i
],
pobj
->
inputwidth
[
i
],
pobj
->
in_data
[
i
]);
}
for
(
i
=
BINDCOUNT
-
1
;
i
>=
0
;
i
--
)
{
objectCall
1
(
pobj
->
out_data
,
SHL
,
pobj
->
inputwidth
[
i
]);
objectCall
1
(
pobj
->
out_data
,
Or
,
pobj
->
in_data
[
i
]);
objectCall
2
(
pobj
->
out_data
,
SHL
,
pobj
->
out_data
,
pobj
->
inputwidth
[
i
]);
objectCall
2
(
pobj
->
out_data
,
Or
,
pobj
->
out_data
,
pobj
->
in_data
[
i
]);
}
pobj
->
datavalid
=
1
;
}
...
...
hdl4secell/src/hdl4se_bind4.c
浏览文件 @
a9b1f348
...
...
@@ -138,7 +138,7 @@ static int hdl4se_bind4Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
lstr
=
(
const
char
*
)
pParams
[
i
].
pvalue
;
for
(
j
=
0
;
j
<
BINDCOUNT
;
j
++
)
{
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
inputwidth
[
j
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
inputwidth
[
j
]);
lstr
=
nstr
;
}
}
...
...
@@ -214,8 +214,8 @@ static int hdl4se_bind4_hdl4se_unit_GetValue(HOBJECT object, int index, int widt
objectCall3
(
pobj
->
in
[
i
],
GetValue
,
pobj
->
in_index
[
i
],
pobj
->
inputwidth
[
i
],
pobj
->
in_data
[
i
]);
}
for
(
i
=
BINDCOUNT
-
1
;
i
>=
0
;
i
--
)
{
objectCall
1
(
pobj
->
out_data
,
SHL
,
pobj
->
inputwidth
[
i
]);
objectCall
1
(
pobj
->
out_data
,
Or
,
pobj
->
in_data
[
i
]);
objectCall
2
(
pobj
->
out_data
,
SHL
,
pobj
->
out_data
,
pobj
->
inputwidth
[
i
]);
objectCall
2
(
pobj
->
out_data
,
Or
,
pobj
->
out_data
,
pobj
->
in_data
[
i
]);
}
pobj
->
datavalid
=
1
;
}
...
...
hdl4secell/src/hdl4se_binop.c
浏览文件 @
a9b1f348
...
...
@@ -152,7 +152,7 @@ static int hdl4se_binopCreate(const PARAMITEM* pParams, int paramcount, HOBJECT*
lstr
=
(
const
char
*
)
pParams
[
i
].
pvalue
;
for
(
j
=
0
;
j
<
INCOUNT
;
j
++
)
{
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
in_width
[
j
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
in_width
[
j
]);
}
else
{
return
EIID_INVALIDPARAM
;
...
...
@@ -160,14 +160,14 @@ static int hdl4se_binopCreate(const PARAMITEM* pParams, int paramcount, HOBJECT*
lstr
=
nstr
;
}
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
out_width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
out_width
);
}
else
{
return
EIID_INVALIDPARAM
;
}
lstr
=
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
op
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
op
);
}
else
{
return
EIID_INVALIDPARAM
;
...
...
@@ -243,62 +243,55 @@ static int hdl4se_binop_hdl4se_unit_GetValue(HOBJECT object, int index, int widt
objectCall3
(
pobj
->
wire_in
[
i
],
GetValue
,
pobj
->
wire_in_index
[
i
],
pobj
->
in_width
[
i
],
pobj
->
in_data
[
i
]);
switch
(
pobj
->
op
)
{
case
BINOP_ADD
:
objectCall1
(
pobj
->
out_data
,
Assign
,
pobj
->
in_data
[
0
]);
objectCall1
(
pobj
->
out_data
,
Add
,
pobj
->
in_data
[
1
]);
objectCall2
(
pobj
->
out_data
,
Add
,
pobj
->
in_data
[
0
],
pobj
->
in_data
[
1
]);
break
;
case
BINOP_SUB
:
objectCall1
(
pobj
->
out_data
,
Assign
,
pobj
->
in_data
[
0
]);
objectCall1
(
pobj
->
out_data
,
Sub
,
pobj
->
in_data
[
1
]);
objectCall2
(
pobj
->
out_data
,
Sub
,
pobj
->
in_data
[
0
],
pobj
->
in_data
[
1
]);
break
;
case
BINOP_MUL
:
objectCall1
(
pobj
->
out_data
,
Assign
,
pobj
->
in_data
[
0
]);
objectCall1
(
pobj
->
out_data
,
Mul
,
pobj
->
in_data
[
1
]);
objectCall2
(
pobj
->
out_data
,
Mul
,
pobj
->
in_data
[
0
],
pobj
->
in_data
[
1
]);
break
;
case
BINOP_DIV
:
objectCall1
(
pobj
->
out_data
,
Assign
,
pobj
->
in_data
[
0
]);
objectCall1
(
pobj
->
out_data
,
Div
,
pobj
->
in_data
[
1
]);
objectCall2
(
pobj
->
out_data
,
Div
,
pobj
->
in_data
[
0
],
pobj
->
in_data
[
1
]);
break
;
case
BINOP_EQ
:
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
if
(
objectCall1
(
pobj
->
in_data
[
0
],
IsEQ
,
pobj
->
in_data
[
1
]))
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
break
;
case
BINOP_NE
:
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
if
(
objectCall1
(
pobj
->
in_data
[
0
],
IsEQ
,
pobj
->
in_data
[
1
]))
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
break
;
case
BINOP_LT
:
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
if
(
objectCall1
(
pobj
->
in_data
[
0
],
IsLT
,
pobj
->
in_data
[
1
]))
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
break
;
case
BINOP_LE
:
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
if
(
objectCall1
(
pobj
->
in_data
[
0
],
IsLE
,
pobj
->
in_data
[
1
]))
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
break
;
case
BINOP_GE
:
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
if
(
objectCall1
(
pobj
->
in_data
[
0
],
IsLT
,
pobj
->
in_data
[
1
]))
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
break
;
case
BINOP_GT
:
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
if
(
objectCall1
(
pobj
->
in_data
[
0
],
IsLE
,
pobj
->
in_data
[
1
]))
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
break
;
case
BINOP_AND
:
objectCall1
(
pobj
->
out_data
,
Assign
,
pobj
->
in_data
[
0
]);
objectCall1
(
pobj
->
out_data
,
And
,
pobj
->
in_data
[
1
]);
objectCall2
(
pobj
->
out_data
,
And
,
pobj
->
in_data
[
0
],
pobj
->
in_data
[
1
]);
break
;
case
BINOP_OR
:
objectCall1
(
pobj
->
out_data
,
Assign
,
pobj
->
in_data
[
0
]);
objectCall1
(
pobj
->
out_data
,
Or
,
pobj
->
in_data
[
1
]);
objectCall2
(
pobj
->
out_data
,
Or
,
pobj
->
in_data
[
0
],
pobj
->
in_data
[
1
]);
break
;
case
BINOP_XOR
:
objectCall1
(
pobj
->
out_data
,
Assign
,
pobj
->
in_data
[
0
]);
objectCall1
(
pobj
->
out_data
,
Xor
,
pobj
->
in_data
[
1
]);
objectCall2
(
pobj
->
out_data
,
Xor
,
pobj
->
in_data
[
0
],
pobj
->
in_data
[
1
]);
break
;
}
pobj
->
datavalid
=
1
;
...
...
hdl4secell/src/hdl4se_const.c
浏览文件 @
a9b1f348
...
...
@@ -112,7 +112,7 @@ static int hdl4se_constCreate(const PARAMITEM* pParams, int paramcount, HOBJECT*
if
(
temp
!=
NULL
)
{
const
char
*
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
if
(
pobj
->
width
<=
0
||
pobj
->
width
>
(
1
<<
24
))
return
-
1
;
...
...
hdl4secell/src/hdl4se_mux16.c
浏览文件 @
a9b1f348
...
...
@@ -135,7 +135,7 @@ static int hdl4se_mux16Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
if
(
temp
!=
NULL
)
{
const
char
*
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
objectRelease
(
temp
);
}
...
...
@@ -215,7 +215,7 @@ static int hdl4se_mux16_hdl4se_unit_GetValue(HOBJECT object, int index, int widt
if
(
pobj
->
datavalid
==
0
)
{
objectCall3
(
pobj
->
sel
,
GetValue
,
pobj
->
sel_index
,
MUXSELW
,
pobj
->
in_sel
);
objectCall2
(
pobj
->
in_sel
,
SetWidth
,
MUXSELW
,
0
);
objectCall1
(
pobj
->
in_sel
,
GetInt
,
&
sel
);
objectCall1
(
pobj
->
in_sel
,
GetInt
32
,
&
sel
);
sel
&=
MUXCOUNT
-
1
;
if
(
sel
>=
0
&&
sel
<
MUXCOUNT
)
{
objectCall3
(
pobj
->
in
[
sel
],
GetValue
,
pobj
->
in_index
[
sel
],
pobj
->
width
,
pobj
->
out_data
);
...
...
hdl4secell/src/hdl4se_mux2.c
浏览文件 @
a9b1f348
...
...
@@ -137,7 +137,7 @@ static int hdl4se_mux2Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
if
(
temp
!=
NULL
)
{
const
char
*
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
objectRelease
(
temp
);
}
...
...
@@ -218,7 +218,7 @@ static int hdl4se_mux2_hdl4se_unit_GetValue(HOBJECT object, int index, int width
if
(
pobj
->
datavalid
==
0
)
{
objectCall3
(
pobj
->
sel
,
GetValue
,
pobj
->
sel_index
,
MUXSELW
,
pobj
->
in_sel
);
objectCall2
(
pobj
->
in_sel
,
SetWidth
,
MUXSELW
,
0
);
objectCall1
(
pobj
->
in_sel
,
GetInt
,
&
sel
);
objectCall1
(
pobj
->
in_sel
,
GetInt
32
,
&
sel
);
sel
&=
MUXCOUNT
-
1
;
if
(
sel
>=
0
&&
sel
<
MUXCOUNT
)
{
objectCall3
(
pobj
->
in
[
sel
],
GetValue
,
pobj
->
in_index
[
sel
],
pobj
->
width
,
pobj
->
out_data
);
...
...
hdl4secell/src/hdl4se_mux4.c
浏览文件 @
a9b1f348
...
...
@@ -135,7 +135,7 @@ static int hdl4se_mux4Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
if
(
temp
!=
NULL
)
{
const
char
*
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
objectRelease
(
temp
);
}
...
...
@@ -215,7 +215,7 @@ static int hdl4se_mux4_hdl4se_unit_GetValue(HOBJECT object, int index, int width
if
(
pobj
->
datavalid
==
0
)
{
objectCall3
(
pobj
->
sel
,
GetValue
,
pobj
->
sel_index
,
MUXSELW
,
pobj
->
in_sel
);
objectCall2
(
pobj
->
in_sel
,
SetWidth
,
MUXSELW
,
0
);
objectCall1
(
pobj
->
in_sel
,
GetInt
,
&
sel
);
objectCall1
(
pobj
->
in_sel
,
GetInt
32
,
&
sel
);
sel
&=
MUXCOUNT
-
1
;
if
(
sel
>=
0
&&
sel
<
MUXCOUNT
)
{
objectCall3
(
pobj
->
in
[
sel
],
GetValue
,
pobj
->
in_index
[
sel
],
pobj
->
width
,
pobj
->
out_data
);
...
...
hdl4secell/src/hdl4se_mux8.c
浏览文件 @
a9b1f348
...
...
@@ -135,7 +135,7 @@ static int hdl4se_mux8Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
if
(
temp
!=
NULL
)
{
const
char
*
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
objectRelease
(
temp
);
}
...
...
@@ -214,7 +214,7 @@ static int hdl4se_mux8_hdl4se_unit_GetValue(HOBJECT object, int index, int width
pobj
=
(
sHDL4SEMux8
*
)
objectThis
(
object
);
if
(
pobj
->
datavalid
==
0
)
{
objectCall3
(
pobj
->
sel
,
GetValue
,
pobj
->
sel_index
,
MUXSELW
,
pobj
->
in_sel
);
objectCall1
(
pobj
->
in_sel
,
GetInt
,
&
sel
);
objectCall1
(
pobj
->
in_sel
,
GetInt
32
,
&
sel
);
objectCall2
(
pobj
->
in_sel
,
SetWidth
,
MUXSELW
,
0
);
sel
&=
MUXCOUNT
-
1
;
if
(
sel
>=
0
&&
sel
<
MUXCOUNT
)
{
...
...
hdl4secell/src/hdl4se_reg.c
浏览文件 @
a9b1f348
...
...
@@ -121,7 +121,7 @@ static int hdl4se_regCreate(const PARAMITEM* pParams, int paramcount, HOBJECT* p
if
(
temp
!=
NULL
)
{
const
char
*
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
objectRelease
(
temp
);
}
...
...
hdl4secell/src/hdl4se_split2.c
浏览文件 @
a9b1f348
...
...
@@ -141,7 +141,7 @@ static int hdl4se_split2Create(const PARAMITEM* pParams, int paramcount, HOBJECT
int
j
;
lstr
=
(
const
char
*
)
pParams
[
i
].
pvalue
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
else
{
return
-
1
;
...
...
@@ -149,14 +149,14 @@ static int hdl4se_split2Create(const PARAMITEM* pParams, int paramcount, HOBJECT
lstr
=
nstr
;
for
(
j
=
0
;
j
<
SPLITCOUNT
;
j
++
)
{
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
out_info
[
j
][
0
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
out_info
[
j
][
0
]);
}
else
{
return
-
1
;
}
lstr
=
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
out_info
[
j
][
1
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
out_info
[
j
][
1
]);
}
else
{
return
-
1
;
...
...
@@ -239,7 +239,7 @@ static int hdl4se_split2_hdl4se_unit_GetValue(HOBJECT object, int index, int wid
objectCall3
(
pobj
->
in
,
GetValue
,
pobj
->
in_index
,
pobj
->
width
,
pobj
->
in_data
);
pobj
->
datavalid
=
1
;
for
(
i
=
0
;
i
<
SPLITCOUNT
;
i
++
)
{
objectCall3
(
pobj
->
out_data
[
i
],
AssignSub
,
pobj
->
in_data
,
pobj
->
out_info
[
i
][
1
],
pobj
->
out_info
[
i
][
0
]);
objectCall3
(
pobj
->
out_data
[
i
],
AssignSub
Bits
,
pobj
->
in_data
,
pobj
->
out_info
[
i
][
1
],
pobj
->
out_info
[
i
][
0
]);
}
pobj
->
datavalid
=
1
;
}
...
...
hdl4secell/src/hdl4se_split4.c
浏览文件 @
a9b1f348
...
...
@@ -144,7 +144,7 @@ static int hdl4se_split4Create(const PARAMITEM* pParams, int paramcount, HOBJECT
int
j
;
lstr
=
(
const
char
*
)
pParams
[
i
].
pvalue
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
else
{
return
-
1
;
...
...
@@ -152,14 +152,14 @@ static int hdl4se_split4Create(const PARAMITEM* pParams, int paramcount, HOBJECT
lstr
=
nstr
;
for
(
j
=
0
;
j
<
SPLITCOUNT
;
j
++
)
{
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
out_info
[
j
][
0
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
out_info
[
j
][
0
]);
}
else
{
return
-
1
;
}
lstr
=
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
out_info
[
j
][
1
]);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
out_info
[
j
][
1
]);
}
else
{
return
-
1
;
...
...
@@ -242,7 +242,7 @@ static int hdl4se_split4_hdl4se_unit_GetValue(HOBJECT object, int index, int wid
objectCall3
(
pobj
->
in
,
GetValue
,
pobj
->
in_index
,
pobj
->
width
,
pobj
->
in_data
);
pobj
->
datavalid
=
1
;
for
(
i
=
0
;
i
<
SPLITCOUNT
;
i
++
)
{
objectCall3
(
pobj
->
out_data
[
i
],
AssignSub
,
pobj
->
in_data
,
pobj
->
out_info
[
i
][
1
],
pobj
->
out_info
[
i
][
0
]);
objectCall3
(
pobj
->
out_data
[
i
],
AssignSub
Bits
,
pobj
->
in_data
,
pobj
->
out_info
[
i
][
1
],
pobj
->
out_info
[
i
][
0
]);
}
pobj
->
datavalid
=
1
;
}
...
...
hdl4secell/src/hdl4se_unop.c
浏览文件 @
a9b1f348
...
...
@@ -138,21 +138,21 @@ static int hdl4se_unopCreate(const PARAMITEM* pParams, int paramcount, HOBJECT*
const
char
*
lstr
;
lstr
=
(
const
char
*
)
pParams
[
i
].
pvalue
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
in_width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
in_width
);
}
else
{
return
EIID_INVALIDPARAM
;
}
lstr
=
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
out_width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
out_width
);
}
else
{
return
EIID_INVALIDPARAM
;
}
lstr
=
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
lstr
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
op
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
op
);
}
else
{
return
EIID_INVALIDPARAM
;
...
...
@@ -220,31 +220,31 @@ static int hdl4se_unop_hdl4se_unit_GetValue(HOBJECT object, int index, int width
switch
(
pobj
->
op
)
{
case
UNOP_NEG
:
objectCall3
(
pobj
->
wire_in
,
GetValue
,
pobj
->
wire_in_index
,
pobj
->
in_width
,
pobj
->
out_data
);
objectCall
0
(
pobj
->
out_data
,
Neg
);
objectCall
1
(
pobj
->
out_data
,
Neg
,
pobj
->
out_data
);
break
;
case
UNOP_NOT
:
objectCall3
(
pobj
->
wire_in
,
GetValue
,
pobj
->
wire_in_index
,
pobj
->
in_width
,
pobj
->
out_data
);
objectCall
0
(
pobj
->
out_data
,
Not
);
objectCall
1
(
pobj
->
out_data
,
Not
,
pobj
->
out_data
);
break
;
case
UNOP_AND
:
objectCall3
(
pobj
->
wire_in
,
GetValue
,
pobj
->
wire_in_index
,
pobj
->
in_width
,
pobj
->
in_data
);
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
if
(
objectCall
0
(
pobj
->
out_data
,
uAnd
)
!=
0
)
{
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
if
(
objectCall
1
(
pobj
->
out_data
,
uAnd
,
pobj
->
out_data
)
!=
0
)
{
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
}
break
;
case
UNOP_OR
:
objectCall3
(
pobj
->
wire_in
,
GetValue
,
pobj
->
wire_in_index
,
pobj
->
in_width
,
pobj
->
in_data
);
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
if
(
objectCall
0
(
pobj
->
out_data
,
uOr
)
!=
0
)
{
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
if
(
objectCall
1
(
pobj
->
out_data
,
uOr
,
pobj
->
out_data
)
!=
0
)
{
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
}
break
;
case
UNOP_XOR
:
objectCall3
(
pobj
->
wire_in
,
GetValue
,
pobj
->
wire_in_index
,
pobj
->
in_width
,
pobj
->
in_data
);
objectCall1
(
pobj
->
out_data
,
AssignInt
,
0
);
if
(
objectCall
0
(
pobj
->
out_data
,
uXor
)
!=
0
)
{
objectCall1
(
pobj
->
out_data
,
AssignInt
,
1
);
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
0
);
if
(
objectCall
1
(
pobj
->
out_data
,
uXor
,
pobj
->
out_data
)
!=
0
)
{
objectCall1
(
pobj
->
out_data
,
AssignInt
32
,
1
);
}
break
;
}
...
...
hdl4secell/src/hdl4se_wire.c
浏览文件 @
a9b1f348
...
...
@@ -126,7 +126,7 @@ static int hdl4se_wireCreate(const PARAMITEM* pParams, int paramcount, HOBJECT*
if
(
temp
!=
NULL
)
{
const
char
*
nstr
;
if
(
0
==
objectCall2
(
temp
,
AssignStr
,
(
const
char
*
)
pParams
[
i
].
pvalue
,
&
nstr
))
{
objectCall1
(
temp
,
GetInt
,
&
pobj
->
width
);
objectCall1
(
temp
,
GetInt
32
,
&
pobj
->
width
);
}
objectRelease
(
temp
);
}
...
...
hdl4sesim/src/hdl4sesim.c
浏览文件 @
a9b1f348
...
...
@@ -145,7 +145,7 @@ static int hdl4sesim_hdl4se_unit_GetValue(HOBJECT object, int index, int width,
sHDL4SESim
*
pobj
;
pobj
=
(
sHDL4SESim
*
)
objectThis
(
object
);
if
(
index
==
0
)
{
/* 0.nwReset */
objectCall1
(
value
,
AssignInt
,
pobj
->
reset
);
objectCall1
(
value
,
AssignInt
32
,
pobj
->
reset
);
}
else
if
(
index
>=
1
&&
index
<=
6
)
{
/* 1..6 转发到topmodule*/
objectCall3
(
pobj
->
topmodule
,
GetValue
,
index
,
width
,
value
);
...
...
@@ -258,7 +258,7 @@ static int hdl4sesim_hdl4se_detector_GetSignalValue(HOBJECT object, int index, I
{
sHDL4SESim
*
pobj
;
pobj
=
(
sHDL4SESim
*
)
objectThis
(
object
);
objectCall1
(
value
,
AssignInt
,
pobj
->
reset
);
objectCall1
(
value
,
AssignInt
32
,
pobj
->
reset
);
objectCall2
(
value
,
SetWidth
,
1
,
1
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录