English
Language : 

PXR40RM Datasheet, PDF (351/1434 Pages) Freescale Semiconductor, Inc – PXR40 Microcontroller
General-Purpose Static RAM (SRAM)
11.7.1 Example Code
To initialize SRAM correctly, use a store multiple word (stmw) instruction to implement 64-bit writes to
all SRAM locations. The stmw instruction concatenates two 32-bit registers to implement a single 64-bit
write. To ensure the writes are 64-bits, specify an even number of registers and write on 64-bit
word-aligned boundaries.
The following example code illustrates the use of the stmw instruction to initialize the SRAM ECC bits.
init_RAM:
lis
r11,0x4000
ori
r11,r11,0
li
r12,2048
mtctr r12
init_ram_loop:
stmw
r0,0(r11)
addi
r11,r11,128
bdnz
init_ram_loop
blr
# base address of the SRAM, 64-bit word aligned
# not needed for this address but could be for others
# loop counter to get all of SRAM;
# 256*1024/4 bytes/32 GPRs =2048
# write all 32 GPRs to SRAM
# inc the ram ptr; 32 GPRs * 4 bytes = 128
# loop for 256K of SRAM
# done
Freescale Semiconductor
PXR40 Microcontroller Reference Manual, Rev. 1
11-5