Using malloc() instead of sds_alloc()

For this exercise you start with the source used in lab3, modify the source to usemalloc()instead ofsds_alloc(), and observe how the data mover changes from Simple DMA to Scatter-Gather DMA.

  1. Double-click themain.cppin the Project Explorer view, under src folder, to bring up the source editor view.
  2. Find all the lines to where buffers are allocated withsds_alloc(), and replacesds_alloc()withmalloc()everywhere. Also remember to replace all calls tosds_free()withfree().
  3. Save your file.
  4. Right-click the top-level folder for the project and clickClean Projectin the menu.
  5. Right-click the top-level folder for the project and clickBuild Projectin the menu.
    Important:The build process can take approximately 5 to 10 minutes to complete.
  6. When the build completes, in the Project Explorer view, double-click to openRelease/_sds/reports/data_motion.html.
  7. The right-most column (Connection) shows the type of DMA assigned to each input/output array of the matrix multiplier (AXIDMA_SG= scatter gather DMA), and which Processing System 7 IP port is used (S_AXI_ACP). You can also see on the Accelerator Call sites table whether the allocation of the memory that is used on each transfer is contiguous or paged.

  8. Undo all the changes made in step 2 and save the file.