Implement memory testing using C language pointers in FPGA

Source: Internet
Author: User

Example;

This is a question given by the teacher. The goal is to familiarize us with the C language operation of FPGA, so as to prevent low-handed eyes.

 

To be honest, testapp_memory is a test provided by XPS.ProgramThe principle is well understood. It is the process of writing data into and then reading data. However, when talking about our own operations, we also need to use the underlying "address Pointer". It sounds a bit messy, and there is a relatively small amount of online information. It was really hard for me to start.

 

At the beginning, I thought that since it was an underlying operation, please read the documents that come with the system. Haha, the RAM IP core has a document that can be easily called out in the GUI, however, the 23-page English document .........

 

In the end, it was easy to ask for help. Google was really good, and then found the following article.Article:

 From testapp_memory ~

Haha, it helped a lot. Really, the source code of the implementation can be found. Isn't that easy? I don't talk much about it. I write the last eight digits of data into and read it.CodePaste it. (as for 16-bit and 32-bit, the similarities are similar. In fact, you can easily write it by referring to the source code in xutil_memtest.c ).

 

// 8-Bit Data Reading and writing test ......

U8 uval = 0x00;
U8 bissuccess = 1;
U32 I;
U8 * uaddr = (xuint8 *) xpar_micron_ram_mem0_baseaddr;
For (I = 0l; I <1024; I ++)
{
Uaddr [I] = uval;
}
For (I = 0l; I <1024; I ++)
{
If (uaddr [I]! = Uval) bissuccess = 0;
}
If (bissuccess = 0)
{
Print ("enen, shibaile ...... ");
}
Else
{
Print ("hehe, chenggongle ^_^ ");
}

 

Finally, reflection, as the teacher said, FPGA can use the C language pointer as the address feature to perform hardware operations, which is very convenient. Now I have a little bit of feeling.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.