Adam Taylor玩转MicroZed系列第87 部分:SDSoC之三: 再让 SDSoC 转起来

热度142票  浏览6159次 【共0条评论】【我要评论 时间:2015年6月24日 16:50
Adam Taylor玩转MicroZed系列第87 部分:SDSoC之三: 再让 SDSoC 转起来

By Adam Taylor



So far in our journey with the Xilinx SDSoC development environment, we have created our first application, run it successfully on the ZedBoard, and obtained performance data for the multiply-and-add function when we run both the reference code and the code to be moved into the hardware within the PS side of the device.


Having established that both functions take a similar amount of time to execute, we are going to now move the multiply-and-add function into the PL (programmable logic) side of the Zynq SoC. It’s amazing how simple this is to achieve.


When we look at the file structure within the src directory of the example we will see the following:


  • cpp – Contains the main function, the golden calculation, time stamping, and calls to the mult and add functions, which are used in the hardware side of the device.
  • cpp – Contains the multiplication function to be off loaded into the hardware
  • cpp – Contains the addition function to be off loaded into the hardware.


The next step is to offload just one of these functions to the PL side of the Zynq SoC. We achieve this by one of two methods:

  1. Within the project explorer, we can expand the file to see the functions within that file, select the function of interest, right-click the function, and select Toggle HW/SW [H].





  1. We can open the file and under the outline tab on the right that shows the functions, we can again perform the same option:






Toggling the mmult() function to be accelerated within the hardware results in an [H] (for “hardware”) being added to the back of the function as shown below:







You will also see the function you have selected under the SDSoC Hardware Functions at the top, beneath your project within the project explorer tab:







Once we’ve done this, SDSoC linker will call automatically Vivado HLS and Vivado to implement the functions within the PL side of the SoC the next time we build the project. It will also create the relevant drivers within the software to support this move into hardware. (We will look more at these in the next blog).


In reality the offloading of the function to the PL side of the device becomes seamless, except that you get a significant performance increase.


When I moved the mmult() function into the hardware after compilation and generated the SD Card image, the speed increase was significant:







The execution time is only 52444 / 183289 = 0.28 or 28% of the time taken for execution last week when this all ran in software (183289 was the execution time last week).


Compared to the performance of the same function executed within the Zynq SoC’s PS (processor system), we have achieved this significant—better than 3x—performance in execution time by a simple mouse click.

Of course in more complex designs, there will be several functions we wish to accelerate. That is where the real power of SDSoC comes into its own and we will be looking at these situations.

In the next blog, we will look more closely at how SDSoC can offload and accelerate functions within the Zynq PL. This is just the start of the journey.





MicroZed Chronicles.jpg 




Now, you can have convenient, low-cost Kindle access to the first year of Adam Taylor’s MicroZed Chronicles for a mere $7.50. Click here.


TAG: Taylor
当前平均分:-0.21 (77次打分)
上一篇 下一篇