Andes Workshop

It is currently Wed Oct 09, 2024 6:33 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Behavior of BSP400 to Handle 16-bit and 32-bit Instructions
PostPosted: Thu Jan 08, 2015 12:33 pm 
Offline

Joined: Fri May 04, 2012 6:49 am
Posts: 17
AndeStar is 16-bit/32-bit mixable ISA from when it's born. Most of 16-bit instructions are a frequently-used subset of 32-bit instructions.
In BSP v4.0.0, we transfer 32-bit instruction to 16-bit in order to reduce code size, but for performance considerations, function and branch target's first instrucntions should be a 32-bit one because CPU fecth a 32-bit instruciton every time from memory. If function's first instructions is a 16-bit, it takes CPU one more cycle to do a function call or branch.

Follow is the behavior of BSP400 to handle this:
1. If the compiler option is "-O0" or "-Os", the compiler will generate 16-bit as far as possible including the first instruction of function and branch target.
2. For other compiler optimization option, the compiler will generate 16-bit as far as possilbe exlcuding the first instruction of function and branch target.
3. There are two pseudo-ops “.off_16bit” and “.restore_16bit” which user can use to preserve 32-bit instructions or not.
In Page 30 of document “Andes_Programming_Guide_for_ISA_V3_PG010_V1.0.pdf”, user can find the following explanation:
Attachment:
sample3.jpg
sample3.jpg [ 11.87 KiB | Viewed 16104 times ]

There is a example code for these two pesudo-ops:
Attachment:
sample1.png
sample1.png [ 3.24 KiB | Viewed 16104 times ]

The result is:
Attachment:
sample2.png
sample2.png [ 6.3 KiB | Viewed 16104 times ]

Please find the related demo project in attached file.
Attachment:
demo-int.zip [202.83 KiB]
Downloaded 1636 times


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 3 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group