05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Common Memory System <strong>Architecture</strong> Features<br />

return value;<br />

// Assignment form<br />

MemU_with_priv[bits(32) address, integer size, boolean privileged] = bits(8*size) value<br />

// Legacy non alignment-checking configuration forces access to be aligned<br />

if SCTLR.A == ‘0’ && SCTLR.U == ‘0’ then address = Align(address, size);<br />

// Do aligned access, take alignment fault, or do sequence of bytes<br />

if address == Align(address, size) then<br />

MemA_with_priv[address, value, privileged] = value;<br />

elsif SCTLR.A == ‘1’ then<br />

AlignmentFault(address, TRUE);<br />

else // if unaligned access, SCTLR.A == ‘0’, <strong>and</strong> SCTLR.U == ‘1’<br />

if CPSR.E == ‘1’ then<br />

value = BigEndianReverse(value, size);<br />

for i = 0 to size-1<br />

MemA_with_priv[address+i, 1, privileged] = value;<br />

return;<br />

B2.4.6 Reverse endianness<br />

The following pseudocode describes the operation to reverse endianness:<br />

// BigEndianReverse()<br />

// ==================<br />

bits(8*N) BigEndianReverse (bits(8*N) value, integer N)<br />

assert N == 1 || N == 2 || N == 4 || N == 8;<br />

bits(8*N) result;<br />

case N of<br />

when 1<br />

result = value;<br />

when 2<br />

result = value;<br />

result = value;<br />

when 4<br />

result = value;<br />

result = value;<br />

result = value;<br />

result = value;<br />

when 8<br />

result = value;<br />

result = value<br />

result = value;<br />

result = value;<br />

result = value;<br />

result = value;<br />

result = value;<br />

result = value;<br />

return result;<br />

B2-34 Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DDI 0406B

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!