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

202107031408

上级 0d6cb369
......@@ -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;
......
......@@ -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;
......
/* 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
......@@ -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.
先完成此消息的编辑!
想要评论请 注册