zyqn PS端向PL端的片上RAM读写数据

参考博客:

https://blog.csdn.net/rzjmpb/article/details/50365915

在我的E:\vivado_program\ps_to_pl_bram1工程中为:

zyqn PS端向PL端的片上RAM读写数据_第1张图片

在SDK中的软件程序如下所示:

#include 
#include "platform.h"
#include "xil_io.h"
#include "xparameters.h"

//void print(char *str);

int main()
{
    init_platform();

    //print("Hello World\n\r");
    int num;
    int result;
    xil_printf("..........the test is start.........\n\r");

    for(num=0;num<15;num++)
    {
    	Xil_Out32(XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR+num*4,0x10000000+num);
    }
    for(num=0;num<15;num++)
    {
    	result=Xil_In32(XPAR_AXI_BRAM_CTRL_1_S_AXI_BASEADDR+num*4);
    	xil_printf("the data at %x is %x \n\r",XPAR_AXI_BRAM_CTRL_1_S_AXI_BASEADDR+num*4,result);
    }

    xil_printf("..........the test is end.........\n\r");
    cleanup_platform();
    return 0;
}

或者如下:

#include 
#include "platform.h"
#include "xil_io.h"
#include "xparameters.h"

//void print(char *str);

int main()
{
    init_platform();

    //print("Hello World\n\r");
    int num;
    int result;
    xil_printf("..........the test is start.........\n\r");

    for(num=0;num<15;num++)
    {
    	Xil_Out32(XPAR_AXI_BRAM_CTRL_1_S_AXI_BASEADDR+num*4,0x10000000+num);
    }
    for(num=0;num<15;num++)
    {
    	result=Xil_In32(XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR+num*4);
    	xil_printf("the data at %x is %x \n\r",XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR+num*4,result);
    }

    xil_printf("..........the test is end.........\n\r");
    cleanup_platform();
    return 0;
}

上述两种程序,只是交换了读写的起始地址。



在我的E:\vivado_program\ps_to_pl_bram2工程中为:

zyqn PS端向PL端的片上RAM读写数据_第2张图片

在SDK中的软件程序如下所示:

#include 
#include "platform.h"
#include "xil_io.h"
#include "xparameters.h"

//void print(char *str);

int main()
{
    init_platform();

    //print("Hello World\n\r");
    int num;
    int median_result;
    int result;
    xil_printf("..........the test is start.........\n\r");

    for(num=0;num<15;num++)
    {
    	Xil_Out32(XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR+num*4,0x10000000+num);
    }

    for(num=0;num<15;num++)
    {
    	result=Xil_In32(XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR+num*4);
    	xil_printf("the data at %x is %x \n\r",XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR+num*4,result);
    }

    xil_printf("..........the test is end.........\n\r");
    cleanup_platform();
    return 0;
}

两者达到了同样的效果。


你可能感兴趣的:(zynq7000)