Adding Pragmas to Control the Amount of Data Transferred

For this step, you use a different design template to show the use of the copy pragma. In this template an extra parameter calledMis passed to the matrix multiply function. This parameter allows the matrix multiplier function to multiply two square matrices of any sizeM*Mup to a maximum of 32*32. The top level allocation for the matrices creates matrices of the maximum size 32x32. TheMparameter tells the matrix multiplier function the size of the matrices to multiply, and the data copy pragma tells the SDSoC™ environment that it is sufficient to transfer a smaller amount of data corresponding to the actual matrix size instead of the maximum matrix size.

  1. Launch the SDx environment and create a new project for thezc702,Linuxplatform using thematrix multiplication with variable data sizedesign template:
    1. SelectFile>New>Xilinx SDx Project.
    2. In the new project dialog box, type in a name for the project (for examplelab3a)
    3. Selectzc702andLinux.
    4. ClickNext.
    5. SelectMatrix Multiplication Data Sizeas the application and clickFinish.
    6. Note that themmult_accelfunction has been marked for hardware acceleration.
  2. Set up the project to prevent building the bitstream and boot files by deselecting theGenerate bitstreamandGenerate SD Card Imagecheckboxes in the Options panel.
  3. Note that data copy pragmas are present in the code. They can be viewed by double-clickingmmult_accel.hin the Project Explorer view (under thesrcfolder) to bring up the source editor view.
    Note the pragmas that specify a different data copy size for each of the arrays. In the pragmas, you can use any of the scalar arguments of the function to specify the data copy size. In this case, Mis used to specify the size.
    #pragma SDS data copy(A[0:M*M], B[0:M*M], C[0:M*M]) #pragma SDS data access_pattern(A:SEQUENTIAL, B:SEQUENTIAL, C:SEQUENTIAL) void mmult_accel (float A[N*N], float B[N*N], float C[N*N], int M);
  4. Right-click the top-level folder for the project and clickBuild Projectin the menu.
  5. When the build completes, in the Project Explorer view, double-click to openData Motion Network Reportin the Reports tab.
  6. Observe the second column from the right, titledPragmas, to view the length of the data transfer for each array. The second table shows the transfer size for each hardware function call site.