Andes Workshop

It is currently Tue Sep 26, 2017 2:54 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 2 words read turn to burst-8 on axi-bus when executing lmw
PostPosted: Mon Jan 09, 2017 7:49 pm 
Offline

Joined: Thu Apr 14, 2011 11:27 am
Posts: 13
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)


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group