
Verilog搭建神经网络学习记录,Day3:两个模块的拼接
该模块的作用是进行乘累加操作。
·
1.模块拼接图
简易示意图,时钟线和复位线已省略
2.综合模块功能介绍
该模块的作用是进行乘累加操作
3.完整代码
`timescale 100 ns / 10 ps
module processingElement(clk,reset,floatA,floatB,result);
parameter DATA_WIDTH = 16;
input clk, reset;
input [DATA_WIDTH-1:0] floatA, floatB;
output reg [DATA_WIDTH-1:0] result;
wire [DATA_WIDTH-1:0] multResult;
wire [DATA_WIDTH-1:0] addResult;
floatMult FM (floatA,floatB,multResult);
floatAdd FADD (multResult,result,addResult);
always @ (posedge clk or posedge reset) begin
if (reset == 1'b1) begin
result = 0;
end else begin
result = addResult;
end
end
endmodule
更多推荐
所有评论(0)