{"id":491,"date":"2015-02-23T15:30:44","date_gmt":"2015-02-23T23:30:44","guid":{"rendered":"http:\/\/www.beyond-circuits.com\/wordpress\/?page_id=491"},"modified":"2016-07-25T14:45:40","modified_gmt":"2016-07-25T22:45:40","slug":"tutorial14","status":"publish","type":"page","link":"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial14\/","title":{"rendered":"Tutorial 14: Building an ARM FPGA"},"content":{"rendered":"<p>In this tutorial, we will use the stopwatch IP block that we build in <a title=\"Tutorial 13 \u2013 Creating an IP Component\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial13\/\">tutorial 12<\/a> to build an FPGA which includes the ARM processor.<\/p>\n<h1>Getting Started<\/h1>\n<p>Open the <em>stopwatch_controller<\/em> project you built in <a title=\"Tutorial 13 \u2013 Creating an IP Component\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial13\/\">tutorial 13<\/a>. If you have just completed <a title=\"Tutorial 13 \u2013 Creating an IP Component\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial13\/\">tutorial 13<\/a>, Vivado should already be open to the correct project. If not, just open the project in Vivado or follow the initial directions in <a title=\"Tutorial 13 \u2013 Creating an IP Component\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial13\/\">tutorial 13<\/a> to create the project.<\/p>\n<h2>Adding the repository<\/h2>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig4.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-495 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig4-300x233.png\" alt=\"tut14fig4\" width=\"300\" height=\"233\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig4-300x233.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig4-386x300.png 386w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig4.png 585w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>If you are creating a new project, you may need to add the IP repository that holds the <strong>stopwatch_controller<\/strong> that we designed in <a title=\"Tutorial 13 \u2013 Creating an IP Component\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial13\/\">tutorial 13<\/a>. To do that, select <em>Project Settings<\/em> from the <em>Project Manager<\/em> flow. This will bring up the <em>Project Settings<\/em> dialog box. Click the <em>IP<\/em> tab and then click the <em>Add Repository<\/em> button. Navigate to the <strong>ip_repo<\/strong> directory you created in <a title=\"Tutorial 13 \u2013 Creating an IP Component\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial13\/\">tutorial 13 <\/a>and add the repository. <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig5.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-496 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig5-300x253.png\" alt=\"tut14fig5\" width=\"300\" height=\"253\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig5-300x253.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig5-356x300.png 356w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig5.png 535w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You should see the <strong>stopwatch_controller<\/strong> listed as an element in the repository similar to the figure to the right. Go ahead and click <strong><em>OK<\/em><\/strong> to dismiss the dialog box.<\/p>\n<h2>Creating the block design<\/h2>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig1.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-493 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig1-300x72.png\" alt=\"tut14fig1\" width=\"300\" height=\"72\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig1-300x72.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig1.png 478w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Click the <em>Create Block Design<\/em> link in the <em>IP Integrator<\/em> section of the <em>Flow<\/em> window.<\/p>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig2.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-494 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig2-300x171.png\" alt=\"tut14fig2\" width=\"300\" height=\"171\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig2-300x171.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig2.png 446w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>This will bring up the <em>Create Block Design<\/em> dialog box. Enter the name stopwatch_system and click <strong><em>OK<\/em><\/strong>.<\/p>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig3.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-497 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig3-300x70.png\" alt=\"tut14fig3\" width=\"300\" height=\"70\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig3-300x70.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig3-500x116.png 500w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig3.png 840w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig6.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-498 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig6-300x82.png\" alt=\"tut14fig6\" width=\"300\" height=\"82\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig6-300x82.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig6.png 445w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>This will bring up a <em>Block Design<\/em> window. You will see a sub-window called <em>Diagram<\/em> with a prompt to <em>Add IP<\/em> from the catalog. Go ahead and click the link. This dialog box will show you all the available IP. The easiest thing to do is to start typing the first few letters of the IP block you want to instantiate and then press enter to instantiate the block. You will then see a block diagram component representing our <strong>stopwatch_controller<\/strong> IP block.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-499 alignleft\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig7.png\" alt=\"tut14fig7\" width=\"102\" height=\"55\" \/>Next, click the <em>Add IP<\/em> button to bring up the IP dialog box again. This time we will select the ZYNQ ARM processor. Go ahead and type ZYNQ into the search field. You will see two different ZYNQ IP blocks. One is a bus fu<img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-500 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig8-300x81.png\" alt=\"tut14fig8\" width=\"300\" height=\"81\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig8-300x81.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig8.png 446w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>nctional model (BFM) for simulating the ZYNQ\u00a0design. The other is the ZYNQ processor itself. Select the ZYNQ processing system\u00a0\u00a0and press <em>Enter<\/em>.<\/p>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig9.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-501 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig9-300x267.png\" alt=\"tut14fig9\" width=\"300\" height=\"267\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig9-300x267.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig9-337x300.png 337w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig9.png 541w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>You should see two instances in your <em>Diagram<\/em> window now: one for the ARM and one for the stopwatch controller. There are also two Designer Assistance links. The Run Connection Automation link will connect the ZYNQ ARM processor to the stopwatch controller. Go ahead and click that now. This will bring up a dialog box. Just go ahead and click <strong><em>OK<\/em><\/strong>. Notice that a few more IP blocks, a reset controller and an AXI interconnect block.<\/p>\n<p>Next, go ahead and click the <em>Run Block Automation<\/em> link. Click <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig10.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-502 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig10-300x163.png\" alt=\"tut14fig10\" width=\"300\" height=\"163\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig10-300x163.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig10-1024x558.png 1024w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig10-500x272.png 500w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig10.png 1039w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>OK to dismiss the dialog box. Notice how two connections for the ARM called <em>DDR<\/em>\u00a0and <em>FIXED_IO<\/em> have been added to the design. Finally, you can click the <em>Regenerate Layout<\/em> button to clean the page up.<\/p>\n<p>Now\u00a0we&#8217;ll need to turn our attention to the stopwatch\u00a0controller. There are a number of ports on that design that we want\u00a0to connect to the outside world. To do that we need to select each input or output and click the<em> Make External<\/em> button or type ctrl-T. As your mouse gets close to the input or output, the cursor will change to a pencil icon. Just select the port and type ctrl-T. When done, regenerate the layout again. Here is what my system looks like now.<\/p>\n<p>Now click the Validate Design button or type F6 to validate the design. There should be no errors or warnings.<\/p>\n<h2>Create the HDL wrapper<\/h2>\n<p><a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig12.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-503 alignright\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig12-300x170.png\" alt=\"tut14fig12\" width=\"300\" height=\"170\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig12-300x170.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/02\/tut14fig12.png 436w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Next we need to generate the Verilog code for the system. Do this by right-clicking on the <strong>stopwatch_system<\/strong> and selecting <em>Generate HDL Wrapper<\/em>. Make sure that the checkbox letting Vivado manage the update is checked and then click <strong><em>OK<\/em><\/strong>. This generates the Verilog code for the whole design.<\/p>\n<h1>Adding Constraints<\/h1>\n<p>Next go to the <em>Project Manager<\/em> window and add a constraint file. You can use the constraint file from <a title=\"Tutorial 12 \u2013 Rotary Encoder\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial12\/\">tutorial 12<\/a>. You may want to change the name. I used <strong>stopwatch.xdc<\/strong>.<\/p>\n<p>You should now be able to synthesize the design and generate a bitstream. Go ahead and program the device. Right now the FPGA doesn&#8217;t do anything. For that we need to add some ARM software which we will cover in the <a title=\"Tutorial 15 \u2013 A Software Stopwatch\" href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial15\/\">next tutorial<\/a>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will use the stopwatch IP block that we build in tutorial 12 to build an FPGA which includes the ARM processor. Getting Started Open the stopwatch_controller project you built in tutorial 13. If you have just &hellip; <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial14\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":226,"menu_order":14,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-491","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/comments?post=491"}],"version-history":[{"count":8,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/491\/revisions"}],"predecessor-version":[{"id":1024,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/491\/revisions\/1024"}],"up":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/226"}],"wp:attachment":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/media?parent=491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}