Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
饶先宏
hdl4se
提交
3c15e709
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,发现更多精彩内容 >>
提交
3c15e709
编写于
8月 11, 2021
作者:
饶先宏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
202108111109
上级
526babc2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
87 addition
and
11 deletion
+87
-11
examples/hdl4secnn/googlenet/verilog/main.c
examples/hdl4secnn/googlenet/verilog/main.c
+1
-1
hdl4secell/include/hdl4secell.h
hdl4secell/include/hdl4secell.h
+11
-1
hdl4secell/src/hdl4se_function.c
hdl4secell/src/hdl4se_function.c
+3
-0
hdl4secell/src/hdl4se_module.c
hdl4secell/src/hdl4se_module.c
+6
-5
hdl4sesim/src/hdl4sesim.c
hdl4sesim/src/hdl4sesim.c
+56
-1
hdl4seutils/include/threadlock.h
hdl4seutils/include/threadlock.h
+10
-3
未找到文件。
examples/hdl4secnn/googlenet/verilog/main.c
浏览文件 @
3c15e709
...
@@ -49,7 +49,7 @@ unsigned long long clocks = 0;
...
@@ -49,7 +49,7 @@ unsigned long long clocks = 0;
static
int
running
=
1
;
static
int
running
=
1
;
#define VCDOUTPUT
1
#define VCDOUTPUT
0
int
cnnInit
();
int
cnnInit
();
...
...
hdl4secell/include/hdl4secell.h
浏览文件 @
3c15e709
...
@@ -145,6 +145,7 @@ typedef struct sModuleFunction {
...
@@ -145,6 +145,7 @@ typedef struct sModuleFunction {
void
*
pobj
;
void
*
pobj
;
MODULE_FUNC
func
;
MODULE_FUNC
func
;
MODULE_FUNC
cur_func
;
MODULE_FUNC
cur_func
;
int
callit
;
PointerArray
variables
;
/* 影响的variables */
PointerArray
variables
;
/* 影响的variables */
}
ModuleFunction
;
}
ModuleFunction
;
...
@@ -239,7 +240,16 @@ int hdl4seCheckVariableArray(PointerArray* array);
...
@@ -239,7 +240,16 @@ int hdl4seCheckVariableArray(PointerArray* array);
ModuleFunction
*
functionCreateFunc
(
MODULE_FUNC
func
,
void
*
pobj
);
ModuleFunction
*
functionCreateFunc
(
MODULE_FUNC
func
,
void
*
pobj
);
ModuleFunction
*
functionCreateGetValue
(
ModuleVariable
*
var
);
ModuleFunction
*
functionCreateGetValue
(
ModuleVariable
*
var
);
int
functionDestroy
(
ModuleFunction
*
func
);
int
functionDestroy
(
ModuleFunction
*
func
);
int
functionCallAndSetNone
(
ModuleFunction
*
func
);
//int functionCallAndSetNone(ModuleFunction* func);
#define functionCallAndSetNone(obj) \
do { \
ModuleFunction * func = (ModuleFunction *)obj; \
int callit = LOCKED_SWAP(func->callit, 0); \
if (callit) { \
func->func(func->pobj, func->var); \
} \
} while (0)
int
hdl4se_split_string
(
const
char
*
string
,
char
**
substr
,
int
substrcount
,
int
gap
);
int
hdl4se_split_string
(
const
char
*
string
,
char
**
substr
,
int
substrcount
,
int
gap
);
unsigned
int
hdl4seGetParamUint32
(
const
char
*
param
);
unsigned
int
hdl4seGetParamUint32
(
const
char
*
param
);
...
...
hdl4secell/src/hdl4se_function.c
浏览文件 @
3c15e709
...
@@ -59,6 +59,7 @@ ModuleFunction* functionCreateFunc(MODULE_FUNC func, void* pobj)
...
@@ -59,6 +59,7 @@ ModuleFunction* functionCreateFunc(MODULE_FUNC func, void* pobj)
function
->
func
=
function
->
cur_func
=
func
;
function
->
func
=
function
->
cur_func
=
func
;
function
->
pobj
=
pobj
;
function
->
pobj
=
pobj
;
function
->
var
=
NULL
;
function
->
var
=
NULL
;
function
->
callit
=
1
;
pointerarrayInit
(
&
function
->
variables
);
pointerarrayInit
(
&
function
->
variables
);
return
function
;
return
function
;
}
}
...
@@ -77,12 +78,14 @@ static int gen_none(void* p, void* v)
...
@@ -77,12 +78,14 @@ static int gen_none(void* p, void* v)
return
0
;
return
0
;
}
}
/*
int functionCallAndSetNone(ModuleFunction* func)
int functionCallAndSetNone(ModuleFunction* func)
{
{
MODULE_FUNC genfunc;
MODULE_FUNC genfunc;
genfunc = LOCKED_SWAP_POINTER(func->cur_func, gen_none);
genfunc = LOCKED_SWAP_POINTER(func->cur_func, gen_none);
return genfunc(func->pobj, func->var);
return genfunc(func->pobj, func->var);
}
}
*/
int
functionDestroy
(
ModuleFunction
*
func
)
int
functionDestroy
(
ModuleFunction
*
func
)
{
{
...
...
hdl4secell/src/hdl4se_module.c
浏览文件 @
3c15e709
...
@@ -110,16 +110,16 @@ do { \
...
@@ -110,16 +110,16 @@ do { \
#define UpdateVariable(v) \
#define UpdateVariable(v) \
do { \
do { \
if (v->type != VTYPE_REG) { \
if (v->type != VTYPE_REG) { \
threadlockLock(v->lock); \
int updatefunc; \
if (v->updatefunc != 0) { \
updatefunc = LOCKED_SWAP(v->updatefunc, 0); \
if (v->updatefunc == 1) { \
if (updatefunc != 0) { \
if (updatefunc == 1) { \
hdl4seUpdateVariableGenFunc(v); \
hdl4seUpdateVariableGenFunc(v); \
} \
} \
else { \
else { \
hdl4seUpdateVariableGetValue(v); \
hdl4seUpdateVariableGetValue(v); \
} \
} \
} \
} \
threadlockUnlock(v->lock); \
} \
} \
} while (0)
} while (0)
#endif
#endif
...
@@ -681,7 +681,8 @@ int hdl4se_module_Setup(sGeneralModule* pobj)
...
@@ -681,7 +681,8 @@ int hdl4se_module_Setup(sGeneralModule* pobj)
for
(
i
=
0
;
i
<
pobj
->
funcs
.
itemcount
;
i
++
)
{
for
(
i
=
0
;
i
<
pobj
->
funcs
.
itemcount
;
i
++
)
{
ModuleFunction
*
function
=
(
ModuleFunction
*
)
pobj
->
funcs
.
array
[
i
];
ModuleFunction
*
function
=
(
ModuleFunction
*
)
pobj
->
funcs
.
array
[
i
];
function
->
cur_func
=
function
->
func
;
//function->cur_func = function->func;
function
->
callit
=
1
;
}
}
return
0
;
return
0
;
...
...
hdl4sesim/src/hdl4sesim.c
浏览文件 @
3c15e709
...
@@ -231,7 +231,7 @@ static int hdl4sesim_hdl4se_simulator_SetReset(HOBJECT object, int reset)
...
@@ -231,7 +231,7 @@ static int hdl4sesim_hdl4se_simulator_SetReset(HOBJECT object, int reset)
return
0
;
return
0
;
}
}
#define THREADCOUNT
9
#define THREADCOUNT
2
static
int
hdl4sesim_hdl4se_simulator_ClkTick
(
HOBJECT
object
)
static
int
hdl4sesim_hdl4se_simulator_ClkTick
(
HOBJECT
object
)
{
{
...
@@ -297,6 +297,15 @@ softmax_168 complete
...
@@ -297,6 +297,15 @@ softmax_168 complete
0.0356 n04505470 typewriter keyboard
0.0356 n04505470 typewriter keyboard
clocks: 1884160, TSPD=1359.422799cps, LSPD=1170.285714cps
clocks: 1884160, TSPD=1359.422799cps, LSPD=1170.285714cps
clocks: 1802240, TSPD=4681.142857cps, LSPD=4096.000000cps
softmax_168 complete
0.4901 n03085013 computer keyboard, keypad
0.1591 n04264628 space bar
0.0543 n04074963 remote control, remote
0.0438 n03832673 notebook, notebook computer
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=4687.175258cps, LSPD=5461.333333cps
threadcount=3
threadcount=3
clocks : 1867776, TSPD = 1552.598504cps, LSPD = 2048.000000cps
clocks : 1867776, TSPD = 1552.598504cps, LSPD = 2048.000000cps
softmax_168 complete
softmax_168 complete
...
@@ -317,6 +326,14 @@ softmax_168 complete
...
@@ -317,6 +326,14 @@ softmax_168 complete
0.0356 n04505470 typewriter keyboard
0.0356 n04505470 typewriter keyboard
clocks: 1884160, TSPD=1312.089136cps, LSPD=1260.307692cps
clocks: 1884160, TSPD=1312.089136cps, LSPD=1260.307692cps
clocks: 1802240, TSPD=4767.830688cps, LSPD=4096.000000cps
softmax_168 complete
0.4901 n03085013 computer keyboard, keypad
0.1591 n04264628 space bar
0.0543 n04074963 remote control, remote
0.0439 n03832673 notebook, notebook computer
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=4760.795812cps, LSPD=4096.000000cps
threadcount=2
threadcount=2
clocks: 1867776, TSPD=1562.992469cps, LSPD=1365.333333cps
clocks: 1867776, TSPD=1562.992469cps, LSPD=1365.333333cps
...
@@ -338,6 +355,25 @@ softmax_168 complete
...
@@ -338,6 +355,25 @@ softmax_168 complete
0.0356 n04505470 typewriter keyboard
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=1752.046243cps, LSPD=1820.444444cps
clocks: 1818624, TSPD=1752.046243cps, LSPD=1820.444444cps
usebigint == 0
clocks: 1802240, TSPD=3746.860707cps, LSPD=4096.000000cps
softmax_168 complete
0.4901 n03085013 computer keyboard, keypad
0.1591 n04264628 space bar
0.0543 n04074963 remote control, remote
0.0439 n03832673 notebook, notebook computer
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=3749.740206cps, LSPD=4096.000000cps
clocks: 1802240, TSPD=4114.703196cps, LSPD=4096.000000cps
softmax_168 complete
0.4901 n03085013 computer keyboard, keypad
0.1591 n04264628 space bar
0.0543 n04074963 remote control, remote
0.0439 n03832673 notebook, notebook computer
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=4114.533937cps, LSPD=4096.000000cps
threadcount=1
threadcount=1
clocks: 1867776, TSPD=993.497872cps, LSPD=963.764706cps
clocks: 1867776, TSPD=993.497872cps, LSPD=963.764706cps
softmax_168 complete
softmax_168 complete
...
@@ -348,6 +384,25 @@ softmax_168 complete
...
@@ -348,6 +384,25 @@ softmax_168 complete
0.0356 n04505470 typewriter keyboard
0.0356 n04505470 typewriter keyboard
clocks: 1884160, TSPD=993.755274cps, LSPD=1024.000000cps
clocks: 1884160, TSPD=993.755274cps, LSPD=1024.000000cps
usebitint == 0
clocks: 1802240, TSPD=2549.137199cps, LSPD=2730.666667cps
softmax_168 complete
0.4901 n03085013 computer keyboard, keypad
0.1591 n04264628 space bar
0.0543 n04074963 remote control, remote
0.0439 n03832673 notebook, notebook computer
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=2547.092437cps, LSPD=2340.571429cps
clocks: 1802240, TSPD=2802.861586cps, LSPD=2730.666667cps
softmax_168 complete
0.4901 n03085013 computer keyboard, keypad
0.1591 n04264628 space bar
0.0543 n04074963 remote control, remote
0.0439 n03832673 notebook, notebook computer
0.0356 n04505470 typewriter keyboard
clocks: 1818624, TSPD=2802.194145cps, LSPD=2730.666667cps
i9 10900 32G
i9 10900 32G
threadcount=32
threadcount=32
clocks: 1867776, TSPD=8768.901408cps, LSPD=8192.000000cps
clocks: 1867776, TSPD=8768.901408cps, LSPD=8192.000000cps
...
...
hdl4seutils/include/threadlock.h
浏览文件 @
3c15e709
...
@@ -61,7 +61,7 @@ void mt_free(void*);
...
@@ -61,7 +61,7 @@ void mt_free(void*);
#define LOCKED_INCREMENT(p) InterlockedIncrement(&p)
#define LOCKED_INCREMENT(p) InterlockedIncrement(&p)
#define LOCKED_DECREMENT(p) InterlockedDecrement(&p)
#define LOCKED_DECREMENT(p) InterlockedDecrement(&p)
#define LOCKED_SWAP_POINTER(p, v) InterlockedExchangePointer(&p, v)
#define LOCKED_SWAP_POINTER(p, v) InterlockedExchangePointer(&p, v)
#define LOCKED_SWAP(p, v) InterlockedExchange(&p, v)
#define STRDUP _strdup
#define STRDUP _strdup
#endif
#endif
...
@@ -69,7 +69,7 @@ void mt_free(void*);
...
@@ -69,7 +69,7 @@ void mt_free(void*);
#define LOCKED_INCREMENT(p) __sync_fetch_and_add(&p, 1);
#define LOCKED_INCREMENT(p) __sync_fetch_and_add(&p, 1);
#define LOCKED_DECREMENT(p) __sync_fetch_and_sub(&p, 1);
#define LOCKED_DECREMENT(p) __sync_fetch_and_sub(&p, 1);
#define LOCKED_SWAP_POINTER(p, v) __sync_val_compare_and_swap(&p, p, v)
#define LOCKED_SWAP_POINTER(p, v) __sync_val_compare_and_swap(&p, p, v)
#define LOCKED_SWAP(p, v) __sync_val_compare_and_swap(&p, p, v)
#define STRDUP strdup
#define STRDUP strdup
#endif
#endif
...
@@ -78,7 +78,14 @@ void mt_free(void*);
...
@@ -78,7 +78,14 @@ void mt_free(void*);
#define LOCKED_DECREMENT(p) p--
#define LOCKED_DECREMENT(p) p--
static
void
*
locked_swap_pointer
(
void
**
p
,
void
*
v
)
static
void
*
locked_swap_pointer
(
void
**
p
,
void
*
v
)
{
{
void
*
ret
=
v
;
void
*
ret
=
*
p
;
*
p
=
v
;
return
ret
;
}
#define LOCKED_SWAP_POINTER(p, v) locked_swap_pointer(&p, v)
static
long
locked_swap
(
long
*
p
,
long
v
)
{
long
ret
=
*
p
;
*
p
=
v
;
*
p
=
v
;
return
ret
;
return
ret
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录