Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20693 Discussions

read write from an aonchip memory!!!!

Altera_Forum
Honored Contributor II
1,584 Views

hello, 

i m a beginner, i try use an onchip memory. i can't perform read and write operation with onchip memory. 

i can't found an C example that help me access to the memory. 

i have writen c code: 

# include "io.h"# include "system.h"# include <stdio.h># include "Data.h"# include "sys/alt_irq.h" 

 

 

//=============================================================================  

int i; 

int h; 

int *z; 

int Acc0k; 

long cpt_AlleleAccMaster; 

int cpt_Allele; 

int cpt_iteration; 

int Nb_Nucleotides; 

int *z1; 

int *k; 

 

 

void InitDNA() 

{  

Acc0k = 0; 

cpt_Allele = 0; 

cpt_AlleleAccMaster = 0; 

cpt_iteration = 0; 

Nb_Nucleotides = 64; 

z1 = (unsigned int*)0x02100000; 

for (i=0;i<Nb_Nucleotides;i=i+4) 

h = (G[i]); 

*z1 = h;  

z1 = z1 + 1; 

 

int main() 

 

InitDNA(); //read (load) data from data.h 

 

k= (unsigned int*)0x02100000; 

for(i=0;i<16;i++) 

printf("%x\t",*(k+i));// display data 

 

can someone help me ? 

thk for all members
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
387 Views

doe's 0x02100000 address correspond to a on chip memory cell? did you check it at sopc builder? 

 

in that case you should declare you pointer as volatile 

 

 

# define ON_CHIP (*(volatile unsigned int *)0x02100000)
0 Kudos
Altera_Forum
Honored Contributor II
387 Views

thnk you parrado, i success running my program with an onchip memory. 

best regards
0 Kudos
Reply