Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| learn:programmable-logic:tutorials:zedboard-creating-custom-ip-cores:start [2016/07/25 23:52] – jon peyron | learn:programmable-logic:tutorials:zedboard-creating-custom-ip-cores:start [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ---- | ---- | ||
| =====Prerequisites===== | =====Prerequisites===== | ||
| - | - Completed the Zedboard [[https:// | + | - Completed the Zedboard [[/ |
| - Have SDK installed | - Have SDK installed | ||
| Line 212: | Line 212: | ||
| ); | ); | ||
| </ | </ | ||
| + | ====6. Packaging the IP core==== | ||
| + | Now that we have written the core, it is time to package up the HDL to create a complete IP package. | ||
| + | >6.1) Now click on **Package IP** in the Flow Navigator and you should see the Package IP tab. Select **Compatibility** and make sure " | ||
| + | > | ||
| + | > | ||
| + | |||
| + | |||
| + | >6.2) Select **Customization Parameters** and select the line for **Merge Changes from Customization Parameters Wizard**. This will add the PWM_COUNTER_MAX parameter from the top file under the hidden parameters folder. | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >6.3) Select **Customization GUI**. This is were we get to change our graphical interface. One problem, there is not a window for our parameter. Right-click **Pwm Counter Max** and select **Edit Parameter...**. Check the box next to **Visible in Customization GUI**. Check the **Specify Range** box. Select **Range of Integers** from the **Type** drop-down menu. Since we have a max value of (2^16)-1 = 65535 and a min value of 0, then Click **Ok**. | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >6.4) Drag the **Pwm Counter Max** into **Page 0** to get it in the main page. | ||
| + | > | ||
| + | > | ||
| + | |||
| + | |||
| + | >6.5) Now the core should be complete so select **Review and Package** and click the **Re-package IP** button. | ||
| + | > | ||
| + | > | ||
| + | |||
| + | |||
| + | >6.6) A popup will ask if you want to close the project, Select **Yes**. | ||
| + | > | ||
| + | > | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== 7. Create Zynq design ==== | ||
| + | >7.1) In the project manager page of the original window, click **Create Block Design**. This adds a block design to the project. | ||
| + | |||
| + | >7.2) Use the {{: | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.3) Use the {{: | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.4) **Run Block Automation**. | ||
| + | > | ||
| + | > | ||
| + | > | ||
| + | >7.5) The connection automation tool will add the required logic blocks for the demo. Select **Run Connection Automation** highlighted in blue. | ||
| + | > | ||
| + | > | ||
| + | > | ||
| + | >7.6) Your design should look like this: | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.7) Double-click our **PWM core** to customize the parameter that we made earlier. Set the PWM Counter Max to 1024. and click **OK**. | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.8) Right-click each of the PWM signals and select **Create Port...** | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.9) Click the button for **Validate Design**. | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.10) Click **Project Manager**, right-click the " | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.11) Double-click **design_1_wrapper.v** to open it in the editor. Take note of the name for the PWM signals. Add the " | ||
| + | >< | ||
| + | ## ---------------------------------------------------------------------------- | ||
| + | ## User LEDs - Bank 33 | ||
| + | ## ---------------------------------------------------------------------------- | ||
| + | set_property PACKAGE_PIN T22 [get_ports {LD0}]; | ||
| + | set_property PACKAGE_PIN T21 [get_ports {LD1}]; | ||
| + | set_property PACKAGE_PIN U22 [get_ports {LD2}]; | ||
| + | set_property PACKAGE_PIN U21 [get_ports {LD3}]; | ||
| + | </ | ||
| + | >To this: | ||
| + | >< | ||
| + | ## ---------------------------------------------------------------------------- | ||
| + | ## User LEDs - Bank 33 | ||
| + | ## ---------------------------------------------------------------------------- | ||
| + | set_property PACKAGE_PIN T22 [get_ports {PWM0}]; | ||
| + | set_property PACKAGE_PIN T21 [get_ports {PWM1}]; | ||
| + | set_property PACKAGE_PIN U22 [get_ports {PWM2}]; | ||
| + | set_property PACKAGE_PIN U21 [get_ports {PWM3}]; | ||
| + | </ | ||
| + | >Then uncomment the lines of code for bank 33 in the xdc file and change this: | ||
| + | >< | ||
| + | # Un-comment one or more of the following IOSTANDARD constraints according to | ||
| + | # the bank pin assignments that are required within a design. | ||
| + | # ---------------------------------------------------------------------------- | ||
| + | |||
| + | # Note that the bank voltage for IO Bank 33 is fixed to 3.3V on ZedBoard. | ||
| + | # | ||
| + | </ | ||
| + | >To this: | ||
| + | >< | ||
| + | # Un-comment one or more of the following IOSTANDARD constraints according to | ||
| + | # the bank pin assignments that are required within a design. | ||
| + | # ---------------------------------------------------------------------------- | ||
| + | |||
| + | # Note that the bank voltage for IO Bank 33 is fixed to 3.3V on ZedBoard. | ||
| + | set_property IOSTANDARD LVCMOS33 [get_ports -of_objects [get_iobanks 33]]; | ||
| + | </ | ||
| + | |||
| + | >7.12) Click **Generate Bitstream**. Building the bit file can take some time. | ||
| + | |||
| + | >7.13) Export the hardware by going to **File-> | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.14) Check the box **Include bitstream** and click **Ok** | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >7.15) Select **File-> | ||
| + | > | ||
| + | > | ||
| + | |||
| + | ---- | ||
| + | ====8. Programming in SDK ==== | ||
| + | >8.1) Create a new application project | ||
| + | > | ||
| + | > | ||
| + | |||
| + | |||
| + | >8.2) Setup the window as shown below and then click **Next** | ||
| + | > | ||
| + | > | ||
| + | > | ||
| + | >8.3) Select **Empty Application** and then click **Finish**. | ||
| + | > | ||
| + | > | ||
| + | > | ||
| + | >8.4) Expand the **PWM_AXI_tutorial-> | ||
| + | > | ||
| + | > | ||
| + | |||
| + | >8.5) Add the lines: | ||
| + | >< | ||
| + | #include " | ||
| + | #include " | ||
| + | |||
| + | //#define MY_PWM XPAR_MY_PWM_CORE_0_S00_AXI_BASEADDR //Because of a bug in Vivado 2015.3 and 2015.4, this value is not correct. | ||
| + | #define MY_PWM 0x43C00000 //This value is found in the Address editor tab in Vivado (next to Diagram tab) | ||
| + | |||
| + | int main(){ | ||
| + | int num=0; | ||
| + | int i; | ||
| + | |||
| + | while(1){ | ||
| + | if(num == 1024) | ||
| + | num = 0; | ||
| + | else | ||
| + | | ||
| + | |||
| + | Xil_Out32(MY_PWM, | ||
| + | Xil_Out32((MY_PWM+4), | ||
| + | Xil_Out32((MY_PWM+8), | ||
| + | Xil_Out32((MY_PWM+12), | ||
| + | |||
| + | for(i=0; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | >8.6) To program the FPGA, Go to **Xilinx Tools-> | ||
| + | > | ||
| + | > | ||
| + | > | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ====9. Celebrate!==== | ||
| + | Now the 4 LEDs on the Zedboard will be pulsing. | ||
| + | {{tag> | ||

