Skip to content
Snippets Groups Projects
Commit 8fc4ca47 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[StreamingFC] enable decoupled_mem_mode attribute setting

let the user manage which layer uses what kind of mem resource
defaults to auto
parent 799859ad
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -33,7 +33,8 @@ module ramb18_wf_dualport
parameter ID = 0,
parameter DWIDTH = 18,
parameter AWIDTH = 10,
parameter MEM_INIT = ""
parameter MEM_INIT = "",
parameter RAM_STYLE = "auto"
)
(
input clk,
......@@ -49,7 +50,7 @@ module ramb18_wf_dualport
output reg [DWIDTH-1:0] rdqb
);
(* ram_style = "block" *) reg [DWIDTH-1:0] mem[0:2**AWIDTH-1];
(* ram_style = RAM_STYLE *) reg [DWIDTH-1:0] mem[0:2**AWIDTH-1];
reg [DWIDTH-1:0] rdataa;
reg [DWIDTH-1:0] rdatab;
......
......@@ -92,6 +92,12 @@ class StreamingFCLayer_Batch(HLSCustomOp):
# const -- embedded weights, default, long compile/synth times
# decoupled -- streaming weights
"mem_mode": ("s", False, "const"),
# FPGA resource type for memories in decoupled mode
# auto -- let Vivado decide
# block -- use BRAM
# distributed -- use LUTRAM
# see also https://www.xilinx.com/support/answers/38070.html
"decoupled_ram_style": ("s", False, "auto"),
}
my_attrs.update(super().get_nodeattr_types())
return my_attrs
......@@ -983,6 +989,9 @@ class StreamingFCLayer_Batch(HLSCustomOp):
self.code_gen_dict["$MEM_DEPTH$"] = [
str(roundup_to_integer_multiple(self.calc_wmem(), 1024))
]
self.code_gen_dict["$RAM_STYLE$"] = [
self.get_nodeattr("decoupled_ram_style")
]
template = self.decoupled_wrapper
......
......@@ -188,6 +188,7 @@ memstream
.MEM_DEPTH($MEM_DEPTH$),
.MEM_WIDTH($WEIGHT_WIDTH$),
.MEM_INIT("./"),
.RAM_STYLE($RAM_STYLE$),
//widths per stream
.STRM0_WIDTH($WEIGHT_WIDTH$),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment