Finally arrived at the HLS section. HLS is an abbreviation of High Level Synthesis, a tool that can integrate high-level programming languages ​​C, C++, and SystemC into RTL code. The development of productivity drives the design pattern. In the initial stage of electronic technology, people pay attention to the RLC circuit to solve the circuit response by establishing differential equations. The gate-level circuit is the initial package of RLC, and people use Boolean algebra and Karnaugh map for circuit design and analysis. Later, as the integrated circuit is further developed, the gate circuit can be integrated into macrocells such as registers, flip-flops, and ROM, and the design tools become more highly modular. Algorithm-level circuit design has never been a particularly good tool until HLS appears. HLS can directly map algorithms to RTL circuits, achieving high-level synthesis. At this level, System Generator is also a high-level synthesis tool because it integrates the matlab algorithm description into RTL code. If machine learning and artificial intelligence make a major breakthrough in the future, there may be a tool to integrate human natural language into RTL code. I wonder if we can witness its appearance. HLS learning resources can be referenced. This section gives a more general example of matrix and vector multiplication, from step-by-step optimization from full serial to full parallel. Matrix Lab Matlab is a relatively common mathematical simulation software. This blog is based on the R2013a version. In order to verify the correctness of matrix vector multiplication, we first use Matlab to generate test matrices and vectors, and use matlab to calculate the results. The code is as follows: [plain]
Clear;
Clc;
Close all;
N = 5;
A = randi([1,100],N,N);
b = randi(100,N,1);
c = A*b;
KKK_SaveToCHeaderFile(A,'A.h');
KKK_SaveToCHeaderFile(b, 'b.h');
KKK_SaveToCHeaderFile(c,'c.h');
Here is a simple example of A*b = c, where A is a 5X5 matrix, b is a 5X1 vector, and the result c is a 5X1 vector. Where KKK_SaveToCHeaderFile() is a subfunction that saves the matrix and vector as a C language array, defined as follows: [plain]
funcTIon [] = KKK_SaveToCHeaderFile(var,fn)
Fid = fopen(fn,'w');
Var = reshape(var.',1,[]);
Fprintf(fid, '%d,', var);
Fclose(fid);
Given the test routine, A is as follows: [plain]
82 10 16 15 66
91 28 98 43 4
13 55 96 92 85
92 96 49 80 94
64 97 81 96 68
b is as follows: [plain]
76
75
40
66
18
The obtained c is as follows: After running the matlab script, three files are generated: Ah, bh, ch, which are input data and reference results of the HLS program. Below we use the HLS tool to implement the functions of the above matrix X vector. The first step is to run Vivado HLS.
Typedef int data_type;
#define N 5
Void MatrixMultiply(data_type AA[N*N],data_type bb[N],data_type cc[N])
{
Int i,j;
For(i = 0;i { Data_type sum = 0; For(j = 0;j { Sum += AA[i*N+j]*bb[j]; } Cc[i] = sum; } } Grating-based External Cavity Tunable Laser Grating-Based External Cavity Tunable Laser,Red Grating Laser,Laser Grating Reflection,Grating Reflector Laser AcePhotonics Co.,Ltd. , https://www.cgphotonics.com