Andes Workshop
http://forum.andestech.com/

2 words read turn to burst-8 on axi-bus when executing lmw
http://forum.andestech.com/viewtopic.php?f=14&t=971
Page 1 of 1

Author:  jimmy [ Mon Jan 09, 2017 7:49 pm ]
Post subject:  2 words read turn to burst-8 on axi-bus when executing lmw

When Andes ISA "lmw/smw" execute on axi-bus, axi-bus will send burst-8 words. 8 words alignment may cause problem when reach IO peripheral. There are no 8 words alignment problem if executing basic load/store instruction on axi-bus. for eample,
C code:
u64_t mem_value64;
mem_value64 = MEM64(0x10040000);

compiler will translate C code to assembly code
assembly:
cd0: 46 01 00 40 sethi $r0,#0x10040
cd4: 3a 00 04 00 lmw.bi $r0,[$r0],$r1,#0x0 ! {$r0~$r1}
cd8: f0 86 swi37.sp $r0,[+#0x18]

above assembly code will send burst-8 words on axi-bus. if we want to send 2 words on axi bus, replacement C program is as follows.

#define LOAD_MEM64(val, addr) \
val = *(unsigned long volatile*)(addr), \
val |= (((unsigned long long)*(unsigned long volatile*)(((unsigned)addr) + 4)) << 32)

#define STORE_MEM64(val, addr) \
*(unsigned long volatile*)(addr) = (unsigned)val, \
*(unsigned long volatile*)(((unsigned)addr) + 4) = (unsigned)(val >> 32)

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/