Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/06/05 06:30
Read: times


 
#91083 - Not relevant to 8051
Responding to: ???'s previous message
Kuldeep Singh said:
it is a bit offline question do not know wheather should be posted on this forum or not

It is off-topic for this forum, as it is not relevant to an 8051 - because it's an 8-bit processor.

It is only relevant to processors with larger word sizes - 16, 32, 64 bit, etc.

eg, on a 16-bit system, each memory location is effectively 16 bits wide:
1st 16-bit location is at address 0x0000;
2nd 16-bit location is at address 0x0002;
3rd 16-bit location is at address 0x0004;
etc

Clearly you will cause such a processor a problem if you locate, say, a 16-bit 'int' on an odd address - because one byte will be in one half of one 16-bit location, and the other byte will be in one half of the next 16-bit location!

Such processors will have ways & means to cope with this, but it will involve such things as reading the bytes individually & then reconstructing the proper-sized data object. Clearly this gives a major performance hit!

for example a code of line "int x_attribute((aligned((16))=0" causes the compiler to allocate the global variable x on a 16byte boundary.

It just means that the address must be an integer multiple of 16; ie, 0x0000, 0x0010, 0x0020, 0x0030, etc - in fact any address in which the four least-significant bits are all zero (ie, the least significant hex digit is zero).

I think Intel refer to this as a "Paragraph" in relation to the x86?

i know for fastest operation variables are aligned according to their size

See above.

List of 13 messages in thread
TopicAuthorDate
alignment of variable in c            01/01/70 00:00      
   Modulo 16            01/01/70 00:00      
      thanks smith            01/01/70 00:00      
      Addressing            01/01/70 00:00      
   Not relevant to 8051            01/01/70 00:00      
      re not relevant            01/01/70 00:00      
      This subject could be relevant....            01/01/70 00:00      
         yeah right            01/01/70 00:00      
         External Influences            01/01/70 00:00      
            Alignment/byte ordering matters a lot!            01/01/70 00:00      
               you can not align when ...            01/01/70 00:00      
                  good references            01/01/70 00:00      
                     RTFM!            01/01/70 00:00      

Back to Subject List