FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5283 Discussions

Avalon fifo status pointers not working

matif
Novice
418 Views

Hi,

 I simply connected my Avalon memory fifo to hps.design.JPG​But the read and write status pointers are not working, they are stuck always at 0. any ideas? c code is also attached he

#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <stdint.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include "C:\altera\15.1\embedded\ip\altera\hps\altera_hps\hwlib\include\hwlib.h" #include "C:\altera\15.1\embedded\ip\altera\hps\altera_hps\hwlib\include\soc_cv_av\socal\socal.h" #include "C:\altera\15.1\embedded\ip\altera\hps\altera_hps\hwlib\include\soc_cv_av\socal\hps.h" #include "C:\altera\15.1\embedded\ip\altera\hps\altera_hps\hwlib\include\soc_cv_av\socal\alt_gpio.h" #include "D:\TestDesigns\customfifoloopback3\hps_0.h" //Main bus addresses #define FIFO_BASE 0xC0000000 #define FIFO_SPAN 0x00001000 //LW Addresses #define REG_BASE 0xFF200000 #define REG_SPAN 0x00200000 //initializing the pointers void* virtual_base; void* h2f_virtual_base; volatile unsigned int * FIFO_write_ptr; volatile unsigned int * FIFO_read_ptr; volatile unsigned int * FIFO_write_status_ptr; volatile unsigned int * FIFO_read_status_ptr; //unsigned int value; int data[8]; int i; //int FIFO_FULL; //int FIFO_EMPTY; //main functions int main () { int fd = EXIT_FAILURE; fd=open("/dev/mem",(O_RDWR|O_SYNC)); if (fd < 0) { perror("open"); exit(EXIT_FAILURE); } printf("fd is ok\n"); //accessing the virtual addresses of the fifo pointers virtual_base=mmap(NULL,REG_SPAN,(PROT_READ|PROT_WRITE),MAP_SHARED,fd,REG_BASE); h2f_virtual_base=mmap(NULL,FIFO_SPAN,(PROT_READ|PROT_WRITE),MAP_SHARED,fd,FIFO_BASE); printf("virtual base pointer to open device memory file is ok\n"); FIFO_write_status_ptr = (unsigned int *)(virtual_base+FIFO_0_IN_CSR_BASE); FIFO_read_status_ptr = (unsigned int *)(virtual_base+FIFO_0_OUT_CSR_BASE); FIFO_write_ptr=(unsigned int *)(h2f_virtual_base+FIFO_0_IN_BASE); FIFO_read_ptr= (unsigned int *)(h2f_virtual_base+FIFO_0_OUT_BASE); printf("fifo pointers are ok\n"); //entering data into the fifo for(i=0;i<8;i++) { data[i]=i+1; *FIFO_write_ptr=data[i]; printf("////////////////////////////\n"); printf("you entered the value %d\n",*FIFO_write_ptr); printf("fifo write status pointer is %d\n",*FIFO_write_status_ptr); printf("//////////////////////////////\n"); } printf("reading back the data\n"); for(i=0;i<8;i++) { //reading data from the fifo printf("////////////////////////////\n"); printf("the output value from the fifo is %d\n",*FIFO_read_ptr); printf("fifo read status pointer is %d\n",*FIFO_read_status_ptr); printf("/////////////////////////////\n"); } return 0; }

rewith.output.JPG

0 Kudos
1 Reply
EBERLAZARE_I_Intel
156 Views

Hi,

 

According to our IP user guide, I am unsure if pointers value can be returned.

 

Have you look through the Avalon FIFO memory IP user guide?

https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_embedded_ip.pdf#page=...

Reply