FPGARelated.com
Forums

ML505 - How to read/write SRAM?

Started by charlie78 January 21, 2009
Hi all,
I'm an Italian student, I'm new in fpga and Microblaze implementation.
I saw many starting tutorials about ML505 Xilinx Platform and usa of
Xilinx Platform Studio 10.1 and EDK.
In these tutorials I did not found any example of reading and writing
operation of the SRAM.
My code reside in BRAM and I would like to try to store some values in
SRAM.
By BSB I implemented SRAM in my system connected to microblaze by SPLB and
xps_mch_emc.
Now:
What are the instructions to read and write this memory?
It's a simply question but I can't find any answer... please help me.
Thanks (I apologize for my bad english)

Daniele


Hi!

You just have to look where in the processor's memory map the SRAM is
located (in the EDK GUI). Then you just have to write or read from
addresses in that range. The address decoder will tell the SRAM
controller, that these accesses are meant for the SRAM memory.

Matthias

charlie78 schrieb:
> Hi all, > I'm an Italian student, I'm new in fpga and Microblaze implementation. > I saw many starting tutorials about ML505 Xilinx Platform and usa of > Xilinx Platform Studio 10.1 and EDK. > In these tutorials I did not found any example of reading and writing > operation of the SRAM. > My code reside in BRAM and I would like to try to store some values in > SRAM. > By BSB I implemented SRAM in my system connected to microblaze by SPLB and > xps_mch_emc. > Now: > What are the instructions to read and write this memory? > It's a simply question but I can't find any answer... please help me. > Thanks (I apologize for my bad english) > > Daniele > >
Hi Daniele,

> What are the instructions to read and write this memory ?
There are 2 simple instructions to read / write directly to a memory address: Read: "XIo_In32". Write: "XIo_Out32". check "..\EDK project\microblaze_0\include\xio.h". Also controls the API of SRAM (XPS Multi-Channel External Memory in "IP Catalog"), with the right button on the block in SRAM EDK. "Driver" -> "View API Documentation". I'm Italian. Kappa.
Thanks all!
I'm looking xio.h and xparameters.h files.
This morning I'll try to write and read sram...
I hope to achieve a good result.

Daniele

P.s.:
Kappa anche io sono italiano, non vorrei disturbarti
eccessivamente n� investirti del ruolo di 
docente, ma se dovessi avere dei problemi posso
far affidamento su di te?
Ho iniziato ad affacciarmi al mondo degli FPGA
da pochissimo (2 mesi) e dopo uno sguardo iniziale
a manuali di VHDL e a semplicissimi tutorials
sto cercando di entrare nella filosofia del campo.
Sto operando su una piattaforma ML505 e sto
cercando di prendere dimestichezza con i vari bus,
periferiche (buttons,switches,leds,memories...)
Intanto ti ringrazio per l'indirizzamento.
Saluti!

#include "xparameters.h"
#include "stdio.h"
#include "xutil.h"
#include "fsl.h"
#include "xgpio_l.h"
#include "xio.h"
//====================================================
int main (void) {
Xuint32 segnale,Data,Data1,sum;
int i;
print("-- Inizo main() --\r\n\n");
do{
//riceve il primo valore dai dip switches
print("Digitare il primo dato attraverso i dip switches\r\n e premere un
push button per confermare\r\n\n");
do{
segnale = XGpio_mGetDataReg (XPAR_PUSH_BUTTONS_5BIT_BASEADDR, 1);
Data = XGpio_mGetDataReg (XPAR_DIP_SWITCHES_8BIT_BASEADDR,1);
}while(segnale == 0);
xil_printf("Dato letto da DIP_Switches_8Bit: 0x%x\r\n\n", Data);
// ciclo di ritardo per rilasciare gli switch

xio_out32(XPAR_SRAM_MEM0_BASEADDR,Data);
..

I COMPILED THE CODE AND THE RESULT IS:

Building target: TestApp_Memory.elf
mb-gcc -o TestApp_Memory.elf TestApp_Memory.o    -mno-xl-soft-mul
-mxl-pattern-compare -mcpu=v7.10.a 
-L../../microblaze_0_sw_platform/microblaze_0/lib -xl-mode-executable  
-T../../../TestApp_Memory/src/TestApp_Memory_LinkScr.ld
TestApp_Memory.o: In function `main':
/cygdrive/c/da_cancellare/SDK_projects/TestApp_Memory/Debug/../../../TestApp_Memory/src/TestApp_Memory.c:53:
undefined reference to `xio_out32'
/cygdrive/c/da_cancellare/SDK_projects/TestApp_Memory/Debug/../../../TestApp_Memory/src/TestApp_Memory.c:60:
undefined reference to `xio_in32'
collect2: ld returned 1 exit status
make: *** [TestApp_Memory.elf] Error 1
Build complete for project TestApp_Memory

WHAT'S WRONG?
Thanks...

Daniele
Hi Daniele,

> WHAT'S WRONG?
I am not sure but I think that the compiler is "case sensitive" ... then: "xio_out32" --> "Xio_Out32" "xio_in32" --> "Xio_In32" Kappa.
>Hi Daniele, > >> WHAT'S WRONG? > >I am not sure but I think that the compiler is "case sensitive" ... >then: > >"xio_out32" --> "Xio_Out32" >"xio_in32" --> "Xio_In32" > >Kappa. >
Ok, thanks. (ti ho aggiunto tra i contatti msn, grazie)