Andes Workshop

It is currently Sat Mar 30, 2024 12:35 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 簡易測試memory的程式
PostPosted: Mon Nov 14, 2011 7:13 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
Code:
#include <stdio.h>
#include <stdlib.h>

int main(void) {
   puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */

   __asm__("li\t $r0, #0x35000\n\t"
       "  li\t $r1, 0x00036000\n\t"
        "  li\t $r2, 0x5a5a5a5a\n\t "
       "loop:\n\t"
       "  swi\t $r2, [$r0]\n\t"  //save value to memory
       "  lwi\t   $r3, [$r0]\n\t"  //load value to $r3
       "  bne\t  $r2, $r3, MEM_ERROR\n\t"//compare memory
       "  addi\t $r0, $r0, 0x04\n\t"  //add memory address +4
       "       addi\t $r2, $r2, 0x01\n\t"  //add value +1
       "  blt\t $r0, $r1, loop\n\t"
       "MEM_ERROR:\n\t"
       "  break\n\t"
       );

   return EXIT_SUCCESS;
}


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 22 guests


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