Tutorial - Unit 4
Tutorial - Unit 4
empty
rst rst
S_AXI_WVALID S_AXI_RLAST
full
full
LUT
8-to-8
S_AXI_WREADY S_AXI_RVALID
S_AXI_RREADY
iempty
S_AXI_BID if ull
FSM
S_AXI_BRESP 2
oempty
S_AXI_BVALID orden
FSM
S_AXI_BREADY
axi_rvalid
S_AXI_ACLK
S_AXI_ARESETN mem_rden
axi_arv_arr_flag
mem_wren
CLKFX
1 Daniel Llamocca
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY
Tutorial: Embedded System Design for ZynqTM SoC RECRLAB@OU
IP GENERATION
▪ Create new project in Vivado: myaxifullpix
✓ Make sure the default language is VHDL, so that the system wrapper and the template files are created in VHDL
✓ At Default Part, go to Boards, and select the Zybo (or Zybo Z7-10) Board.
▪ From the menu bar, select Tools → Create and Package New IP.
✓ Create a new AXI4 Peripheral. Name: mypixfull. Location /ip_repo.
Peripheral Repositories tip: To add a previously-generated IP into a new project, go to: Project Settings → IP → IP
repositories and point to the associated repository folder.
✓ Add Interface: Full, 32 bits. Interface Mode: Slave. Memory Size: 64 bytes (16 32-bit words)
✓ Select Edit IP. A New project appears, open it and look for the <peripheral name>_S00_AXI.vhd file (in this case it will
be mypixfull_v1_0_S00_AXI.vhd). Modify the project:
Replace mypixfull_v1_0_s00_AXI.vhd with our edited file mypixfull_v1_0_S00_AXI.vhd. Same for the file
mypixfull_v1_0.vhd (this is not strictly necessary).
Add the extra files to the folder /hdl in /ip_repo/mypixfull_1.0 and add these source files (including the .txt file)
to the Vivado project. * Vivado 2019.1: by default, the files will be added to the folder /src.
✓ There is no need to add ports as our peripheral does not include external I/Os.
✓ Synthesize your circuit (just to double-check everything is ok): You should’ve simulated the code in a different project.
✓ Go to Package IP – mypixfull → File Groups (Merge changes). Then Review and Package → Re-Package IP.
▪ Your custom IP is now ready to be used as an AXI4-Full Peripheral.
▪ You will return to the original Vivado Project.
SDK
▪ See Tutorial Unit 2 for details on how to create and test a software application on SDK.
▪ Go to Xilinx Tools → Repositories, click on ‘New’ and then browse to the folder \ip_repo\mypixfull_1.0 and click ok.
▪ Create a new SDK application: pixtest. Then, copy the following file into the /src folder: test_pixi.c
▪ The software routine controls the AXI4-Full Pixel Processor peripheral by writing and reading from memory positions. Note
that the instructions to write on the AXI4-Full peripheral are different than in the case of AXI4-Lite.
▪ Testing strategy: write four 32-bit words and read four 32-bit words. Each output word corresponds to an input word.
✓ MYPIXFULL_mWriteMemory(Base Address, 32-bit word): Use this function (created when generating the AXI-4 Full
IP) to write a 32-bit word onto the AXI4-Full Peripheral.
✓ MYPIXFULL_mReadMemory(Base Address): Use this function (created when generating the AXI4-Full IP) to read a 32-
bit word from the AXI4-Full Peripheral.
✓ Base Address: In the FIFO case, any address in the 64-byte range (the one allowed for the AXI4-Full Pixel Processor
peripheral) works since we only write/read to/from the FIFOs.
✓ For example, with the given Pixel Processor Parameters (with parameter F = 1), we are supposed to get:
Input Output
0xF00DBEEF 0xF83ADDF7
0xBEBEDEAF 0xDDDDEED4
0xFADEDEAD 0xFDEEEED2
0xCAFEC0C0 0xE3FFDEDE
2 Daniel Llamocca
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY
Tutorial: Embedded System Design for ZynqTM SoC RECRLAB@OU
CONSIDERATIONS
▪ We will use the Pipelined Divider with N=16, M=16.
▪ AXI4-Full Peripheral: the VHDL files allow only for the case:
✓ FIFO: Custom FIFO-based interface that we will be using. All writes/reads to any 16-word memory position is treated
the same (writing/reading on the FIFO).
empty
rst rst
S_AXI_WVALID
full
full
S_AXI_RLAST
irden
S_AXI_WREADY S_AXI_RVALID
S_AXI_RREADY
iempty
S_AXI_BID FSM owren
of ull
S_AXI_BRESP 2 if ull
oempty
S_AXI_BVALID
orden
S_AXI_BREADY FSM
axi_rvalid
S_AXI_ACLK
S_AXI_ARESETN mem_rden
mem_wren axi_arv _arr_flag
CLKFX
IP GENERATION
▪ Create new project in Vivado: myaxifullpipdiv
✓ Make sure the default language is VHDL, so that the system wrapper and the template files are created in VHDL
✓ At Default Part, go to Boards, and select the Zybo (or Zybo Z7-10) Board.
▪ From the menu bar, select Tools → Create and Package New IP.
✓ Create a new AXI4 Peripheral. Name: mypipdivfull. Location /ip_repo.
Peripheral Repositories tip: To add a previously-generated IP into a new project, go to: Project Settings → IP → IP
repositories and point to the associated repository folder.
3 Daniel Llamocca
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY
Tutorial: Embedded System Design for ZynqTM SoC RECRLAB@OU
✓ Add Interface: Full, 32 bits. Interface Mode: Slave. Memory Size: 64 bytes (16 32-bit words)
✓ Select Edit IP. A New project appears, open it and look for the <peripheral name>_S00_AXI.vhd file (in this case it will
be mypipdivfull_v1_0_S00_AXI.vhd). Modify the project:
Replace mypipdivfull_v1_0_s00_AXI.vhd with our edited file mypipdivfull_v1_0_S00_AXI.vhd. Same for the file
mypipdivfull_v1_0.vhd (this is not strictly necessary).
Add the extra files to the folder /hdl in /ip_repo/mypipdivfull_1.0 and add these source files to the Vivado
project. * Vivado 2019.1: by default, the files will be added to the folder /src.
✓ There is no need to add ports as our peripheral does not include external I/Os.
✓ Synthesize your circuit (just to double-check everything is ok): You should’ve simulated the code in a different project.
✓ Go to Package IP – mypipdivfull → File Groups (Merge changes). Then Review and Package → Re-Package IP.
▪ Your custom IP is now ready to be used as an AXI4-Full Peripheral.
▪ You will return to the original Vivado Project.
SDK
▪ See Tutorial Unit 2 for details on how to create and test a software application on SDK.
▪ Go to Xilinx Tools → Repositories, click on ‘New’ and then browse to the folder \ip_repo\mypipdivfull_1.0 and click ok.
▪ Create a new SDK application: pipdivtest. Then, copy the following file into the /src folder: test_pipdiv.c
▪ The software routine controls the AXI4-Full Pipelined Divider peripheral by writing and reading from memory positions.
▪ Testing strategy: write four 32-bit words and read four 32-bit words. Each output word corresponds to an input word.
✓ MYPIPDIVFULL_mWriteMemory(Base Address, 32-bit word): Use this function (created when generating the AXI-4
Full IP) to write a 32-bit word onto the AXI4-Full Peripheral.
✓ MYPIPDIVFULL_mReadMemory(Base Address): Use this function (created when generating the AXI4-Full IP) to read a
32-bit word from the AXI4-Full Peripheral.
✓ Base Address: In the FIFO case, any address in the 64-byte range (the one allowed for the AXI4-Full Pipelined Divider
peripheral) works since we only write/read to/from the FIFOs.
✓ For example, for the given with the given Pipelined Divider parameters (N=M=16), we are expected to get:
Input (A|B) Output (Q|R)
0x008C0009 0x000F0005
0x00BB000A 0x00120007
0x0FEA0371 0x00040226
0x09640037 0x002B0027
4 Daniel Llamocca
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY
Tutorial: Embedded System Design for ZynqTM SoC RECRLAB@OU
CONSIDERATIONS
▪ We will use the Pipelined 2D Convolution Kernel with N=3, B=C=8.
▪ AXI4-Full Peripheral: the VHDL files allow only for the case:
✓ FIFO: Custom FIFO-based interface that we will be using. All writes/reads to any 16-word memory position is treated
the same (writing/reading on the FIFO).
FWFT H FWFT
1 Conv Kernel
S_AXI_WDATA 32 S_AXI_RDATA
32
32
72
32
20
DI DO D F DI DO
S_AXI_WSTRB 4 w ren rden w ren rden S_AXI_RID
0
S_AXI_WLAST 8 0
2 S_AXI_RRESP
empty
empty
full
S_AXI_RLAST
irden
S_AXI_WREADY S_AXI_RVALID
E
S_AXI_RREADY
iempty
S_AXI_BID FSM owren
S_AXI_BRESP 2 if ull
oempty
S_AXI_BVALID
orden
S_AXI_BREADY FSM
axi_rvalid
S_AXI_ACLK
S_AXI_ARESETN mem_rden
mem_wren axi_arv _arr_flag
CLKFX
IP GENERATION
▪ Create new project in Vivado: myaxifullconv2
✓ Make sure the default language is VHDL, so that the system wrapper and the template files are created in VHDL
✓ At Default Part, go to Boards, and select the Zybo (or Zybo Z7-10) Board.
▪ From the menu bar, select Tools → Create and Package New IP.
✓ Create a new AXI4 Peripheral. Name: myconv2full. Location /ip_repo.
5 Daniel Llamocca
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY
Tutorial: Embedded System Design for ZynqTM SoC RECRLAB@OU
Peripheral Repositories tip: To add a previously-generated IP into a new project, go to: Project Settings → IP → IP
repositories and point to the associated repository folder.
✓ Add Interface: Full, 32 bits. Interface Mode: Slave. Memory Size: 64 bytes (16 32-bit words)
✓ Select Edit IP. A New project appears, open it and look for the <peripheral name>_S00_AXI.vhd file (in this case it will
be myconv2full_v1_0_S00_AXI.vhd). Modify the project:
Replace myconv2full_v1_0_s00_AXI.vhd with our edited file myconv2full_v1_0_S00_AXI.vhd. Same for the file
myconv2full_v1_0.vhd (this is not strictly necessary).
Add the extra files to the folder /hdl in /ip_repo/myconv2full_1.0 and add these source files to the Vivado project.
* Vivado 2019.1: by default, the files will be added to the folder /src.
✓ There is no need to add ports as our peripheral does not include external I/Os.
✓ Synthesize your circuit (just to double-check everything is ok): You should’ve simulated the code in a different project.
✓ Go to Package IP – myconv2full → File Groups (Merge changes). Then Review and Package → Re-Package IP.
▪ Your custom IP is now ready to be used as an AXI4-Full Peripheral.
▪ You will return to the original Vivado Project.
SDK
▪ See Tutorial Unit 2 for details on how to create and test a software application on SDK.
▪ Go to Xilinx Tools → Repositories, click on ‘New’ and then browse to the folder \ip_repo\myconv2full_1.0 and click ok.
▪ Create a new SDK application: conv2test. Then, copy the following file into the /src folder: test_conv2.c
▪ The software routine controls the AXI4-Full Pip. 2D Conv Kernel peripheral by writing and reading from memory positions.
▪ Testing strategy: write three 32-bit words and read one 32-bit words. Each output word corresponds to 3 input words.
✓ MYCONV2FULL_mWriteMemory(Base Address, 32-bit word): Use this function (created when generating the AXI-4 Full
IP) to write a 32-bit word onto the AXI4-Full Peripheral.
✓ MYCONV2FULL_mReadMemory(Base Address): Use this function (created when generating the AXI4-Full IP) to read a 32-
bit word from the AXI4-Full Peripheral.
✓ Base Address: In the FIFO case, any address in the 64-byte range (the one allowed for the AXI4-Full Pipelined 2D
Convolution Kernel peripheral) works since we only write/read to/from the FIFOs.
✓ For example, for the given with the given Pipelined 2D Conv Kernel parameters (N=3, B=C=8), we are expected to get:
Input (D) Output (F)
0xA1B2C3D4
0xF0E1D2C3 0x00002B82
0x000000B3
0xF109050A
0xC302A1F0 0x000018FF
0x0000001C
6 Daniel Llamocca
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY
Tutorial: Embedded System Design for ZynqTM SoC RECRLAB@OU
CONSIDERATIONS
▪ We will use the 2D DCT hardware that allows for transforms of sizes 4, 8, and 16.
▪ As for the AXI4-Full Peripheral, the VHDL files allows only for the case:
✓ FIFO: Custom FIFO-based interface that we will be using. All writes/read to any of the 16-word memory positions is
treated the same (writing/reading on the FIFO).
▪ Description of the hardware files (the most important ones) we are using:
✓ mydctfull_v1_0.vhd: AXI4-Full Peripheral (top file, Vivado template).
✓ mydctfull_v1_0_S00_AXI.vhd: AXI4-Full Interface description (edited Vivado template)
✓ myAXI_IP.vhd, my_AXI_fifo.vhd, my_genpulse_sclr.vhd: Ancillary files for the AXI4-Full Peripheral.
✓ dct_ip.vhd: top file of the hardware that runs at CLKFX. This includes the 2D DCT IP, the input/output interfaces to the
FIFOs, the Output Buffer, and the FSM@CLKFX.
✓ DCT_2d.vhd: Top file of the 2D DCT hardware architecture
✓ fsm_fullypip.vhd, fsm_onetrans.vhd: Hardware description of the FSM @ CLKFX.
✓ DCT4_NH16_LUT_values[1..4], DCTeo8_NH16_LUT_values[1..8], DCTeo16_NH16LUT_values[1..16].txt: LUT
values for the DCT Transform coefficients specified in text files.
▪ 2D DCT parameters: In my_AXI_fifo.vhd, we can modify: N (transform size: 4, 8, 16), B (input pixel bitwidth: 8, 16), NO
(output pixel bitwidth: 8,16), IMP (implementation type: folded, pipelined), NH (coefficient bit-width). We fix NH=16.
▪ 2D DCT AXI4-Full Peripheral (FIFO-based) with AXI signals (we make S_AXI_CLK=CLK_FX).
S_AXI_AWID S_AXI_ARID
S_AXI_AWADDR 6 6 S_AXI_ARADDR
S_AXI_AWLEN 8 8 S_AXI_ARLEN
S_AXI_AWSIZE 3 3 S_AXI_ARSIZE
S_AXI_AWBURST 2 2 S_AXI_ARBURST
S_AXI_AWVALID S_AXI_ARVALID
N B NO IMP
S_AXI_AWREADY S_AXI_ARREADY
Output
iFIFO 512x32 oFIFO 512x32
Output Interface
Buffer
2D DCT IP
Input Interface
FWFT FWFT
NOxN
BxN
S_AXI_WDATA 32 32 32 32 S_AXI_RDATA
DI DO X Y ... DI DO
S_AXI_WSTRB 4 wren rden wren rden S_AXI_RID
rst E v
S_AXI_WLAST 2 S_AXI_RRESP
empty
empty
rst N rst
S_AXI_WVALID S_AXI_RLAST
full
full
irden
S_AXI_WREADY S_AXI_RVALID
S_AXI_RREADY
iempty
S_AXI_BID FSM owren
S_AXI_BRESP 2 ifull
oempty
S_AXI_BVALID
orden
S_AXI_BREADY FSM
axi_rvalid
S_AXI_ACLK
S_AXI_ARESETN mem_rden
mem_wren axi_arv_arr_flag
CLKFX
IP GENERATION
▪ Create new project in Vivado: myaxifulldct
✓ Make sure the default language is VHDL, so that the system wrapper and the template files are created in VHDL
✓ At Default Part, go to Boards, and select the Zybo (or Zybo Z7-10) Board.
▪ From the menu bar, select Tools → Create and Package New IP.
✓ Create a new AXI4 Peripheral. Name: mydctfull. Location: /ip_repo.
Peripheral Repositories tip: To add a previously-generated IP into a new project, go to: Project Settings → IP → IP
repositories and point to the associated repository folder.
7 Daniel Llamocca
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY
Tutorial: Embedded System Design for ZynqTM SoC RECRLAB@OU
✓ Add Interface: Full, 32 bits. Interface Mode: Slave. Memory Size: 64 bytes (16 32-bit words)
✓ Select Edit IP. A New project appears, open it and look for the <peripheral name>_S00_AXI.vhd file (in this case it will
be mydctfull_v1_0_S00_AXI.vhd). Modify the project:
Replace mydctfull_v1_0_s00_AXI.vhd with our edited file mydctfull_v1_0_S00_AXI.vhd. Same for the file
mydctfull_v1_0.vhd (this is not strictly necessary).
Add the extra files to the folder /hdl in /ip_repo/mydctfull_1.0 and add these source files (including ALL the .txt
files) to the Vivado project. * Vivado 2019.1: by default, the files will be added to the folder /src.
✓ There is no need to add ports as our peripheral does not include external I/Os.
✓ Synthesize your circuit (just to double-check everything is ok): You should’ve simulated the code in a different project.
✓ Go to Package IP – mydctfull → File Groups (Merge changes). Then Review and Package → Re-Package IP.
▪ Your custom IP is now ready to be used as an AXI4-Full Peripheral.
▪ You will return to the original Vivado Project.
SDK
▪ See Tutorial Unit 2 for details on how to create and test software application on SDK.
▪ Go to Xilinx Tools → Repositories, click on ‘New’ and then browse to the folder \ip_repo\mydctfull_1.0 and click ok.
▪ Create a new SDK application: dcttest. Then, copy the following file into the /src folder: dct_tst.c
▪ The software routine controls the AXI4-Full 2D DCT peripheral by writing and reading from memory positions.
▪ Testing strategy: For 𝑁 = 4, 𝑁𝑂 = 16, 𝐵 = 8. For every 2D Transform, we write 4 input columns (four 32-bit words), and
we get 4 output columns (eight 32-bit words).
✓ MYDCTFULL_mWriteMemory(Base Address, 32-bit word): Use this function (created when generating the AXI-4 Full
IP) to write a 32-bit word onto the AXI4-Full Peripheral.
✓ MYDCTFULL_mReadMemory(Base Address): Use this function (created when generating the AXI4-Full IP) to read a 32-
bit word from the AXI4-Full Peripheral.
✓ Base Address: In the FIFO case, any address in the 64-byte range (the one allowed for the AXI4-Full 2D DCT peripheral)
works since we only write/read to/from the FIFOs.
✓ For the given 2D DCT parameters, we provide two data sets. For the input values, each 32-bit word is a column; for the
output values, each two 32-bit words is a row.
8 Daniel Llamocca