{"id":474,"date":"2022-06-21T14:46:58","date_gmt":"2022-06-21T07:46:58","guid":{"rendered":"https:\/\/dgway.com\/blog_E\/?p=474"},"modified":"2022-06-24T09:48:08","modified_gmt":"2022-06-24T02:48:08","slug":"aat-demo-with-hardware-emulation","status":"publish","type":"post","link":"https:\/\/dgway.com\/blog_E\/2022\/06\/21\/aat-demo-with-hardware-emulation\/","title":{"rendered":"AAT demo with Hardware Emulation"},"content":{"rendered":"\n<p>From the previous topic about AAT Demo, Testing AAT demo by using physical hardware consumes much time in the compiling process. Therefore, it is not a practical method in the developing phase. Hardware Emulation might be a better choice when developing algorithms or hardwares.<\/p>\n\n\n\n<p><strong>Environment On this test<\/strong><\/p>\n\n\n\n<p>This test is conducted on AAT demo compatible with Vitis 2021.1 on Alveo card U50.<\/p>\n\n\n\n<p>First, open the terminal for the hardware emulator and set the environment of the terminal by typing these commands.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">source \/opt\/xilinx\/xrt\/setup.sh<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color has-black-color\">source \/tools\/Xilinx\/Vitis\/2021.1\/settings64.sh<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">export PLATFORM_REPO_PATHS=&#8217;\/opt\/xilinx\/platforms&#8217;<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">export XILINX_PLATFORM=&#8217;xilinx_u50_gen3x16_xdma_201920_3&#8242;<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">export DEVICE=&#8217;\/opt\/xilinx\/platforms\/xilinx_u50_gen3x16_xdma_201920_3\/xilinx_u50_gen3x16_xdma_201920_3.xpfm&#8217;<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">export DM_MODE=DMA<\/mark><\/p>\n\n\n\n<p><strong>Create xo and xclbin file<\/strong><\/p>\n\n\n\n<p>In order to decrease time spent on developing and meet the requirement of xo file. Edit buildall.sh file in folder build as shown in picture below<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"396\" height=\"908\" src=\"https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/1654408765275.jpg\" alt=\"\" class=\"wp-image-479\" srcset=\"https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/1654408765275.jpg 396w, https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/1654408765275-131x300.jpg 131w\" sizes=\"auto, (max-width: 396px) 100vw, 396px\" \/><\/figure>\n\n\n\n<p>Create xo file by using command below<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">.\/buildall.sh<\/mark><\/p>\n\n\n\n<p>It should not take a long time depending on the processor but 5 mins at least. Then, create the xclbin by using this command.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">make binary-container TARGET=hw_emu DEVICE=xilinx_u50_gen3x16_xdma_201920_3<\/mark><\/p>\n\n\n\n<p>Next, adding an environment for Hardware emulation by using below command.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">export XCL_EMULATION_MODE=hw_emu<\/mark><\/p>\n\n\n\n<p><strong>Build the software to manage AAT demo<\/strong><\/p>\n\n\n\n<p>Using the same terminal and navigating to the folder .\/sw\/application\/aat\/aat_shell_exe. Then, using the command below to generate aat_shell_exe.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">make<\/mark><\/p>\n\n\n\n<p>The \u201caat_shell_exe\u201d appears in folder .\/build. Go to the folder .\/build in order to change the name from \u201caat_shell_exe\u201d to \u201caat_shell_hw_emu_exe\u201d.<\/p>\n\n\n\n<p>Using the command below to generate a mandatory file for hardware emulation.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">emconfigutil &#8211;platform xilinx_u50_gen3x16_xdma_201920_3<\/mark><\/p>\n\n\n\n<p><strong>Program Alveo card<\/strong><\/p>\n\n\n\n<p>Using the same terminal to program the Alveo card by using the command below.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">.\/aat_shell_hw_emu_exe -i run support\/demo_setup_hw_emu.cfg<\/mark><\/p>\n\n\n\n<p>When programming the Alveo card completes. It shows the status as the picture below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"884\" height=\"427\" src=\"https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/programXCLBIN.jpg\" alt=\"\" class=\"wp-image-476\" srcset=\"https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/programXCLBIN.jpg 884w, https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/programXCLBIN-300x145.jpg 300w, https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/programXCLBIN-768x371.jpg 768w\" sizes=\"auto, (max-width: 884px) 100vw, 884px\" \/><\/figure>\n\n\n\n<p>But please wait until the callback is finished by showing the message \u201cEnd of script support\/demo_setup_hw_emu.cfg\u201d as the picture below. It takes 15 mins give or take depending on the computer.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"463\" src=\"https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/FinprogramXCLBIN.jpg\" alt=\"\" class=\"wp-image-477\" srcset=\"https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/FinprogramXCLBIN.jpg 938w, https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/FinprogramXCLBIN-300x148.jpg 300w, https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/FinprogramXCLBIN-768x379.jpg 768w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/figure>\n\n\n\n<p>Please be notice that the \u201cgetstatus\u201d, \u201creadata\u201d or etc. cannot be used for now.&nbsp; If user uses those commands. Hardware Emulation will collapse. The Emulation will allow to operate those commands after running the python script completed.<\/p>\n\n\n\n<p><strong>Install python library for hardware emulation<\/strong><\/p>\n\n\n\n<p>There are 3 libraries required to complete this task. Open a new terminal for python using. Using the below command to install libraries. For a Design Gateway client, you can skip this process due to completed installation in your system.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">sudo apt-get install python3-scapy<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">sudo apt-get install python3-protobuf<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">sudo apt-get install python3-six<\/mark><\/p>\n\n\n\n<p><strong>Running python script<\/strong><\/p>\n\n\n\n<p>Open the new terminal for running python script and navigating the folder .\/emulation\/runtime. Next, setting up the environment as the command below.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">source \/opt\/xilinx\/xrt\/setup.sh<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">source \/tools\/Xilinx\/Vitis\/2021.1\/settings64.sh<\/mark><\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">source setup.sh<\/mark><\/p>\n\n\n\n<p>Then, run the python script by using the command below.<\/p>\n\n\n\n<p><mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">python3 aat_hw_emu.py -i ..\/..\/build\/sample\/cme_input_arb.pcap -o aat_hw_emu_out.pcap -s 17<\/mark><\/p>\n\n\n\n<p>Wait until the message \u201cSocket is already closed\u201d shows as the picture below. Then, users are now allow to use command \u201cgetstatus\u201d, \u201creadata\u201d in the hardware emulator terminal.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"669\" height=\"231\" src=\"https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/FinPython.jpg\" alt=\"\" class=\"wp-image-478\" srcset=\"https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/FinPython.jpg 669w, https:\/\/dgway.com\/blog_E\/wp-content\/uploads\/2022\/06\/FinPython-300x104.jpg 300w\" sizes=\"auto, (max-width: 669px) 100vw, 669px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>From the previous topic about AAT Demo, Testing AAT demo by using physical hardware consumes much time in the compiling process. Therefore, it is not a practical method in the developing phase. Hardware Emulation might be a better choice when developing algorithms or hardwares. Environment On this test This test is conducted on AAT demo compatible with Vitis 2021.1 on&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":481,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-474","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-accelerated-computing-tutorial"],"_links":{"self":[{"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/posts\/474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/comments?post=474"}],"version-history":[{"count":1,"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/posts\/474\/revisions"}],"predecessor-version":[{"id":480,"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/posts\/474\/revisions\/480"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/media\/481"}],"wp:attachment":[{"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/media?parent=474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/categories?post=474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dgway.com\/blog_E\/wp-json\/wp\/v2\/tags?post=474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}