-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrow_weight_storage.v
More file actions
33 lines (27 loc) · 889 Bytes
/
Copy pathrow_weight_storage.v
File metadata and controls
33 lines (27 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module row_weight_storage #(
parameter SYSTOLIC_SIZE = 8,
parameter WEIGHT_WIDTH = 8,
parameter ADDR_WIDTH = $clog2(SYSTOLIC_SIZE)
)(
input wire clk,
input wire rst_n, // 考慮是否刪除
// Write interface (初始化權重資料)
input wire wr_en,
input wire [ADDR_WIDTH-1:0] wr_addr,
input wire [SYSTOLIC_SIZE*WEIGHT_WIDTH-1:0] wr_data,
// Read interface (給 systolic array)
input wire [ADDR_WIDTH-1:0] rd_addr,
output wire [SYSTOLIC_SIZE*WEIGHT_WIDTH-1:0] rd_data
);
// Internal memory storage
reg [SYSTOLIC_SIZE*WEIGHT_WIDTH-1:0] weight_memory [0:SYSTOLIC_SIZE-1];
// Write operation
always @(posedge clk) begin
if (wr_en) begin
weight_memory[wr_addr] <= wr_data;
end
else;
end
// Read operation
assign rd_data = weight_memory[rd_addr];
endmodule