Intel® High Level Synthesis Compiler Pro Edition: Best Practices Guide
ID
683152
Date
6/20/2022
Public
A newer version of this document is available. Customers should click here to go to the newest version.
1. Intel® HLS Compiler Pro Edition Best Practices Guide
2. Best Practices for Coding and Compiling Your Component
3. FPGA Concepts
4. Interface Best Practices
5. Loop Best Practices
6. fMAX Bottleneck Best Practices
7. Memory Architecture Best Practices
8. System of Tasks Best Practices
9. Datatype Best Practices
10. Advanced Troubleshooting
A. Intel® HLS Compiler Pro Edition Best Practices Guide Archives
B. Document Revision History for Intel® HLS Compiler Pro Edition Best Practices Guide
5.1. Reuse Hardware By Calling It In a Loop
5.2. Parallelize Loops
5.3. Construct Well-Formed Loops
5.4. Minimize Loop-Carried Dependencies
5.5. Avoid Complex Loop-Exit Conditions
5.6. Convert Nested Loops into a Single Loop
5.7. Place if-Statements in the Lowest Possible Scope in a Loop Nest
5.8. Declare Variables in the Deepest Scope Possible
5.9. Raise Loop II to Increase fMAX
5.10. Control Loop Interleaving
7.3.2. Example: Merging Memories Width-Wise
Use the hls_merge("<mem_name>","width") attribute to force the Intel® HLS Compiler Pro Edition to implement variables in the same memory system, merging their memories by width.
All variables with the same <mem_name> label set in their hls_merge attributes are merged.
Consider the following component code:
component short width_manual (int raddr, int waddr, short wdata) {
short a[256];
short b[256];
short rdata = 0;
// Lock step write
a[waddr] = wdata;
b[waddr] = wdata;
// Lock step read
rdata += a[raddr];
rdata += b[raddr];
return rdata;
}
Figure 39. Implementation of Local Memory for Component width_manual
In this case, the Intel® HLS Compiler Pro Edition can coalesce the load and store instructions to local memories a and b because their accesses are to the same address, as shown below.
component short width_manual (int raddr, int waddr, short wdata) {
short a[256] hls_merge("mem","width");
short b[256] hls_merge("mem","width");
short rdata = 0;
// Lock step write
a[waddr] = wdata;
b[waddr] = wdata;
// Lock step read
rdata += a[raddr];
rdata += b[raddr];
return rdata;
}
Figure 40. Width-Wise Merge of Local Memories for Component width_manual