Professional Documents
Culture Documents
Xilinx IP 만들기-doksg
Xilinx IP 만들기-doksg
DDR ARM
Memory (Host) BRAM
Memory
BRAM
Controller
AXI-4 Lite
Slave
ARM AXI
(Host) Master
PS : Processing System
PL : Programmable Logic
Zynq PL
Arty Z7-20 LED 조절하는 IP 만들기
button 3 LED 3
32 bit
[31:4] [3] [2] [1] [0]
LED LED LED LED
Reserved 3 2 1 0
Manage IP 클릭하고 New IP Location 클릭
본인이 사용하는 보드를 선택해줍니다.
저는 Arty Z7-20을 사용해서 왼쪽과 같이 선택했습니다.
Vivado IP Catalog에 new IP Package를 넣는다.
차이는?
Output port 추가
Logic 추가
더블 클릭
잘 있는지 확인만
#include "xparameters.h"
#include "xgpio.h"
#include "myip.h"
int main(void)
{
XGpio btns;
u32 btns_status;
u32 ledip_BaseAddress = XPAR_MYIP_0_S00_AXI_BASEADDR;
XGpio_Initialize(&btns, XPAR_AXI_GPIO_0_DEVICE_ID);
XGpio_SetDataDirection(&btns, 1, 0xffffffff);
while(1)
{
btns_status = XGpio_DiscreteRead(&btns, 1);
MYIP_mWriteReg(ledip_BaseAddress, 0, btns_status);
xil_printf("Button Status: %08x\r\n", btns_status);
}
}
Arty Z7-20 LED 조절하는 IP 만들기
button 3 LED 3
32 bit
[31:4] [3] [2] [1] [0]
LED LED LED LED
Reserved 3 2 1 0
Example 2:
LED 0
button 0 ARM
LED IP LED 1
Processor
button 1
GPIO LED Register LED 2
버튼 입력
button 3
3C-LED0
SW 0
3C-LED1
32 bit
SW 1
[31:30] [29:11] [10:8] [7] [6:4] [3] [2] [1] [0]
3C- Reser 3C- LED LED LED LED
mode Reserved LED1 ved LED0 3 2 1 0
mode
{SW0=0, SW1=0} -> Button0-4 : LED0-4 제어
{SW0=1, SW1=0} -> Button0-3 : 3C-LED0 제어
{SW0=0, SW1=1} -> Button0-3 : 3C-LED1 제어
Manage IP 클릭하고 New IP Location 클릭
잘 있는지 확인만
axi gpio 두개
led ip 만든거 하나
zynq7 하나
int main(void)
{
XGpio btns;
XGpio sws;
u32 btns_status;
u32 sws_status;
u32 ledip_BaseAddress = XPAR_LED_IP2_0_S00_AXI_BASEADDR;
XGpio_Initialize(&btns, XPAR_AXI_GPIO_0_DEVICE_ID);
XGpio_Initialize(&sws, XPAR_AXI_GPIO_1_DEVICE_ID);
XGpio_SetDataDirection(&btns, 1, 0xffffffff);
u32 value=0;
while(1)
{
btns_status = XGpio_DiscreteRead(&btns, 1);
sws_status = XGpio_DiscreteRead(&sws, 1);
if(sws_status==1){
value = ((btns_status&0x7)<<4);
}else if(sws_status==2){
value = ((btns_status&0x7)<<8);
}else{
value = (btns_status);
}
value = value +(sws_status<<28);
LED_IP2_mWriteReg(ledip_BaseAddress, 0, value);
xil_printf("Button Status: %08x\r\n", value);
}
return 0;
}