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.