This example shows how to use the HDL Workflow Advisor to generate a custom HDL IP core which blinks LEDs on FPGA board.
Using the IP Core Generation workflow in the HDL Workflow Advisor enables you to automatically generate a sharable and reusable IP core module from a Simulink model. The generated IP core is designed to be connected to an embedded processor on an FPGA device. HDL Coder™ generates HDL code from the Simulink blocks, and also generates HDL code for the AXI interface logic connecting the IP core to the embedded processor. HDL Coder™ packages all the generated files into an IP core folder. You can then integrate the generated IP core with a larger FPGA embedded design in the Xilinx EDK environment.
In this example, the DUT subsystem, led_counter, models a simple counter in order to blink the LEDs on an FPGA board. Two input ports, Blink_frequency and Blink_direction, are control ports which determine the LED blinking frequency and direction. You can use the Slider Gain or Manual Switch block to adjust the input values of these two ports. The embedded processor controls the generated IP core by writing to the generated AXI interface accessible registers. The output port, LED, is intended to connect to the actual LEDs. The output port, Read_Back, can be used to read data back to the processor.
To launch the IP core generation workflow:
Start the HDL Workflow Advisor from the hdlcoder_led_blinking/led_counter subsystem by right-clicking the led_counter subsystem, and choose HDL Code > HDL Workflow Advisor.
In the Set Target > Set Target Device and Synthesis Tool task, for Target workflow, select IP Core Generation.
Map each port in your DUT to one of the IP core target interfaces. In this example, input ports Blink_frequency and Blink_direction are mapped to the AXI4-Lite interface, so HDL Coder™ generates AXI interface accessible registers for them. The LED output port is mapped to an External Port, and can be connected to the actual LED device in the Xilinx EDK environment.
Click Run This Task to run the Set Target Device and Synthesis Tool task.
In the Set Target > Set Target Interface task, choose AXI4-Lite for Blink_frequency and Blink_direction.
Choose External Port for LED.
To generate the IP core, right-click the Generate RTL Code and IP Core task and select Run to Selected Task.
After you generate the custom IP core, the IP core files are in the ipcore folder within your project folder. An HTML custom IP core report is generated together with the custom IP core. The report describes the behavior and contents of the generated custom IP core.
You can then integrate the generated IP core with a larger FPGA embedded design in the Xilinx EDK environment. The following steps are an example showing how to add the IP Core into the EDK environment:
Copy the IP core folder, hdl_prj/ipcore/hdlcoder_led_blinking_led_counter_pcore_v1_00_a, into the "pcores" folder in your Xilinx Platform Studio (XPS) project. This step adds the IP core into the XPS project user library.
In the XPS project, find the IP core in the user library and add the IP core to the design.
Connect the S_AXI port of the IP core to the embedded processor's AXI master port.
Connect the clock and reset ports of the IP core to the global clock and reset signals.
Assign a base address for the IP core.
Connect the external ports and add FPGA pin assignment constraints for the LED pins.
Generate the FPGA bitstream and download the bitstream to your target device.
If you are targeting Xilinx Zynq ZC702, or ZedBoard hardware, you can select the board you are using in the Target platform option in the Set Target > Set Target Device and Synthesis Tool task. You can then use Embedded System Integration tasks in HDL Workflow Advisor to help you integrate the generated IP core into Xilinx EDK environment.
You can then observe the LED blinking on your FPGA board and use the embedded processor to control the blinking frequency and direction.