80x86 Word Memory Access

Reply

Join Date: Oct 2008
Posts: 133
Reputation: NotNull is an unknown quantity at this point 
Solved Threads: 13
NotNull's Avatar
NotNull NotNull is offline Offline
Junior Poster

80x86 Word Memory Access

 
0
  #1
34 Days Ago
80X86 Speeding up word memory access.
When the address of the first byte of a word lies
at an odd address the processor must make two memory
fetches for each byte of the word.
But if the address of the first byte of the word lies
at an even address the processor can pull in both bytes
of the word in one memory fetch.

If the first word of an array of words lies at an even
address so will every other word in the array.
1st Word__2nd Word__3rd Word
|0100|0101|0102|0103|0104|0105
^________^________^_______
This speeds up performance when accessing an array
of words.

Assemblers usually provide an ALIGN directive to align
a word at an even address.

I was looking through the i386 arch manual on this, and
it mentioned that there could be a slight increase in speed
when the target address of control transfer instructions
were evenly divisible by four, does this apply to the 8086/real-mode?


Good day.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 33
Reputation: dan63043 is an unknown quantity at this point 
Solved Threads: 4
dan63043 dan63043 is offline Offline
Light Poster
 
0
  #2
33 Days Ago
If memory serves, it could be any even address on the 16 bit processors. Of course, if you're running 16 bit code on a 32 bit processor, go with divisible by four.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 129
Reputation: Evenbit is on a distinguished road 
Solved Threads: 4
Evenbit's Avatar
Evenbit Evenbit is offline Offline
Junior Poster
 
0
  #3
33 Days Ago
Yes, DWORD alignment is always preferred. But check with the standard literature on optimization:

http://www.agner.org/optimize/
while (CPU is present) {some assembly required}
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC