Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
饶先宏
hdl4se
提交
d9152b87
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 搜索 >>
提交
d9152b87
编写于
7月 03, 2021
作者:
饶先宏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
202107031408
上级
0d6cb369
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
109 addition
and
2 deletion
+109
-2
examples/hdl4secnn/cnn/c/cnn.c
examples/hdl4secnn/cnn/c/cnn.c
+3
-0
examples/hdl4secnn/cnn/include/cnn.h
examples/hdl4secnn/cnn/include/cnn.h
+1
-0
examples/hdl4secnn/cnn/verilog/cnncell.v
examples/hdl4secnn/cnn/verilog/cnncell.v
+104
-1
examples/hdl4secnn/googlenet/CMakeLists.txt
examples/hdl4secnn/googlenet/CMakeLists.txt
+1
-1
未找到文件。
examples/hdl4secnn/cnn/c/cnn.c
浏览文件 @
d9152b87
...
...
@@ -541,6 +541,7 @@ int cnn_net_do(cnn_layer_node ** nodes, int nodecount, cnn_layer_node * start, c
if
(
nodes
[
i
]
->
coeffsize
>
maxcoeffsize
)
maxcoeffsize
=
nodes
[
i
]
->
coeffsize
;
nodes
[
i
]
->
ready
=
0
;
printf
(
"Push data to:
\n
"
);
for
(
j
=
0
;
j
<
nodes
[
i
]
->
top_link_count
;
j
++
)
{
cnn_layer_node
*
pTopLayer
;
int
port
;
...
...
@@ -550,11 +551,13 @@ int cnn_net_do(cnn_layer_node ** nodes, int nodecount, cnn_layer_node * start, c
if
(
pTopLayer
->
used
==
0
)
continue
;
port
=
nodes
[
i
]
->
top_links
[
j
].
port
;
printf
(
"
\t
%d: %s(%d)
\n
"
,
j
,
pTopLayer
->
layer_info
->
layer_name
,
pTopLayer
->
layer_info
->
layer_type
);
pTopLayer
->
layer_info
->
funcs
->
pushdata
(
pTopLayer
,
port
,
pData
);
if
(
end
->
ready
)
{
break
;
}
}
}
if
(
end
->
ready
)
{
break
;
...
...
examples/hdl4secnn/cnn/include/cnn.h
浏览文件 @
d9152b87
...
...
@@ -143,6 +143,7 @@ typedef struct cnn_layer_node_func_s {
}
cnn_layer_node_func
;
struct
cnn_layer_s
{
int
layer_index
;
uint32_t
layer_type
;
const
cnn_layer_node_func
*
funcs
;
const
char
*
layer_name
;
...
...
examples/hdl4secnn/cnn/verilog/cnncell.v
浏览文件 @
d9152b87
/* cnncell.v */
/*
** 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.
*/
/*
* cnncell.v
202107030835: rxh, initial version
*/
/*
DEFINE_GUID(<<name>>,
0xfb3d226e, 0xd508, 0x476b, 0x81, 0xe1, 0xf3, 0xb2, 0x2c, 0xcf, 0x8f, 0x11);
*/
(
*
HDL4SE
=
"LCOM"
,
CLSID
=
"FB3D226E-D508-476B-81E1-F3B22CCF8F11"
,
softmodule
=
"hdl4se"
*
)
module
hdl4se_cnn_convolution
#(
parameter
WIDTH
=
224
,
HEIGHT
=
224
,
COMPONENT
=
3
,
W
=
7
,
H
=
7
,
N
=
64
,
SW
=
2
,
SH
=
2
,
PW
=
3
,
PH
=
3
,
ACT
=
0
,
DATAOFFSET
=
0
)
(
input
wClk
,
input
nwReset
,
output
wCoeffRead
,
/*系数读接口*/
input
wCoeffReadValid
,
output
[
31
:
0
]
bCoeffReadAddr
,
input
[
31
:
0
]
bCoeffReadData
,
input
wDataReadEnable
,
/*上游数据读接口*/
output
wDataRead
,
input
wDataReadValid
,
output
[
31
:
0
]
bDataReadAddr
,
input
[
31
:
0
]
bDataReadData
,
input
wDataWriteEnable
,
/*写下游数据接口*/
output
wDataWrite
,
output
[
31
:
0
]
bDataWriteAddr
,
output
wDataWriteComplete
);
endmodule
/*
DEFINE_GUID(<<name>>,
0xfb3d226e, 0xd508, 0x476b, 0x81, 0xe1, 0xf3, 0xb2, 0x2c, 0xcf, 0x8f, 0x11);
*/
(
*
HDL4SE
=
"LCOM"
,
CLSID
=
"FB3D226E-D508-476B-81E1-F3B22CCF8F11"
,
softmodule
=
"hdl4se"
*
)
module
hdl4se_cnn_innerproduct
#(
parameter
WIDTH
=
224
,
HEIGHT
=
224
,
COMPONENT
=
3
,
W
=
7
,
H
=
7
,
N
=
64
,
SW
=
2
,
SH
=
2
,
PW
=
3
,
PH
=
3
,
ACT
=
0
,
DATAOFFSET
=
0
)
(
input
wClk
,
input
nwReset
,
output
wCoeffRead
,
/*系数读接口*/
input
wCoeffReadValid
,
output
[
31
:
0
]
bCoeffReadAddr
,
input
[
31
:
0
]
bCoeffReadData
,
input
wDataReadEnable
,
/*上游数据读接口*/
output
wDataRead
,
input
wDataReadValid
,
output
[
31
:
0
]
bDataReadAddr
,
input
[
31
:
0
]
bDataReadData
,
input
wDataWriteEnable
,
/*写下游数据接口*/
output
wDataWrite
,
output
[
31
:
0
]
bDataWriteAddr
,
output
wDataWriteComplete
);
endmodule
examples/hdl4secnn/googlenet/CMakeLists.txt
浏览文件 @
d9152b87
...
...
@@ -177,5 +177,5 @@ add_executable(googlenet
)
include_directories
(
"../cnn/include"
)
target_link_libraries
(
googlenet cnn
m
)
target_link_libraries
(
googlenet cnn
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录