<!--
Author: Konstantin Lübeck (University of Tübingen, Chair for Embedded Systems)
-->
# Creating a Custom AXI4 Master in Vivado (Zedboard)
This tutorial shows you how to generate a custom AXI4 IP with burst functionality in Vivado and how to connect it to the HP Port of the Zynq PS on the Zedboard and simulate it with Vivado `xsim`.
## Requirements
- Vivado 2016.2
- Zedboard
## Creating a New Vivado Project
1. Start Vivado.
2. Choose "Create New Project" in the Vivado welcome menu.
![create new project](./images/new_vivado_project01.png "create new project")
3. Click _Next >_.
![click next](./images/new_vivado_project02.png "click next")
4. Choose a name for your project and a location. The project name in this tutorial is `axi4_master_burst_example`.
![choose project name and location](./images/new_vivado_project03.png "choose project name and location")
5. Choose _RTL Project_.
![choose RTL project](./images/new_vivado_project04.png "choose rtl project")
6. Don't add any HDL sources or netlists.
![dont add any hdl sources or netlists](./images/new_vivado_project05.png "dont add any hdl sources or netlists")
7. Don't add any existing IP components.
![dont add any existing ip components](./images/new_vivado_project06.png "dont add any existing ip components")
8. Don't add any constraints.
![dont add any constraints](./images/new_vivado_project07.png "dont add any constraints")
9. Choose _Boards_ and select _Zedboard Zynq Evaluation and Development Kit_.
![choose boards and select zedboard](./images/new_vivado_project08.png "choose boards and select zedboard")
10. Click "Finish" to create the Vivado project.
![click finish to create the vivado project](./images/new_vivado_project09.png "click finish to create the vivado project")
## Creating a Custom AXI IP
1. Open: _Menu -> Tools -> Create and Package IP_.
![menu - tools - create and package ip](./images/create_and_package_ip01.png "menu - tools - create and package ip")
2. Click _Next >_.
![click next](./images/create_and_package_ip02.png "click next")
3. Choose _Create a new AXI4 peripheral_.
![choose create a new axi4 peripheral](./images/create_and_package_ip03.png "choose create a new axi4 peripheral")
4. Choose a name, description and location for the new AXI4 peripheral. The name in this tutorial is `axi4_master_burst` and the location is `[...]/ip_repo`.
![choose name and description](./images/create_and_package_ip04.png "choose name and description")
5. Keep the AXI4-Lite Slave interface.
![keep the axi4-lite slave interface](./images/create_and_package_ip05.png "keep the axi4-lite slave interface")
6. Click on the green plus sign to add another interface.
![click on green plus](./images/create_and_package_ip06.png "click on green plus")
7. The added interface should be an AXI4-Full master interface.
![axi4-full interface](./images/create_and_package_ip07.png "axi4-full interface")
8. Choose _Edit IP_ and click on _Finish_.
![edit ip](./images/create_and_package_ip08.png "edit ip")
## Edit Custom AXI4 IP
After the successful creation of the new IP a new Vivado project was opened. In this project you can find the Vivado generated Verilog code for the AXI4-Lite slave, AXI4-Full master, and a top module (wrapper) which contains those two components.
![edit ip source tree](./images/edit_ip01.png "edit ip source tree")
* `axi4_master_burst_v1_0` contains the top module.
* `axi4_master_burst_v1_0_S00_AXI_inst` contains the Verilog code for the AXI4-Lite slave.
* `axi4_master_burst_v1_0_M00_AXI_inst` contains the Verilog code for the AXI4-Full master.
The AXI4-Lite slave will be used to start and monitor a burst write/read of the AXI4-Full master from the Zynq PS. In order to do that you have to customize the AXI4-Lite slave a little.
Double-click on `axi4_master_burst_v1_0_S00_AXI_inst` and navigate to the ports definition and add your own ports under `// Users to add ports here`.
```verilog
// Users to add ports here
output wire init_txn,
input wire txn_done,
input wire txn_error,
// User ports ends
```
The output wire `init_txn` will later be connected to the AXI4-Full master to start a burst write/read. The input wires `txn_done` and `txn_error` will also be connected to the master and indicate if a write/read transaction was completed and if errors occured during a write/read transaction.
The output wire `init_txn` will be connected to the `slv_reg0` of the AXI4-Lite slave. Navigate to `// Add user logic here` and add the following:
```verilog
// Add user logic here
assign init_txn = slv_reg0[0:0];
// User logic ends
```
The input wires `txn_done` and `txn_error` are directly connected to the `slv_reg1` and `slv_reg2` registers of the AXI4-Lite slave. Navigate to `// Address decoding for reading registers` and change the code like this:
```verilog
// Implement memory mapped register select and read logic generation
// Slave register read enable is asserted when valid address is available
// and the slave is ready to accept the read address.
assign slv_reg_rden = axi_arready & S_AXI_ARVALID & ~axi_rvalid;
always @(*)
begin
// Address decoding for reading registers
case ( axi_araddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] )
2'h0 : reg_data_out <= slv_reg0;
2'h1 : reg_data_out <= {{31{1'b0}},txn_done};
2'h2 : reg_data_out <= {{31{1'b0}},txn_error};
2'h3 : reg_data_out <= slv_reg3;
default : reg_data_out <= 0;
endcase
end
```
With those changes the Zynq PS is able to start a write/read transaction by setting the LSB of `slv_reg0` to `1` and is also able to read from the LSB of `slv_reg1` and `slv_reg2` to see if the write/read transaction was completed successfully.
The newly added ports of the AXI4-Lite slave also have to be added to the module instantiation in the top module `axi4_master_burst_v1_0`. Double click on `axi4_master_burst_v1_0` and navigate to `// Instantiation of Axi Bus Interface S00_AXI` and add the new ports to the port map:
```verilog
// Instantiation of Axi Bus Interface S00_AXI
axi4_master_burst_v1_0_S00_AXI # (
.C_S_AXI_DATA_WIDTH(C_S00_AXI_DATA_WIDTH),
.C_S_AXI_ADDR_WIDTH(C_S00_AXI_ADDR_WIDTH)
) axi4_master_burst_v1_0_S00_AXI_inst (
.init_txn(m00_axi_init_axi_txn),
.txn_done(m00_axi_txn_done),
.txn_error(m00_axi_error),
```
Currently the wires `m00_*` are output or input ports of the top module. Those have to be removed from the interface and added as wire in the top module. To do that navigate in `axi4_master_burst_v1_0` to `// Ports of Axi Master Bus Interface M00_AXI` and **remove** the following lines:
```verilog
input wire m00_axi_init_axi_txn,
output wire m00_axi_txn_done,
output wire m00_axi_error,
```
Under the interface definition of the top module `axi4_master_burst_v1_0` add the following lines:
```verilog
wire m00_axi_init_axi_txn;
wire m00_axi_txn_done;
wire m00_axi_error;
```
Those `m00_*` wires are connecting the the AXI4-Full master and the AXI4-Lite slave in the top module.
When you look at the verilog code of the AXI4-Full master in `axi4_master_burst_v1_0_M00_AXI_inst` you will see a lot of finite state machines which handle the AXI4 transactions. One of those finite state machine is responsible for the overall functionality of the AXI4-Full master. You can find this state machine when you navigate to `//implement master command interface state machine`. This state machine consists of four states:
* `IDLE`
* `INIT_WRITE`
* `INIT_READ`
* `INIT_COMPARE`
Initially the AXI4-Full master is in `IDLE` until the `init_txn_pulse` is set to high (this will be done by the AXI4-Lite slave `slv_reg0`).
Then the AXI4-Full master will start to write `C_NO_BURSTS_REQ` bursts consisting of `C_M_AXI_BURST_LEN` data values to memory address `C_M_TARGET_SLAVE_BASE_ADDR`.
After the burst writes are completed the AXI4-Full master starts burst
没有合适的资源?快使用搜索试试~ 我知道了~
快速示例如何使用AXI4-Full接口(突发)为Zynq(ZedBoard)生成自定义AXI4IP_SystemVeri.zip
共67个文件
png:63个
jpg:2个
sv:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 48 浏览量
2023-04-29
22:27:53
上传
评论
收藏 1.37MB ZIP 举报
温馨提示
快速示例如何使用AXI4-Full接口(突发)为Zynq(ZedBoard)生成自定义AXI4IP_SystemVeri.zip
资源推荐
资源详情
资源评论
收起资源包目录
快速示例如何使用AXI4-Full接口(突发)为Zynq(ZedBoard)生成自定义AXI4IP_SystemVeri.zip (67个子文件)
zedboard_axi4_master_burst_example-master
images
edit_ip09.png 52KB
new_vivado_project03.png 13KB
edit_ip05.png 4KB
software02.png 9KB
software06.png 44KB
edit_ip04.png 5KB
new_vivado_project05.png 15KB
block_diagram15.png 18KB
new_vivado_project04.png 17KB
block_diagram14.png 71KB
software04.png 17KB
software01.png 3KB
block_diagram05.png 4KB
new_vivado_project09.png 23KB
new_vivado_project01.png 26KB
create_and_package_ip06.png 3KB
edit_ip06.png 2KB
block_diagram02.png 11KB
block_diagram13.png 8KB
block_diagram09.png 53KB
block_diagram18.png 16KB
block_diagram08.png 3KB
create_and_package_ip08.png 27KB
software09.png 47KB
block_diagram07.png 25KB
block_diagram04.png 6KB
zedboard01.jpg 104KB
block_diagram17.png 16KB
synthesis_implementation04.png 12KB
edit_ip01.png 17KB
software11.png 24KB
create_and_package_ip02.png 21KB
new_vivado_project08.png 41KB
new_vivado_project02.png 19KB
new_vivado_project07.png 12KB
block_diagram11.png 4KB
software10.png 839B
block_diagram19.png 10KB
block_diagram12.png 27KB
block_diagram16.png 33KB
xsim01.png 104KB
block_diagram10.png 5KB
create_and_package_ip01.png 18KB
block_diagram01.png 9KB
block_diagram06.png 24KB
synthesis_implementation03.png 11KB
synthesis_implementation01.png 4KB
edit_ip07.png 9KB
block_diagram03.png 8KB
create_and_package_ip04.png 16KB
synthesis_implementation02.png 12KB
edit_ip02.png 3KB
software07.png 17KB
software05.png 63KB
software08.png 17KB
zedboard02.jpg 117KB
edit_ip03.png 6KB
software03.png 2KB
edit_ip08.png 7KB
create_and_package_ip05.png 24KB
create_and_package_ip07.png 25KB
new_vivado_project06.png 13KB
xsim02.png 22KB
block_diagram20.png 19KB
create_and_package_ip03.png 17KB
README.md 22KB
hdl
axi4_master_burst_v1_0_tb.sv 14KB
共 67 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功