<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Adam Taylor on Medium]]></title>
        <description><![CDATA[Stories by Adam Taylor on Medium]]></description>
        <link>https://medium.com/@aptaylorceng?source=rss-bcb5840fe7b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*DoyZ_uAOLTICJqp2BxUTiw.jpeg</url>
            <title>Stories by Adam Taylor on Medium</title>
            <link>https://medium.com/@aptaylorceng?source=rss-bcb5840fe7b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 02:04:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aptaylorceng/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How To Implement A Real-time Human Detection Application at the Edge Using Zynq UltraScale+ MPSoC…]]></title>
            <link>https://medium.com/@aptaylorceng/how-to-implement-a-real-time-human-detection-application-at-the-edge-using-zynq-ultrascale-mpsoc-d25f0498572c?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d25f0498572c</guid>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Fri, 05 Jun 2020 16:19:14 GMT</pubDate>
            <atom:updated>2020-06-05T16:19:14.927Z</atom:updated>
            <content:encoded><![CDATA[<h3>How To Implement A Real-time Human Detection Application at the Edge Using Zynq UltraScale+ MPSoC Device</h3><p>The ability to perform real-time, low-latency and deterministic processing at the edge is increasingly important for a range of applications, from autonomous vehicles to vision guided robotics and intelligent surveillance systems.</p><p>Processing at the edge is required for four main reasons availability, latency, security and determinism. Should wireless communications be used to communicate to and from a cloud service where the processing is performed, connection to the cloud service cannot be guaranteed. As you might experience service outages and/or signal blackspots created by buildings or natural vegetation. Of course, processing time and decision making for sensitive data in the cloud will also increase the latency and decrease the determinism of the response making it unsuitable for real time safety critical decisions.</p><p>Edge processing addresses the availability, latency and determinism challenges. However, it can present additional challenges as, normally, the computational power available at the edge is much lower than is available in the cloud.</p><p>In this article, we will address the low power and high performance challenges of an edge processing system by implementing a real time human detection application using a Zynq UltraScale+ MPSoC device on an Aldec <a href="https://www.aldec.com/en/products/emulation/tysom_boards/zynq_ultrascale_mpsoc_boards/tysom_3a">TySOM-3A-ZU19EG</a> embedded development board.</p><h3>Zynq UltraScale+ MPSoC Heterogeneous System on Chip (SoC) Device</h3><p>Using heterogeneous System on Chip (SoC) devices, like the Zynq UltraScale+ MPSoC, enable the user to address the challenges of implementing low latency, deterministic processing at the edge. Unlike traditional processor-based solutions, heterogeneous SoCs are divided into two elements; a processing system which contains high performance ARM processor cores and programmable logic which provides structures based on the latest Xilinx FPGA fabric.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*Rch5kABkqVcL4yzGje_idA.png" /></figure><p>The flexibility provided by the programmable logic IO structures enables the implementation of any-to-any interfacing. This frees the designer from the IO constraints enforced by application specific standard part (ASSP) devices. For example, thanks to programmable logic’s IO flexibility, several MIPI interfaces can be implemented both as TX and RX and supporting a range of data rates, data lanes and data types. The flexible implementation of this logic enables the solution to be upgraded as sensor technology evolves.</p><p>Outside of the programmable logic IO structures the parallel nature of programmable logic itself enables the implementation of a true image processing pipeline. This image processing pipeline will be implemented in parallel due to the massively parallel nature of the programmable logic. This means the image processing pipeline is implemented internally to the programmable logic, removing the need to use DDR memory to store processing stages. This reduces latency and increases the determinism, as there is no need to compete for access to a system resource in DDR.</p><p>When developing solutions for a heterogeneous SoC we can leverage embedded Linux running on the software processing side of the device, while development of the programmable logic can take advantage of vendor-provided IP and increasingly high level synthesis; which allows C/C++ to be implemented in programmable logic.</p><p>One of the more exciting total system solutions is the use of system optimizing compilers such as SDSoC and Vitis which enable functions to be accelerated from the processing system to programmable logic leveraging the OpenCL framework. This enables system architects to further leverage the programmable logic to accelerate algorithms, this is especially true for accelerating Deep Neural Network applications thanks to the Xilinx Deep Learning Processor Unit (DPU).</p><h3>Implementation</h3><p>One example which demonstrates the capabilities of Zynq UltraScale+ MPSoC device at the edge is implementing a real-time human detection that can be used in surveillance cameras, ADAS, smart cameras, etc.</p><p>Such applications require the ability to configure and receive images from a camera, process the images and run convolutional neural networks (CNN) on the processed image. These processed images can then be output over HDMI and written to solid-state memory. To be able to demonstrate the algorithmic performance on programmable logic quickly and easily, Aldec’s <a href="https://www.aldec.com/en/products/emulation/tysom_boards/zynq_ultrascale_mpsoc_boards/tysom_3a">TySOM-3A-ZU19EG</a> development board along with <a href="https://www.aldec.com/en/products/emulation/daughter_cards/fmc_daughter/fmc_adas--fmc-adas">FMC-ADAS</a> (for capturing camera images) and <a href="https://www.aldec.com/en/products/emulation/daughter_cards/fmc_daughter/fmc_nvme">FMC-NVMe</a> (for recording the processed / raw data) can be used. These development boards enable the development team to hit the ground running. The following image shows an overview of the design example for this blog.</p><p>Accelerating your design in this manner enables you to demonstrate early progress to internal and external project stakeholders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*w5ClIn8fIVtY35b6_OxtZg.png" /></figure><p>The implementation of a real-time edge processing application requires significant resources to achieve the desired performance. The <a href="https://www.aldec.com/en/products/emulation/tysom_boards/zynq_ultrascale_mpsoc_boards/tysom_3a">TySOM-3A-ZU19EG</a>, which features the largest programmable logic in Zynq Ultrascale+ MPSoC devices, provides the designers with over 500K LUTs and 1M Flip Flops, exactly what is needed to implement such a challenging application. In addition to the largest Zynq UltraScale+ MPSoC device, TySOM-3A-ZU19EG provides a wide range of peripherals such as USB 3.0, USB 2.0, Ethernet, QSFP+, mPCIe, DisplayPort, HDMI IN/OUT, Wi-Fi and BLT, SATA, CAN, Pmod, UART, JTAG and FMC HPC connectors.</p><p>Capturing the video is done by the <a href="https://www.aldec.com/en/products/emulation/daughter_cards/fmc_daughter/fmc_adas--fmc-adas">FMC-ADAS</a> which includes five FPD-Link III connectors, frequently used for <a href="https://www.aldec.com/en/solutions/embedded/adas">ADAS and bird’s eye view applications</a>. A base platform can then be designed using Vivado which implements the image processing path; as a crucial part of the image processing path is making the video stream available to the processor system by storing frames in the Processor System DDR Memory. Higher level frame works such as GStreamer can then be used by the Processing System to work with the image stream.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*T16EExhN3J08sXXPHT2tTw.png" /></figure><p>To provide the NVMe SSD interface, Aldec’s FMC-NVMe is used. It provides four NVMe interfaces, which can each be stacked up to eight cards deep. This feature enables us to use up to 32 SSDs. Aldec provides <a href="https://www.aldec.com/en/solutions/embedded/nvme-data-storage">a detail solution page for NVMe data storage </a>using this FMC daughter card.</p><p>The PCIe capabilities of the programmable logic are used to perform reads and writes. Drivers for the PCIe access to the NVMe will be provided by the embedded Linux operating system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*gsbOxb0ei8BJ81LFSLBSkQ.png" /></figure><p>Of course, to display the output image on a HDMI monitor the Processor System DDR memory is accessed by the Xilinx Video Mixer IP block. This block can mix up to four video layers, ideal for the creation of overlays and graphics on the output video. For example, frame rate information and bounding boxes around detected objects.</p><p>This Vivado hardware design can be combined with an embedded petalinux solution targeting the TySOM board to create an acceleration platform used by SDSoC or Vitis. This platform can then be used across several projects to implement software accelerated solutions ranging from embedded vision applications to deep learning, as is the case in this example.</p><p>Using this acceleration platform in SDSoC or Vitis, it is possible to accelerate neural network inference. This acceleration will implement Xilinx DPUs within the programmable logic when the application is compiled. There are several different instantiations of the Xilinx DPU depending on the required resource utilization and performance goals. For this example, two of the largest and highest performance DPUs were implemented. Both are capable of 4096 operations per clock, and can be clocked at 300 MHz. <a href="https://www.aldec.com/en/products/emulation/tysom_boards/zynq_ultrascale_mpsoc_boards/tysom_3a">TySOM-3A-ZU19EG</a> enables us to implement these high performance DPU architecture thanks to the high capacity of programmable logic provided in the board’s Zynq Ultrascale+ MPSoC ZU19EG device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*ljZoNgyMyg4-5vwh4N0PXw.png" /></figure><p>The application software is then executed taking advantage of the platform image processing pipeline to capture and display an image, while the neural network — which is processing the image frames for people detection — is implemented on the Xilinx DPUs in the programmable logic. This enables a 720P image stream to be processed and detect people within the image stream at 30 FPS while at the same time writing to the NVMe SSD.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*1u6jd4dzvo9HTrQy_t51JQ.png" /></figure><p>When the project was implemented using SDSoC only about one third of the TySOM 3A’s total logic resources was used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*wTAnmWcPzImcc0-hQdPtpw.png" /></figure><p>This project demonstrated the capabilities of using a heterogeneous SoC to create edge processing applications which require low latency and determinism.</p><p>The use of Aldec’s <a href="https://www.aldec.com/en/products/emulation/tysom_boards/zynq_ultrascale_mpsoc_boards/tysom_3a">TySOM-3A-ZU19EG</a> embedded development kit along with the company’s <a href="https://www.aldec.com/en/products/emulation/daughter_cards/fmc_daughter/fmc_adas--fmc-adas">FMC-ADAS</a> and <a href="https://www.aldec.com/en/products/emulation/daughter_cards/fmc_daughter/fmc_nvme">FMC-NVMe</a> boards enabled us to de-risk the implementation of the algorithms and gave us the ability to start development early.</p><p>SDSoC enabled us to leverage the acceleration platforms to implement deep learning applications using only a software development environment.</p><p>The reference design for the human detection example at the edge was provided by Aldec, and is available to TySOM users. For further information, please <a href="https://www.aldec.com/en/company/contacts">contact Aldec</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d25f0498572c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MicroZed Chronicles: PetaLinux Build]]></title>
            <link>https://medium.com/@aptaylorceng/microzed-chronicles-petalinux-build-5a47b9a7d6d6?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a47b9a7d6d6</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Mon, 06 Apr 2020 10:50:28 GMT</pubDate>
            <atom:updated>2020-04-06T10:50:28.572Z</atom:updated>
            <content:encoded><![CDATA[<p>Having looked at creating the <a href="https://medium.com/@aptaylorceng/microzed-chronicles-petalinux-edition-build-elements-configuration-4d121881869b">virtual machine </a>and the different <a href="https://medium.com/@aptaylorceng/microzed-chronicles-petalinux-edition-build-elements-configuration-4d121881869b">build elements</a> of PetaLinux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TH6Bg_1-LKAWfRpWcmKtGQ.png" /></figure><p>In this blog I am going to demonstrate how we create a PetaLinux embedded Linux solution for our Zynq design. In this case we are going to use the <a href="https://store.digilentinc.com/cora-z7-zynq-7000-single-core-and-dual-core-options-for-arm-fpga-soc-development/">Cora Z7</a> as the target development board.</p><p>To create an embedded Linux solution for our Zynq, Zynq MPSoC or MicroBlaze solutions we start with a hardware design in Vivado.</p><p>For this application we are going to connect the Zynq Processing System (PS) to the LED and Push Buttons which are on the Cora Z7. This will make for a nice example in our next blog on interfacing between the PS and Programmable Logic (PL).</p><p>This connection is made using a AXI GPIO IP located within the PL, this is then connected to the PS Master AXI port as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhr8iWHYfLorXb4fc3--tQ.png" /></figure><p>Once this block diagram has been completed we need to implement the Vivado design and export the XSA with the bit stream included.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GEiUr8-QMANR595tvPD1jA.png" /></figure><p>Export the XSA to the project directory, this XSA will inform our embedded Linux solution about the configuration of the hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jw_a1JSjquUttpUlUreUkw.png" /></figure><p>With the XSA exported the next steps take place all within PetaLinux, the first thing we need to do is create a new project.</p><p>Within our Virtual Machine, the next step is to open a terminal window and create a new project using the command.</p><p><em>petalinux-create --type project --template zynq --name cora_z7</em></p><p>This will create a new project targeting the Zynq architecture with a project name of cora_z7.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*uFsie0a_ie_p7A0kmzYyUg.png" /></figure><p>The next step is to change directory into the newly created project, and then configure the project for the Cora Z7 and our design using the XSA just created in Vivado.</p><p><em>petalinux-config --get-hw-description=/&lt;location of XSA&gt;</em></p><p>This will open the PetaLinux system configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*3kd4KJQCDzR5SsMMdt9YKg.png" /></figure><p>In this case we do not wish to make any modifications, as such the we can select exit.</p><p>If you want to explore the kernel and rootfs settings you can use the commands</p><p><em>petalinux-config -c kernel</em></p><p><em>petalinux-config -c rootfs</em></p><p>As we do not need to make changes to either the kernel or the rootfs we can now build the PetaLinux operating system using</p><p><em>petalinx-build</em></p><p>Once the build process has finished, it may take some time we can then try the image on our Cora Z7 hardware using the commands</p><p><em>petalinux-build --jtag --fpga</em></p><p><em>petalinux-build --jtag -- kernel</em></p><p>This will program the Zynq device with the bit stream and then download the kernel.</p><p>Watching the boot output on a serial terminal will show you the Linux image booting on the Cora</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*joHCUSeq77CbzBBWgGSUyA.png" /></figure><p>If the above steps work and we have finished our testing and development we can then package the build objects to create a Bin file for booting from memory.</p><p><em>petalinux-package --boot --fsbl zynq_fsbl.elf --uboot uboot.elf --fpga system.bit</em></p><p>We can also package the PetaLinux project as a BSP such that if we wish to make changes to the PetaLinux system in the future we can use the BSP to create a new project, which is already configured correctly for our system.</p><p>Unlike all of the other commands this needs to be executed outside the project</p><p><em>petalinux-package --bsp -p &lt;project location&gt;</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*n6WaMmc-ZhvYPpoqQ0snmA.png" /></figure><p>No we have successfully built a Embedded Linux OS which is up and running on the Cora Board.</p><p>Next time we will look at how we can interface between the PS and PL when we are using PetaLinux.</p><p><strong>See My FPGA / SoC Projects: </strong><a href="https://www.hackster.io/adam-taylor">Adam Taylor on Hackster.io</a></p><p><strong>Get the Code: </strong><a href="https://github.com/ATaylorCEngFIET">ATaylorCEngFIET (Adam Taylor)</a></p><p><strong>Access the MicroZed Chronicles Archives with over 300 articles on the FPGA / Zynq / Zynq MpSoC updated weekly at </strong><a href="http://www.microzedchronicles.com/"><strong>MicroZed Chronicles.</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a47b9a7d6d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MicroZed Chronicles: PetaLinux Edition — Build Elements & Configuration]]></title>
            <link>https://medium.com/@aptaylorceng/microzed-chronicles-petalinux-edition-build-elements-configuration-4d121881869b?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d121881869b</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[microzed]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Fri, 20 Mar 2020 09:50:50 GMT</pubDate>
            <atom:updated>2020-03-20T09:50:50.392Z</atom:updated>
            <content:encoded><![CDATA[<h3>MicroZed Chronicles: PetaLinux Edition — Build Elements &amp; Configuration</h3><p>Having demonstrated how to get create a <a href="https://medium.com/@aptaylorceng/microzed-chronicles-petalinux-edition-getting-set-up-2b4534909b28">PetaLinux build environment</a>, we are now in position to be able to start creating embedded Linux solutions.</p><p>As such in this blog we are going to look at the different elements which are included in a PetaLinux build and which might need configuration.</p><p>As always we will start with the highest level element and its configuration.</p><blockquote>System — The main PetaLinux element which enables us to configure the highest level of our embedded Linux solution.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*g-S8AULWIuQsEqqBpkZbrw.png" /></figure><p>Elements which we may configure at the system level include, location of the RootFS e.g. INITRAMFS or External such as SD, USB etc. Using the system configuration we can also use an external Linux kernel or out of build kernel if desired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*irmA6j6Y69Q1VTomA-1kBg.png" /></figure><p>We can also configure the hardware elements such as stdin/stdout and baud rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*pvnjYOacX2R48T0E-rfFgg.png" /></figure><p>In the PetaLinux build flow the sytem configuration dialog is opened following the <strong><em>petalinux-config get-hw-definition</em></strong> or using the command <strong><em>petalinux-config</em></strong></p><blockquote>Kernel —The operating system and as such it is heart of our embedded Linux solution</blockquote><p>Elements we may need to configure in the kernel as part of our PetaLinux project are networking support, device drivers, libraries routines, file systems and memory management options. Within our PetaLinux project we can customize the kernel using the commands <strong><em>petalinux-config -c kernel</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*KV6vJZD1C-Utwn6vAiqIGA.png" /></figure><blockquote>Root File System — The rootfile system provides the embedded Linux system with the capability to boot, restore, repair and recover the system.</blockquote><p>Within the RootFS configuration we are able to ensure any custom applications we have created are included in our File System or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*4Idl1HH5NOlGkd3smi7fkg.png" /></figure><p>We are also able to configure any desired packages for our embedded Linux solution including OpenAMP, OpenCV, QT etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*fph0Tw79wEptSNRinOADEA.png" /></figure><blockquote>Device Tree — The Kernel needs to be able to understand its hardware configuration. Embedded Systems are often highly configurable at the hardware level. As such the Device Tree provides information to the kernel, including address, interrupt numbers, driver bindings etc.</blockquote><p>In PetaLinux when we apply the hardware definition the PetaLinux creates the device tree structures which are needed. However we may also need to add in additional elements to the device tree. To do this we can edit the device tree DTSI (device tree source include) available under the &lt;project&gt;/project-spec/meta-user/recipes-bsp/device-tree/files</p><p>In the example below you can see the DSTI file updated to enable the use of SPIDEV with spi0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/0*bLQUtyn9N7WE8CX1" /></figure><p>These device tree source and include files are then compiled into a device tree blob which is included with the kernel image.</p><p>Having looked at the different elements of the PetaLinux build process and what we may need to configure in our next blog we will create our first embedded Linux solution.</p><p><strong>See My FPGA / SoC Projects: </strong><a href="https://www.hackster.io/adam-taylor">Adam Taylor on Hackster.io</a></p><p><strong>Get the Code: </strong><a href="https://github.com/ATaylorCEngFIET">ATaylorCEngFIET (Adam Taylor)</a></p><p><strong>Access the MicroZed Chronicles Archives with over 300 articles on the FPGA / Zynq / Zynq MpSoC updated weekly at </strong><a href="http://www.microzedchronicles.com/"><strong>MicroZed Chronicles.</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d121881869b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MicroZed Chronicles: PetaLinux Edition— Getting Set Up]]></title>
            <link>https://medium.com/@aptaylorceng/microzed-chronicles-petalinux-edition-getting-set-up-2b4534909b28?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b4534909b28</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[microzed]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 12:28:34 GMT</pubDate>
            <atom:updated>2020-03-06T12:28:34.194Z</atom:updated>
            <content:encoded><![CDATA[<p>To get started creating a our PetaLinux solution we need to use a Linux Machine. In this blog we are going to look at how we can create a Linux Virtual Machine and Install PetaLinux. Once we have done this we are then able to create, build and experiment with PetaLinux projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3NEXnLz1ij3TTKuI1SO5g.png" /></figure><p>To install PetaLinux our Linux machine needs at least the following</p><ul><li>8 GB RAM</li><li>2 GHz CPU</li><li>100 GB free HDD</li><li>OS — Red Hat Enterprise Workstation/Server 7.4 / 7.5 / 7.6 (64-bit)</li><li>OS — CentOS Workstation/Server 7.4 / 7.5 / 7.6 (64-bit)</li><li>OS — Ubuntu Linux Workstation/Server 16.04.5 / 16.04.6 / 18.04.1 / 18.04.2 (64-bit)</li></ul><p>Due to the large varieties of Vivado / PetaLinux versions I work with, I prefer to create virtual machines on external SSD drives connected to my laptop over USB C. This means I can change between versions with ease and not use all the storage on my laptop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*Sqos6kIM4icqtpbybgQZSg.png" /><figcaption>Different PetaLinux machines on SSD for ease of changing version</figcaption></figure><p>To create a PetaLinux machine we will need</p><ul><li>Virtual Machine Software — <a href="https://www.oracle.com/technetwork/server-storage/virtualbox/overview/index.html">I use Oracle VM</a></li><li><a href="http://releases.ubuntu.com/16.04/">Ubuntu 16.04.</a>6</li><li><a href="https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html">PetaLinux Installer </a>+ Pre-Requisites</li></ul><p>Lets get started with creating the Linux VM, the first steps having installed the VM software are to create a new machine.</p><p>Make sure you allocate sufficient resources to this VM, I allocated 16 GB DDR and 150 GB storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kEglIEQQw89uUXVPAI0fZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xwDgHxtmeGJ0OBzVNaW2bg.png" /></figure><p>Once the new machine is created, we still have a few steps to follow before we can create a boot-able Linux VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ynvA7lL6znG7fKh1f1VpMQ.png" /></figure><p>The first step is to select the machine just created and increase the number of processors the VM can use beyond the default of 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vvntGYOft7GzTeLWFYrygQ.png" /></figure><p>With a more appropriate number of processors enabled (dependent on your system), we can start the VM and install Ubuntu.</p><p>When the VM is started you will be prompted for the location of the start up disk. This is the ISO we downloaded from the Ubuntu link above</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*4yzzGUzyG3rggsW9oCxGrA.png" /></figure><p>This will provide the the option to try or install Ubuntu, select install and complete the installation. When asked if you want to upgrade, decline the opportunity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9GU-mBkV2Jf-BFsNIsBgdA.png" /></figure><p>Once the installation is complete we can download the PetaLinux installer from the Xilinx website. To do this you will need to register for a Xilinx account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*63Ep4ZILpyDi_spNR-Rxvw.png" /></figure><p>With the installer downloaded the next step is to copy the installer into the installation directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*Y7_OwK1BAaY5PRzsbe3GAQ.png" /></figure><p>However, before we can install PetaLinux, we need to make sure we have all of the required packages installed.</p><p>Using a terminal window enter the command below to download any missing but required packages.</p><p><strong><em>sudo apt-get install -y gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib build-essential libsdl1.2-dev libglib2.0-dev zlib1g:i386 screen pax gzip gawk</em></strong></p><p>After the required packages are installed we are able to install PetaLinux, using the terminal window issue the command</p><p><strong><em>./petalinux-v2019.2-final-installer.run</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*MbFkD9UZWa5WR9Pecgp_mg.png" /></figure><p>Once the installation completes to make use of PetaLinux tools we need to first source the settings.sh script in the installation directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*9oPtP3FLCECUIBpmjCZ7Eg.png" /></figure><p>We are now able to get started using PetaLinux, which we will be looking at in the next blog!</p><p><strong>See My FPGA / SoC Projects: </strong><a href="https://www.hackster.io/adam-taylor">Adam Taylor on Hackster.io</a></p><p><strong>Get the Code: </strong><a href="https://github.com/ATaylorCEngFIET">ATaylorCEngFIET (Adam Taylor)</a></p><p><strong>Access the MicroZed Chronicles Archives with over 300 articles on the FPGA / Zynq / Zynq MpSoC updated weekly at </strong><a href="http://www.microzedchronicles.com/"><strong>MicroZed Chronicles.</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b4534909b28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MicroZed Chronicles: PetaLinux Edition]]></title>
            <link>https://medium.com/@aptaylorceng/microzed-chronicles-petalinux-edition-3bd47dfba64e?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bd47dfba64e</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[software-engineeering]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Fri, 21 Feb 2020 16:15:09 GMT</pubDate>
            <atom:updated>2020-02-21T16:15:09.099Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the years we have looked a lot at how we can use PetaLinux to create embedded Linux solutions for our Zynq, Zynq MPSoC and MicroBlaze solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XCgZB5Si65Xzt7U1fS4ttg.png" /><figcaption>Example Zynq configuration for the Digilent Cora</figcaption></figure><p>I thought it would be a good idea to dedicate a special series of blogs looking at PetaLinux, what it is and how we use it.</p><p>As such over this PetaLinux edition in addition to this introduction to PetaLinux, we are going to be looking at :-</p><ul><li>PetaLinux Build Environment — How to get started and what tools we need to create a complete PetaLinux deployment.</li><li>PetaLinux Build Components — What are the different elements of the build e.g. Root File System, Image, Device Tree.</li><li>PetaLinux Build Flow — How do we customize the OS.</li><li>PetaLinux Interfacing — How do we interface from the PetaLinux OS to our programmable logic design.</li></ul><p>Lets start at the beginning and understand what is PetaLinux? Simply put PetaLinux is a set of build tools which allow us to create an Embedded Linux solution for Xilinx processors (A9, A53 &amp; MicroBlaze) using a x86 Linux host.</p><p>At the highest level PetaLinux consists of only seven commands, these commands are used to create projects, applications, boot and deploy the embedded Linux OS.</p><p>These commands are</p><blockquote>petalinux-create — this command is used to create projects, apps &amp; modules. When creating projects we need to define either a template which can be zynq, zynqMP or microblaze. Alternatively we can define a source which contains a existing PetaLinux board support package.</blockquote><p>Most custom projects will start with targeting a processor type, before creating a board support package later in the development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_guLO_4ZCU8QpHBTE3G9g.png" /><figcaption>Example Command for project creation</figcaption></figure><blockquote>petalinux-config — this allows configuration of a specific element of the OS e.g. the kernel or the root file system. This also enables configuration of the OS for a new hardware definition using the <strong>get-hw-description </strong>option.</blockquote><p>The get-hardware-description option is a key stage in the development of the embedded Linux solution. This option configures the PetaLinux project for a specific hardware design created in Vivado, this includes configuring U-Boot, the Kernel and the Device Tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N7bEZEsW5VB77OCIDRl6Bw.png" /><figcaption>Example command for loading in the hardware definition</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFPxdotd1G0nKrA68bg1TA.png" /><figcaption>System Configuration Dialog</figcaption></figure><blockquote>petalinux-build — this command builds the embedded Linux project, a component of the project or the Yocto e-SDK.</blockquote><p>This command builds the PetaLinux project include the Bootloader, Kernel, PMUFW, Arm TrustZone, UBoot, Kernel and the root FS. If desired we can also use this command to build elements of the project e.g. kernel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uRkR7troMm12-_-V3vQfVw.png" /><figcaption>PetaLinux-Build Command Example</figcaption></figure><blockquote>petalinux-boot — this command enables us to boot the project on our target board using JTAG or to boot the project in the simulation environment in QEMU.</blockquote><p>Using QEMU we can emulate the Arm or MicroBlaze cores to run the PetaLinux project. This is great for debugging and ensuring the project actually boots as desired, it is especially useful if modules or kernel drivers have been included in the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ZAkmbOBxZNYivz1GAAc8Q.png" /><figcaption>Downloading the Bit file to the Cora Board</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6QJPVeQwZwx8CuNHBuvvHA.png" /><figcaption>Downloading the Kernel to the Cora Board</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bn7ZD6pV8SRLMwGFyaM-bg.png" /><figcaption>Cora Board Terminal Output</figcaption></figure><blockquote>petalinux-package — at the end of the project build we may desire to package the project to create a boot.bin which can be used in conjunction with the Kernel and RootFS to boot the system. This command can also be used to package the project as a Board Support Package.</blockquote><p>Packaging the project as a BSP enables the same settings to be quickly and easily applied to new projects going forward. This is very useful if the same development or custom board is to be used going forward for development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EqOhdCldjguQ_7acgs_zUA.png" /><figcaption>Packaging a boot file</figcaption></figure><blockquote>petalinux-upgrade — this commands provides for the upgrading between different versions of PetaLinux</blockquote><p>Using the upgrade command we can take BSPs or projects created in earlier versions and update them to the current release. This can save considerable time when it comes to changing existing project between versions of Vivado.</p><blockquote>petalinux-util — this command provides a number of services which are used in development and debugging</blockquote><p>This command provides the dfu-util for downloading and uploading over USB along with debugging via GDB, XSDB and JTAG.</p><p>Using these commands over the next few special editions of this blog we are going to create and work with PetaLinux solutions running on Zynq and Zynq MPSoC cores.</p><p><strong>See My FPGA / SoC Projects: </strong><a href="https://www.hackster.io/adam-taylor">Adam Taylor on Hackster.io</a></p><p><strong>Get the Code: </strong><a href="https://github.com/ATaylorCEngFIET">ATaylorCEngFIET (Adam Taylor)</a></p><p><strong>Access the MicroZed Chronicles Archives with over 300 articles on the FPGA / Zynq / Zynq MpSoC updated weekly at </strong><a href="http://www.microzedchronicles.com/"><strong>MicroZed Chronicles.</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bd47dfba64e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[High Level Synthesis Made Easier: Deeper Dive]]></title>
            <link>https://medium.com/@aptaylorceng/high-level-synthesis-made-easier-deeper-dive-cf7c1436cf97?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf7c1436cf97</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Fri, 08 Nov 2019 01:16:14 GMT</pubDate>
            <atom:updated>2019-11-08T01:16:14.491Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@aptaylorceng/high-level-synthesis-made-easier-429963e07597">In my last blog looking into Silexica’s SLX FPGA tool</a>, I introduced the tool, its concepts and of course the benefits it brought in accelerating not only the performance but also development time. In this example, I continue to see big benefits of using the SLX FPGA tool when using Xilinx’s HLS flow. Specifically, I see a 42x improvement in latency from SLX FPGA while only seeing a 5x in area (LUTs).</p><p>In this blog we are going to look a little more in detail at the development flow, targeting industrial an application algorithm. Commonly these industrial algorithms are used in? industrial control applications such as controlling a set point or converting measurements values into a value which can be further processed. Typical algorithms include</p><p>· Calendar-Van Dusen — used to convert a reading from a Platinum Resistance Thermometer to a temperature.</p><p>· Proportional Integral and Derivative algorithm — used in control applications to achieve a set point for example measuring a temperature and driving a heater to achieve the desired temperature.</p><p>Both to these algorithms can be implemented in software however, many industrial control systems require a low latency to ensure control and accuracy. As such accelerating the algorithm using High Level Synthesis is popular choice of course once the algorithm has been written we need to optimise its performance which is where SLX FPGA comes in.</p><p>Another benefit of accelerating algorithms in programmable logic is that larger batches of data can be processed and still achieve increased performance.</p><p>Creation of both the PID and CVD algorithms can be achieved quickly and easily using floating point maths that can then be synthesised using HLS.</p><p>Let’s look at the CVD algorithm and its implementation, mathematically this can be very complicated</p><p><strong><em>R=R0 ×(1+a×t+b×t²)</em></strong></p><p>Re arranging for temperature gives</p><p><strong><em>t= (-R0×a+√(R⁰²×a²-4×R0×b×(R0-R)))/(2×R0×b)</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*hOa7_DW8BEQarn47_WV5tA.png" /></figure><p>However, it can be implemented using polynomial approximation in C as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ax4Z4PDAONR6VEOkkGDQcA.png" /></figure><p>Running this code through Vivado HLS with no optimisations, produces an interval between calculations of 4225 clock cycles and resource utilisation of approximately 3%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*azn2bF3XDFu26QYFo9ZYdA.png" /><figcaption>Un-optimised Implementation</figcaption></figure><p>To get started with SLX FPGA the first thing we need to do is create a new project, we can then start adding in the source and test bench code. Like any development tool we want to ensure the correctness of the algorithm before we begin optimisation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*Thj875spQLJc0nfiAyg_GQ.png" /></figure><p>Once we have the project name entered, we can then select the target platform, selecting this is mainly for the SDSoC / VITIS flow. If we want to use a standard HLS flow, we can select this once the project has been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*KuXpfd73p9jrkRTRnj5IpQ.png" /></figure><p>With the project created, we will see the configuration settings dialog open for the project. It is using the configuration setting we control</p><p>· Vivado HLS or VITIS / SDSoC flow</p><p>· Project files for compilation and linker flags</p><p>· We can also identify the top function, the desired clock frequency and synthesis and estimation models</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*n7p9phgSvBtH6nWFcBzBlg.png" /><figcaption>Configuration of the HLS / SDSoC / VITIS Flow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*Lxm8NK_TZsk9XjUnnXZTuw.png" /><figcaption>HLS options</figcaption></figure><p>Within the configuration page we can also define the number of currently occupies resources in the platform, this is very useful for a SDSoC / SDAccel based flow.</p><p>We can also define the size of arrays we wish to partition to improve throughput, arrays below the complete partitioning limit are fractured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*RtWPmLwU8wPPRxHpLSvVhg.png" /><figcaption>HLS optimisations and configurations</figcaption></figure><p>We can also identify which functions are candidates for acceleration hardware, by defining he candidate threshold.</p><p>For this example, we are going to be using the HLS flow to implement the CVD algorithm. To identify the best HLS optimisations, we are going to use the following processes from the tool bar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*8v4_njkWWd0AjycMyfmXAQ.png" /></figure><p>1) Find Parallelism — Identify parallel data and pipeline parallelism.</p><p>2) HLS Hints — Review the HLS recommendations which include pipelining and partitioning.</p><p>3) HW Optimisation and Processing — Allows optimisation of the HLS suggestions.</p><p>4) Generate the HLS aware code — Insert the HLS optimisations into the source code</p><p>5) Synthesise the project — Implement the project with the HLS optimisations.</p><p>Clicking on the HLS Hints button will run first the find parallelism and then display the HLS Hints. HLS hints show several opportunities for optimising the presented source code, including the data-level pipelining and partitioning of arrays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*CkZystmIBGB6QaRcnq1rgw.png" /><figcaption>HLS Hints identifying the possible optimisations</figcaption></figure><p>With the HLS hints available, we can optimise using the hardware optimisation and partitioning dialog. This enables us to determine the number of times identified loops are unrolled, we can of course trade performance for area to achieve a lower initiation interval when we define this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*l1YqXNM08ZRoGz2_H4Ob1A.png" /></figure><p>As the batch size in this example is 128 samples we can if we desire and resource allow change the loop unroll factor to 128.</p><p>When this code was implemented using Vivado HLS via SLX FPGA. The performance was significantly improved over the original un-optimised code, producing a latency of 100 clocks compared to the original 4225 clocks. Of course, this implementation does use more significantly more logic resources at approximately 20% of the device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*Ean-KVbe1rERaWXXJtSXVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*ujkqUnDAT2bp5l24RY4YrQ.png" /><figcaption>Utilisation of the optimised HLS</figcaption></figure><p>As we can see running our code through SLX FPGA enables us to quickly and easily implement industrial control algorithms using HLS.</p><p>If you are interested in seeing a demo of SLX FPGA, the SLX FPGA team will be attending XDF in The Hague on the 12th &amp; 13th October.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf7c1436cf97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MicroZed Chronicles: XDF and VITIS]]></title>
            <link>https://medium.com/@aptaylorceng/microzed-chronicles-xdf-and-vitis-69a9eb7cf852?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/69a9eb7cf852</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[microzed]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Wed, 02 Oct 2019 17:04:57 GMT</pubDate>
            <atom:updated>2019-10-02T17:04:57.194Z</atom:updated>
            <content:encoded><![CDATA[<p>Since the announcement of the Versal ACAP at XDF18, there has been great interest in the software environment which developers will use to leverage Versal ACAP and its vast capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*s4iWx2bP7QlTgZio" /></figure><p>Yesterday in the keynote at XDF19, it was announced the new unified software environment would be called Vitis and most exciting of all it would be available from the end of the month be heavily open source based and free.</p><p>Fortuitously, when I registered which sessions I wanted to attend at XDF, I had selected most of the unified software environment talks. So in the reminder of this blog we will take a look at the important Vitis details.</p><p>The first thing to point out is the Vitis is not limited to only ACAP development it is also supports exiting Zynq, MPSoC and RFSoC devices as well. Meaning, we can start leveraging its development advantages in our existing developments.</p><p>Vitis is a unified software environment for all Xilinx platforms, which means we can use Vitis to develop applications for Alveo Accelerator cards, embedded platforms or FPGA in the cloud. Changing the target requires only changes to the make file.</p><p>To achieve this, Vitis uses a stack based architecture across four layers:</p><ul><li>Vitis AI — Domain specific architectures enabling TensorFlow and Caffe frameworks to be optimized, compressed and compiled to run on a Xilinx devices in minutes.</li><li>Vitis Accelerated Libraries — Several hardware accelerated libraries including video, image processing, AI, fintech and security.</li><li>Vitis Core — Includes the Xilinx Runtime library, compilers, debuggers and analyzers.</li><li>Vitis Base — Platform definition of the hardware including IO abstraction.</li></ul><p>One of the key elements of Vitis is the Xilinx Runtime (XRT), this is the same XRT which has been used for several years as part of the PCIe based accelerators like the Alveo boards.</p><p>XRT is combination of a runtime software layer and kernel driver that allows software to interact with programmable logic and Versal accelerators.</p><p>The development flow in Vitis is clearly defined for hardware and software:</p><ul><li>Hardware development flow uses C or C++ and high level compilers — the actual contents of the accelerator is determined by the SW calling hardware optimized libraries, RTL functions or translation into hardware directly. System composition and connectivity are defined by command lines</li><li>Software development flow is identical to a standard software build.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/0*pB6RAVRBl4rBrmji" /></figure><p>In a change from previous tools, Vitis is designed to plug in directly with popular open source development and build tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*1ne-JpmXHHNd2I7_" /></figure><p>To get going with the new tool, Xilinx have launched a developer area at <a href="https://developer.xilinx.com/">https://developer.xilinx.com</a>. Here, you can find 30 articles and documents across a range of applications showing how we can leverage Vitis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*c7OieZuReJb1g3ls" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*gch9yv9qe1UnbS8d" /></figure><p>It goes without saying that once Vitis is available, we will be heavily focusing on it in the blog as we explore how we can use to accelerate out Zynq, MPSoC and eventually Versal designs. Until then, stay tuned!</p><p><strong>See My FPGA / SoC Projects: Adam Taylor on Hackster.io</strong></p><p><strong>Get the Code: ATaylorCEngFIET (Adam Taylor)</strong></p><p><strong>Access the MicroZed Chronicles Archives with over 300 articles on the FPGA / Zynq / Zynq MpSoC updated weekly at MicroZed Chronicles.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69a9eb7cf852" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MicroZed Chronicles: Optimizing Our HLS Design with the Analysis Perspective]]></title>
            <link>https://medium.com/@aptaylorceng/microzed-chronicles-optimizing-our-hls-design-with-the-analysis-perspective-c9489a037815?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9489a037815</guid>
            <category><![CDATA[microzed]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Wed, 25 Sep 2019 14:03:36 GMT</pubDate>
            <atom:updated>2019-09-25T14:03:36.494Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://blog.hackster.io/microzed-chronicles-hls-working-with-loops-188787a04f1a">Last week</a>, we looked at how we could work with loops in our HLS source code, exploring how we can flatten, merge and unroll loops.</p><p>This week, we are going to look at how we can work with the HLS analysis perspective, so we can understand where our optimizations will have the best impact in our HLS source.</p><p>The analysis perspective is populated with information once we have run HLS synthesis and presents information regarding the hierarchy, resource utilization and most importantly latency of our design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4Rb45bL3rXywvXXgPAFBw.png" /><figcaption>HLS analysis view</figcaption></figure><p>For our first example, let’s take a look at the loop merge example from last week. With individual loop the latency is 353 clocks, between the ability to process a new input, this is reported in the synthesis view; however, if we want to optimize the performance, we need to know a little more about where the bottlenecks are.</p><p>This information is provided by the analysis perspective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*el4IiPqOT3Q83yarerNliA.png" /></figure><p>Within the analysis perspective, we will several windows that enable us to optimize further our design.</p><p>Taking the loop merge example from last week under the performance profile, you will notice three loops contained within the accum function. For each of the loops, the total latency is provided, which is the iteration latency multiplied by the trip count.</p><p>When it comes to optimizing the performance, we first want to focus upon the iteration latency. This is the time taken for each cycle of the loop to be implemented.</p><p>Once we have optimized the latency of each loop iteration, we can then work on optimizing the number of times the loop executes, e.g. the trip count.</p><p>In the case of the loop merge example to increase performance, the first step is to decrease the number of clock cycles required for each iteration of the loop.</p><p>To understand more about what operations in a loops iteration increases the latency, we can use the schedule viewer.</p><p>The schedule viewer allows us to see not only the operations but also cross probe to the source to understand which line of code causes this operation.</p><p>In the example below, you can see the load operation due to the read from the block RAM holding the values of variable A increases the latency. This takes over one clock cycle resulting in a increased latency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZCLwgGlWLj9FjIxZrLbkA.png" /></figure><p>We can use this information to fracture the BRAM, which contains the variable A. This is achieved by using an array partition pragma:</p><p><strong><em>#pragma HLS ARRAY_PARTITION variable=a complete dim=1</em></strong></p><p>Re-synthesizing the design now shows a reduced overall latency as the latency of loop_1 has been reduced by one third to 100 clocks. As each iteration of loop one now takes two clocks compared to the previous three clocks. However, the overall latency is still high at 303 clocks.</p><p>Exploring the schedule view in the analysis perspective this time if loop_1 is expanded show 50 entries for variable A as it has been completely fractured. It will also confirm the iteration latency is now two clocks for the loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OCdRuu-sCVFHoqDM3w2dhg.png" /></figure><p>If we apply the BRAM partition pragma to variable A and merge the loops as we did last week, we will achieve better performance than we do when just the loops are merged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ainH3qBYjH-VU40X_TOA8A.png" /></figure><p>Reducing the iteration interval from 102 clocks previously to 52 clocks. Overall this is a very significant reduction from the original 354 clock initiation interval.</p><p>Of course, as we have optimized for performance, we have traded increased logic resources for performance. But in this simple case, we have been able to increase the performance without unduly utilizing significant logic resources as such the trade-ff is very acceptable.</p><p>Hopefully now you understand a little more about how we can use the analysis perspective to optimize our HLS design. It really is very powerful and easy to use!</p><p><strong>See My FPGA / SoC Projects: </strong><a href="https://www.hackster.io/adam-taylor">Adam Taylor on Hackster.io</a></p><p><strong>Get the Code: </strong><a href="https://github.com/ATaylorCEngFIET">ATaylorCEngFIET (Adam Taylor)</a></p><p><strong>Access the MicroZed Chronicles Archives with over 300 articles on the FPGA / Zynq / Zynq MpSoC updated weekly at </strong><a href="http://www.microzedchronicles.com/"><strong>MicroZed Chronicles</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9489a037815" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MicroZed Chronicles: HLS Working with Loops]]></title>
            <link>https://medium.com/@aptaylorceng/microzed-chronicles-hls-working-with-loops-188787a04f1a?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/188787a04f1a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[microzed]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 13:51:44 GMT</pubDate>
            <atom:updated>2019-09-18T13:51:44.248Z</atom:updated>
            <content:encoded><![CDATA[<p>When we write code intended for HLS implementations, we tend to implement repetitive algorithms that process blocks of data — for example, signal or image processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*krCxGG5g_vgmN5Kb42qiAQ.png" /></figure><p>As such, our HLS source code in either C or C++ tends to include several loops or nested loops. When it comes to optimizing, performance loops are one on the places we can start exploring optimization.</p><p>By default, HLS loops are kept rolled. This means that each iteration of the loop uses the same hardware. Of course, this provides the worst performance as each iteration is sequential.</p><p>Let’s take a simple accumulator, as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/278/1*Zk2LyDdqjcVwflVn8wYevg.png" /></figure><p>With no optimization, we will notice that in the analysis view the implementation is sequential. This can be confirmed by looking at the trip count, which reports the number of iterations for the loop and the initiation interval. The initiation interval is the number of clocks between then the module can accept a new input values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*qdbdztIdYCJsj_n5LIz8kA.png" /></figure><p>To get optimal throughput, we want to ensure initiation interval is a short as possible.</p><p>To increase performance, we can unroll the loop and implement parallel implementations provided the loop bounds are static.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*joJm4PB5ex74wSnxrFPYLg.png" /></figure><p>When this is synthesized, we will see a significant reduction in the Initiation Interval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*R6kh4pf-XU2ge_vqStHnAQ.png" /></figure><p>There is no trip count defined as the loop is fully unrolled.</p><p>When we unroll loops, we are gaining a higher performance for increased logic utilization.</p><p>Of course, there may be times when we are unable to work accept the performance of the rolled loop but unable to accommodate a fully unrolled loops logic demands.</p><p>In this situation, we can partially unroll loops, by defining a unroll factor. For an example, let’s change the size of the accumulator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*qhNbsxQkDbjZYjJaQTU3pA.png" /></figure><p>By setting the unroll factor we can control the amount of parallelization of the loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*N-VHi3cA6BUad0w5iSkqaQ.png" /></figure><p>The analysis report will show the factored unrolled performance. In this case, tt takes half the latency of the rolled example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*hU9guvf5HiY8WLcdeWWuGQ.png" /></figure><p>You will also see this in the schedule viewer. Under the schedule viewer, you will see implementations of the algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*mIOsPARKvCUhyhVINbo6zA.png" /></figure><p>When we partially unroll the code, the HLS tool will implement an exit check in the loop in case the unroll factor does not result in a integer. However, if it is an integer, we can skip the exit check.</p><p>But how do we handle nested loops for example if we are doing matrix operations or image processing?</p><p>In this case, we have several options, although it depends on how we implement our loops. To get the best performance (lowest latency) when working with nested loops, we want to create a perfect nested loops.</p><p>In a perfect nested loop, again the loop bounds are constant and only the inner most loop contains any functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*NtugviHjxlPWW75DO8uWdQ.png" /></figure><p>In the case of a perfect loop, we can flatten the loop merging the outer and inner loops — enabling better performance when synthesized. A flattened loop will have a rolled trip count of <strong>n * m</strong> where <strong>n </strong>and <strong>m </strong>are the number of iterations of each loop.</p><p>If we have several loops implemented sequentially, we can also merge them.</p><p>Merging loops differs from flattening loop. In flattening loop, we are merging nested loops; when merging, we are merging several independent loops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*MjumSqgxTa_RgOniSdMrMQ.png" /></figure><p>When loops are merged, the maximum bound constraint is used.</p><p>If we want to merge the loops, there are a few constraints we need to consider first. We cannot merge loops that have FIFO accesses, variable bounds or execution side effects.</p><p>Let’s take a look at a very simple example of a loop merge, the code for which can be seen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*MsHaeUsXWvP3_wy2cV_DwQ.png" /></figure><p>When this code is synthesized with no optimization, the latency and trip counts are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*5K-6fpqpkN_27wqBPjOWOg.png" /></figure><p>However, if we take the opportunity to merge the three loops:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*TZg4Nk_BQSHIs2PoNyu4SQ.png" /></figure><p>The results when all three loops are merged can be seen below a much lower overall latency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*1BsgvZivc-0avWGv9T6xdw.png" /></figure><p>It is not just loop unrolling that we want to explore when optimizing our design for HLS. We also want to look at pipe-lining and memory partitioning, among others. I will do similar in depth deep dives soon!</p><p><strong>See My FPGA / SoC Projects: </strong><a href="https://www.hackster.io/adam-taylor">Adam Taylor on Hackster.io</a></p><p><strong>Get the Code: </strong><a href="https://github.com/ATaylorCEngFIET">ATaylorCEngFIET (Adam Taylor)</a></p><p><strong>Access the MicroZed Chronicles Archives with over 300 articles on the FPGA / Zynq / Zynq MpSoC updated weekly at </strong><a href="http://www.microzedchronicles.com/"><strong>MicroZed Chronicles</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=188787a04f1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[High Level Synthesis Made Easier!]]></title>
            <link>https://medium.com/@aptaylorceng/high-level-synthesis-made-easier-429963e07597?source=rss-bcb5840fe7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/429963e07597</guid>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Adam Taylor]]></dc:creator>
            <pubDate>Fri, 13 Sep 2019 18:50:40 GMT</pubDate>
            <atom:updated>2019-09-13T18:50:40.737Z</atom:updated>
            <content:encoded><![CDATA[<p>I have recently been evaluating the SLX FPGA tool from <a href="https://www.silexica.com/">Silexica</a>. If you are not familiar with <a href="https://www.silexica.com/products/slx-fpga/">SLX FPGA</a> it is designed to work with both Vivado HLS and SDSoC.</p><p>SLX FPGA was created to help address the challenges software engineers face deploying C/C++ applications on to programmable logic targets using High Level Synthesis (HLS). These challenges include detecting parallelism within the design, and optimizing the design to be able to leverage the parallelism for increased performance.</p><p>This optimization is achieved by identifying and inserting appropriate pragmas to provide level of optimization desired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*qB0LSWnCjycxuhqWtJngKg.png" /></figure><p>To perform the optimizations, SLX FPGA analyses the users HLS C Design and identifies Data Level Parallelism (DLP) and Pipeline Level Parallelism (PLP) structures within the HLS design. FPGA also determines the software call graph, read and write accesses to local, heap and global variables along with providing a holistic view of memory accesses.</p><p>To generate the suggested optimizations SLX FPGA uses three stages</p><ul><li>Check for synthesizability errors and guide the user through on how to fix them (see the synthesizability check and recommendation in figure 1 above)</li><li>Determine the Data Level and Pipeline Level Parallelism structures in the design.</li><li>Add the appropriate pragmas for optimal latency, throughput, or area.</li></ul><p>Let’s take a look at a simple example implementation of a AES 256 encryption. algorithm. The initial implementation of the HLS code without any pragmas or other optimizations resulted in the following latency and resource utilization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*cR6l5M2lIjW6G35h8dbCBQ.png" /></figure><p>This original code is therefore capable of processing a new AES Encryption every 1888 clock cycles when implemented in programmable logic. However, there exist several potential optimizations in the code which could be made in the code e.g. loops unrolled, and block RAMS partitioned.</p><p>Running the analysis in SLX FPGA on the AES Code (<a href="https://github.com/ATaylorCEngFIET/SLX_FPGA/tree/master/aes">input code is here</a>) produces the following results, identifying several potential optimizations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*tL2VHGgs6TwWB1AL83zNHA.png" /></figure><p>This analysis, shown above as SLX hints also breaks down the execution percentage of each element within the design. For example, in the above analysis you can see main loop in the AES Encryption function accounts for 66% of the execution time. While the loop which can be accelerated by pragma insertion accounts for 60% obviously making improvements here will yield big rewards in performance.</p><p>With the analysis completed we can then proceed to the hardware optimization and partitioning which is where we can enable or disable pragma suggestions. We can also change parameters at this stage such as unroll factors if we are willing to trade of additional logic resources for performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*hyTTEygHaEE_b89-VXm-Wg.png" /></figure><p>Once we are happy with the optimizations we can generate the code, as the generation progresses we will see both the original source code and the generated code side by side. This view is really useful as it allows us to see the location of the pragma insertions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdJvyzjsQtvEGVqknmk1FQ.png" /></figure><p>When this optimized design was completed, we see a significant increase in performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*3tZ1bxoZOk49ZqqKWz60NQ.png" /></figure><p>Compared to the original latency, the new design requires only 19% of the original non-optimized latency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*bHzuSPMd5iLwLIrK6PDYIQ.png" /></figure><p>While the resource requirements have increased to provide the performance again the logic footprint of the design is still very compact.</p><p>What is interesting to me having worked considerably with HLS over the years is how easy the insertion of pragmas was with SLX FPGA. HLS optimization can be challenging, iterative and time-consuming process, SLX FPGA made this much simpler.</p><p>This is especially true for engineers new to HLS or those from a non-FPGA development background who may not understand the internal device structures necessary to optimize the HLS design. Using SLX FPGA this analysis and optimization process becomes the click of a few buttons and reviewing the recommended optimization.</p><p>For advanced HLS engineers, SLX FPGA can be used as a double check to see that there wasn’t any performance that the engineer missed or to simply move the HLS design into FPGA faster if they are not familiar with the algorithm.</p><p>I am going to keep experimenting with this tool across a few more use cases to learn a little more about it and its capabilities!</p><p>If you are interested in seeing a demo of SLX FPGA, the SLX FPGA team will be attending both FPGA World on the 17th and 19th of September in Stockholm and Copenhagen and XDF in San Jose on the 1st to 2nd October.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=429963e07597" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>