In this blog, the blinkWithATwist code is modified so that the blink rate can be controlled via the processor. Pull down the code, click on startScript.bat within the blinkWithATwist folder to create the project, and then open it up in Vivado. Note that the end result of this blog [blinkWithATwistAXI] is also in the repo, but if you want to work though the blog you should use blinkWithATwist as your starting point. You should see something like the block diagram below. This is the exact same project that was covered in the Blink With a Twist blog post. Once you have opened up the block diagram as shown below, click on the Tools menu and then Create and Package New IP. Instead of packaging a specific directory as we did in a previous post, we will be creating a new AXI peripheral. Select the bottom radio button and click Next. In this step you need to enter the name and description of your new IP block. Make sure to use something meaningful instead of things like MyIP. Note that you must specify the IP folder that you are using via your scripting utopia framework. If you do not modify this path to point to ip, it will point to ip_repo by default. For this processor link we will be using the simplest AXI interface which is AXI Lite. Keep all of the default settings and click Next. Click on Next to finish up the IP creation. In the block diagram, right-click to open up the Add IP option and select blink_axi_v1.0 as shown below. Once your IP has been added to the block diagram you can click on Run Connection Automation to automatically setup the AXI port signals. Click OK. Technically we have created a processor/FPGA link however the only ins and outs of the AXI block are the AXI interface signals. In order to control the tunable blink we want to replace the constant for max_count with a value that comes from the processor. The only way that this can be done is by modifying the newly created blink_axi block. This can be done by right-clicking the block and selecting Edit in IP Packager. A temporary IP project will be created and the name and location don't really matter here. Just click on OK. You will need to modify the two files that makeup the blink_axi IP block. The two modified file can be found below. I recommend downloading these two files and just copying their entire contents into the existing files. Note that you will have to make sure that you have named your IP exactly as I have in the tutorial. Another option would be to do a 'diff' on these two files against the existing IP files and manually copy over the added lines of code.
Once the two files have been modified, you must ensure that you select the various packaging steps on the left and click on the Merge changes text in blue. As you can see below my max_count signal does not appear in the ports list until the Merge changes text is clicked. Remember to always click on Run Synthesis before you formally package the IP. This will save you time in the long run as you don't want to find that you forgot a semicolon in your blink module at the end of a 1 hour full project compilation process. Clicking on the Run Synthesis text might ask you to save the project and just click Save. When synthesis has completed successfully just click on Cancel. Finally package the IP and close the project. The next couple of steps are quite vexing as I believe there is a bug in Vivado here. Notice how the max_count signal is not coming out of our newly edited IP block. This is supposed to be remedied by updating the IP which is done by licking on Report IP Status and then on Upgrade Selected as shown below. Once the IP is upgraded you can chose to either generate or skip the output projects. I typically skip this part. The strange Vivado bug sill manifests itself even when I choose to generate the output products. Even after updating the blink_axi IP there is still no max_count coming out of it. You can try to click on Rerun in order to update the IP again but I believe there is something wrong going on here. By taking a step back we can find a nice solution to this apparent bug. The whole goal of this blog was to generate the AXI link IP and we have successfully done that. Why not save off that IP folder and start fresh with the blinkWithATwist project. All you need to do is pull down a fresh blinkWithATwist directory and add the blink_axi_1.0 IP into its IP folder. The two files that we edited before should be located within the blink_axi_1.0 folder. When you run the startScript.bat file in the blinkWithATwist folder and open up Vivado you should see a block diagram just like you did at the start of this tutorial. The only difference is that now when you right-click you will see your newly created blink_axi_v1.0 IP come up. Select that IP block in order to add it to your design. Notice how the max_count is now coming out of the IP block. We did not change any code in the IP block but simply blew away the old project and started fresh. Click on the Run Connection Automation in order to link up the AXI interface signals as was done above. Next, delete the constant block that is feeding the blink_tunable block and route the max_count signal from the blink_axi block to the blink_tunable block. This effectively links up the processor to the FPGA tunable blink routine. The last step is to click on the Address Editor and to expand the tabs in order to see the hex address of 0x43c0000 which is the base address of the AXI link that was created. We will demonstrate how to use that base address to toggle the blnk frequency in a future post. Once you have connected up your block diagram, make sure to save everything, exit out of Vivado, blow away the bloatware files, update the scripting utopia compile flag to 1, and then click on startScript.bat. This will generate the system.bit as well as system.bit.bin files for you. Congratulations you are now ready to control blink from the processor. If you want just grab all the source files for this blog post, just go here and clone or download the repo. The completed files are located in the blinkWithATwistAXI folder.
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |