Vivado: Creating Custom AXI IP and Integrating with Zynq
Xilinx Vivado Design Suite is a comprehensive FPGA/SoC design environment covering HDL authoring, simulation, synthesis, implementation, all the way to on-board hardware debugging. In this article, we walk through an end-to-end tutorial on creating a custom AXI IP core from scratch and integrating it with Zynq.
1. Creating a Custom AXI IP
Launch Vivado and create a new project. In this example, we create a project named project_1.
Create an IP by clicking Tools -> Create and Package New IP.

Select Create a new AXI4 peripheral.

Name the IP as desired. In this example, name it myip.

In the Interfaces configuration, you can add AXI interfaces and configure the number of registers. For this simple example, we keep the default settings (AXI4-Lite).

If you select Verify Peripheral IP using AXI4 VIP, the system will automatically generate a simulation testbench.

Once generated, you can run the simulation as shown below.

Additionally, myip_v1.0 will be added to the IP Catalog.

Note: To change which IP to simulate, right-click the target module under Simulation Sources in the Sources window and select Set as Top. Then right-click sim_1 in Sources and select Run Simulation -> Run Behavioral Simulation.


2. Modifying the Generated IP
The automatically generated HDL source files for the IP are stored in ./ip_repo/myip_1.0/hdl.

Example: Adding an output port myip_out by declaring the output port in the myip_v1_0_S00_AXI.v module as shown below.

Note: The generated HDL language depends on your Vivado project settings. You can configure this at Settings -> General -> Target language.

Next, also add the output port myip_out in the top-level module myip_v1_0.v.

In the IP Catalog pane, right-click myip_v1.0 and select Edit in IP Packager.

Click OK with the default settings.

A separate Vivado window will open automatically. Click Ports and Interfaces, then click Merge changes from Ports and Interfaces Wizard.

Click Review and Package, then click Re-Package IP to update the IP. Close the IP Packager Vivado window and return to the main project.

Double-click myip_1_0_bfm_1_i in the Block Design sources.

Click Show IP Status and upgrade myip_v1_0_bfm_1.

The myip_out port will now appear on the block. Right-click myip_out and select Make External.

Right-click sim_1 in Sources and select Run Simulation -> Run Behavioral Simulation to restart simulation.

The myip_out port is now added to myip_v1_0_bfm, which acts as the DUT.

3. Modifying the Testbench
The testbench for simulation is located at project_1\project_1.srcs\sim_1\imports\bfm_design\myip_v1_0_tb.sv. By adding the following Read and Write tasks to this file, you can customize the simulation sequence.
// Write value 0x12345678 to address 0x0 (Register 0 of myip)
mst_agent_0.AXI4LITE_WRITE_BURST(32'h00000000, 0, 32'h12345678, mtestBresp );
// Read back from address 0x0 (Read data is stored in mtestRDataL)
mst_agent_0.AXI4LITE_READ_BURST(32'h00000000, 0, mtestRDataL, mtestRresp );
Arguments in order: address, protection type (prot), data, response (mtestBresp / mtestRresp).


4. Connecting with Zynq
Click IP INTEGRATOR -> Create Block Design.

Name the Block Design. In this example, name it design_1.

Click ADD IP (+) and add the ZYNQ7 Processing System IP.

Click ADD IP (+) and add myip.

Connect the blocks together (Clicking Run Connection Automation will automatically wire up the interfaces, but always verify the connections afterwards).


Right-click myip_out in the myip block and click Make External. The port will be routed outside the block design automatically.

Assign the base address for myip in the Address Editor tab.

Right-click design_1 under Design Sources in the Sources window and select Create HDL Wrapper to generate the wrapper for the Block Design automatically.

Create a top-level FPGA file and instantiate the Block Design wrapper. In this example, create a top-level file named prj_top.v.

Add prj_top.v to Vivado, right-click Sources -> Design Sources -> prj_top, and select Set as Top.

5. Simulating IP with Zynq VIP
Create a testbench named zynq_tb.v with the following code (adjust the TODO sections according to your design; refer to the Zynq-7000 VIP documentation (DS940) or Vivado example designs for the PS VIP reset sequence):
`timescale 1ns / 1ps
module tb;
reg [31:0] read_data;
reg [1:0] resp;
// TODO: Instantiate prj_top (Section 5) as prj_top_u
// and drive the PS clock/reset according to DS940 example
initial begin
// TODO: Complete the PS VIP reset sequence before issuing commands
// Write from Zynq (PS) -> myip
tb.prj_top_u.design_1_wrapper_u.design_1_i.processing_system7_0.inst.write_data(32'h43C0_0000, 4, 32'h12345678, resp);
// Read from myip -> Zynq (PS)
tb.prj_top_u.design_1_wrapper_u.design_1_i.processing_system7_0.inst.read_data(32'h43C0_0000, 4, read_data, resp);
$display("read_data = %h, resp = %b", read_data, resp);
$finish;
end
endmodule
Using Zynq VIP:
For Write transactions (Zynq PS → IP):
xxx.inst.write_data(32'h43C0_0000, 4, 32'h12345678, resp);
For Read transactions (IP → Zynq PS):
xxx.inst.read_data(32'h43C0_0000, 4, read_data, resp);
| Argument | Meaning |
|---|---|
| 1 | Target memory address (must match Address Editor) |
| 2 | Data size in bytes (4 = 32 bits) |
| 3 | Data to write / Variable receiving read data |
| 4 | Response status (resp) |
(The hierarchy xxx depends on your design structure. In this design it is: tb.prj_top_u.design_1_wrapper_u.design_1_i.processing_system7_0)


6. On-Board Hardware Debugging
This section uses Vitis IDE to write a C program running on the PS (ARM) processor to access the registers of myip on the physical board. Workflow overview:
| Step | Environment | Action |
|---|---|---|
| 1 | Vivado | Run Generate Bitstream, then File -> Export -> Export Hardware and select Include bitstream (generates .xsa file) |
| 2 | Vitis | Set Workspace and create a Platform Project from the .xsa file |
| 3 | Vitis | Create an Application Project using the Empty Application (C) template |
| 4 | Vitis | Add C source code, build the application, and run on the board via JTAG |
When you created the custom AXI IP in Section 1, Vivado automatically generated sample driver source files as shown below.

Start with Export Hardware in Vivado.

Select Include bitstream.

Then open Vitis IDE.

Select the Workspace directory.

Click New -> Application Project.

Click Next with default settings.

Click Create a new platform from hardware (XSA), browse and select the .xsa file exported earlier, then click Next.

Enter the project application name, then click Next.

Click Next with default settings.

Since we are performing basic register operations, select Empty Application (C).






Example Makefile modification to automatically gather all .c, .cpp, and .S files in the directory using wildcards (the three lines starting with # are the original commented-out lines):
#INCLUDEFILES=*.h
#LIBSOURCES=*.c
#OUTS = *.o
INCLUDEFILES=$(wildcard *.h)
LIBSOURCES=$(wildcard *.c *.cpp)
OUTS = $(addsuffix .o, $(basename $(wildcard *.c)))
OBJECTS = $(addsuffix .o, $(basename $(wildcard *.c *.cpp)))
ASSEMBLY_OBJECTS = $(addsuffix .o, $(basename $(wildcard *.S)))
Build the Project.

Debug on real hardware via Run As -> Run Configurations.


6.1 Sample C Code Accessing myip Registers
A simple main.c example for Empty Application (C) that writes to and reads back from the myip register (the base address must match the one specified in the Address Editor in Section 5; here assumed as 0x43C00000):
#include "xil_io.h"
#include "xil_printf.h"
#define MYIP_BASEADDR 0x43C00000 /* Must match Address Editor */
int main(void)
{
u32 rd;
Xil_Out32(MYIP_BASEADDR + 0x00, 0x12345678); /* Write register 0 */
rd = Xil_In32(MYIP_BASEADDR + 0x00); /* Read back */
xil_printf("reg0 = 0x%08x\r\n", rd);
return 0;
}
- The sample driver file generated by Vivado (
myip.h) provides helper macros for writing/reading registers that can be used instead ofXil_Out32/Xil_In32(macro names depend on the IP name).
- Run the program by right-clicking the project -> Run As -> Launch on Hardware (System Debugger) and open a serial terminal to view the
xil_printfoutput.
7. Verifying IP with Chipscope (ILA)
Chipscope was the tool name in the ISE era. In Vivado, this built-in logic analyzer core and viewer is named ILA (Integrated Logic Analyzer).
Run SYNTHESIS once.

Then click SYNTHESIS -> Open Synthesized Design -> Set Up Debug.

Click Find Nets to Add, search for the internal signals you wish to monitor, and register them.


Right-click the Clock Domain column for each signal and assign the appropriate sampling clock.


Next, click Run Implementation followed by Generate Bitstream.
In Hardware Manager, click Open Target and select Auto Connect.

Click Program device to download the FPGA bitstream into the PL side of Zynq.


Configure the Trigger setup just as you would with a hardware logic analyzer.

Click Run. When the trigger condition occurs, the waveform will be captured and displayed as shown below.

8. Advanced Trigger
Basic trigger setup evaluates signal values against a single condition. However, complex triggering sequences—such as "trigger when a signal goes HIGH and then transitions LOW in sequence"—require an Advanced Trigger, which expresses conditions as a Trigger State Machine (TSM) program executed by the ILA in hardware.
How to Use:
1. The ILA core must be configured to support Advanced Triggering during core generation/insertion (in Set Up Debug or the ILA IP customization GUI).
2. In Hardware Manager, set the Trigger mode in the ILA Properties pane to ADVANCED_ONLY (or ADVANCED_OR_TRIG_IN).
3. The Basic Trigger Setup tab is replaced by the Trigger State Machine editor. Click Create new trigger state machine (generates a .tsm file).
4. Write your TSM script and click Run Trigger (the TSM is recompiled whenever Run is clicked, or you can click the Compile button to check syntax without arming the ILA).
Example: Trigger when myip_out rises to 1 and subsequently falls back to 0 (use probe names as shown in the ILA dashboard):
state s0:
if (myip_out == 1'b1) then
goto s1;
else
goto s0;
endif
state s1:
if (myip_out == 1'b0) then
trigger;
else
goto s1;
endif
For complete details on the TSM language syntax (counters, flags, state transitions), refer to UG908: Vivado Design Suite User Guide - Programming and Debugging (Trigger State Machine Language Description chapter).
Additional Reference (Japanese): 【FPGA Verification Knowledge】Making Vivado™ Logic Analyzer More Convenient (Using Advanced Trigger) - Preparation & Overview:
https://www.paltek.co.jp/techblog/techinfo/231127_01
9. Jupyter Environment for On-Board Custom IP Debugging
Debugging custom IP on actual hardware typically requires U-Boot or custom bare-metal/Linux debug firmware. However, preparing custom debug firmware involves many prerequisites. Here we introduce a convenient, interactive debugging approach using Jupyter Notebook.
Jupyter Notebook is a web-based interactive development environment (traditionally used on PC). For Zynq devices, the open-source PYNQ framework enables developers to interact with and control FPGA logic using Python. The Zynq processor (PS) runs embedded Linux hosting the Jupyter server, allowing you to configure and interact with the FPGA (PL) through Python scripts in your browser.

Boards supported by the PYNQ framework are listed at http://www.pynq.io/board.html
Debugging Steps:
1. Power on the target board and wait for Linux to finish booting. Run ifconfig in serial terminal to find the Zynq board's IP address (e.g. 192.168.1.55).

2. Open a web browser on your PC and enter the IP address to connect to Zynq. Enter the login password (default is xilinx).

3. Switch back to Vivado and click Program device to configure the FPGA bitstream onto the Zynq PL.

4. In the Jupyter dashboard, click New → Python 3.

5. Enter the script below to read and write FPGA (PL) registers interactively:

from pynq import MMIO
MYIP_BASE = 0x43C00000 # Must match Address Editor
mmio = MMIO(MYIP_BASE, 0x1000) # (base address, memory span)
mmio.write(0x00, 0x12345678) # Write to register 0
print(hex(mmio.read(0x00))) # Read back register 0
pynq.MMIO(base_addr, length) defines the memory mapped address space and byte range for access.
mmio.write(offset, data) performs a 32-bit register write.
mmio.read(offset) performs a 32-bit register read.
Note: You can simultaneously observe signal waveforms with Chipscope/ILA in Vivado to verify register access transactions in real time.

10. Additional Topic: Exposing the AXI Bus Outside the Block Design
To add an AXI master bus port, increase the number of Master Interfaces on the AXI Interconnect (e.g. increase from 1 to 2).

In this example, we want to bring out an AXI-Lite bus, so we add an AXI Protocol Converter to convert full AXI → AXI-Lite.

Double-click the AXI Protocol Converter and configure the Address Width (set to 12 bits in this example).

Right-click M_AXI on the AXI Protocol Converter and select Make External.

The M_AXI_0 bus interface is now exposed outside the Block Design.

Assign the address space for the external AXI bus (M_AXI_0) in the Address Editor tab.

To route the CLK and reset signals outside the Block Design along with the AXI bus, right-click on the Block Design canvas and choose Create Port.

Configure the CLK and reset port properties as shown below.


When clicking Validate Design, an error may occur as shown below (indicating that M_AXI_0 has no associated clock).

To resolve this error, select M_CLK_0_CLK, go to the Properties -> CONFIG section, and enter M_AXI_0 into ASSOCIATED_BUSIF. Then run Validate Design again—the warning/error will disappear.

Right-click design_1_i and select Create HDL Wrapper.

The M_AXI_0 bus signals are now brought out to the top level as shown.

Connect the bus to your custom AXI IP at the top level of the project.

Add read and write operations to the memory locations mapped for M_AXI_0 in the simulation testbench.

Running behavioral simulation allows you to verify your custom AXI IP module functionality.
