Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CS 220 / ARM / ARM1176JZ-S Technical Reference Mmanual.pdf
Источник:
Скачиваний:
45
Добавлен:
16.04.2015
Размер:
4.47 Mб
Скачать

Unaligned and Mixed-endian Data Access Support

4.4Operation of unaligned accesses

This section describes alignment faults and operation of non-faulting accesses of the processor. Table 4-2 lists the memory access types.

The mechanism for the support of unaligned loads or stores is that if either the Base register or the index offset of the address is misaligned, then the processor takes two cycles to issue the instruction. If the resulting address is misaligned, then the instruction performs multiple memory accesses in ascending order of address.

There is no support for misaligned accesses being atomic, and misaligned accesses to Device memory might result in Unpredictable behavior.

Table 4-3 on page 4-14 lists details of when an alignment fault must occur for an access and of when the behavior of an access is architecturally Unpredictable. When an access does not generate an alignment fault, and is not Unpredictable, details of the precise memory locations that are accessed are also given in the table.

The access type descriptions used in Table 4-3 on page 4-14 are determined from the load/store instruction that Table 4-2 lists.

 

Table 4-2 Memory access types

 

 

Access type

ARM instructions

 

 

Byte

LDRB, LDRBT, STRB, STRBT

 

 

BSync

SWPB, LDREXB, STREXB

 

 

Halfword

LDRH, LDRSH, STRH

 

 

HWSync

LDREXH, STREXH

 

 

WLoad

LDR, LDRT, SWP, load access if U is set to 0

 

 

WStore

STR, STRT, SWP, store access if U is set to 0

 

 

WSync

LDREX, STREX, SWP, either access if U is set to 1

 

 

Two-word

LDRD, STRD

 

 

Multi-word

LDC, LDM, RFE, SRS, STC, STM

 

 

DWSync

LDREXD, STREXD

 

 

The following terminology is used to describe the memory locations accessed:

Byte[X] This means the byte whose address is X in the current endianness model. The correspondence between the endianness models is that Byte[A] in the LE endianness model, Byte[A] in the BE-8 endianness model, and Byte[A EOR 3] in the BE-32 endianness model are the same actual byte of memory.

Halfword[X] This means the halfword consisting of the bytes whose addresses are X and X+1 in the current endianness model, combined to form a halfword in little-endian order in the LE endianness model or in big-endian order in the BE-8 or BE-32 endianness model.

Word[X] This means the word consisting of the bytes whose addresses are X, X+1, X+2, and X+3 in the current endianness model, combined to form a word in little-endian order in the LE endianness model or in big-endian order in the BE-8 or BE-32 endianness model.

ARM DDI 0333H

Copyright © 2004-2009 ARM Limited. All rights reserved.

4-13

ID012410

Non-Confidential, Unrestricted Access

 

Unaligned and Mixed-endian Data Access Support

Note

It is a consequence of these definitions that if X is word-aligned, Word[X] consists of the same four bytes of actual memory in the same order in the LE and BE-32 endianness models.

Align(X) This means X AND 0xFFFFFFFC. That is, X with its least significant two bits forced to zero to make it word-aligned.

There is no difference between Addr and Align(Addr) on lines where Addr[1:0] is set to b00. You can use this to simplify the control of when the least significant bits are forced to zero.

For the Two-word and Multi-word access types, the Memory accessed column only specifies the lowest word accessed. Subsequent words have addresses constructed by successively incrementing the address of the lowest word by 4, and are constructed using the same endianness model as the lowest word.

Table 4-3 Unalignment fault occurrence when access behavior is architecturally unpredictable

A

U

Addr[2:0]

Access

Architectural

Memory accessed

Note

types

Behavior

 

 

 

 

 

 

 

 

 

 

 

 

0

0

-

-

-

-

Legacy, no alignment

 

 

 

 

 

 

 

0

0

bxxx

Byte, BSync

Normal

Byte[Addr]

 

 

 

 

 

 

 

 

0

0

bxx0

Halfword

Normal

Halfword[Addr]

 

 

 

 

 

 

 

 

0

0

bxx1

Halfword

Unpredictable

-

Halfword[Align16(Addr)];

 

 

 

 

 

 

Operation unaffected by Addr[0]

 

 

 

 

 

 

 

0

0

bxx0

HWSync

Normal

Halfword[Addr]

 

 

 

 

 

 

 

 

0

0

bxx1

HWSync

Unpredictable

-

Halfword[Align16(Addr)];

 

 

 

 

 

 

Operation unaffected by Addr[0]

 

 

 

 

 

 

 

0

0

bxxx

Wload

Normal

Word[Align32(Addr)]

Loaded data rotated by

 

 

 

 

 

 

8*Addr[1:0] bits

 

 

 

 

 

 

 

0

0

bxxx

WStore

Normal

Word[Align32(Addr)]

Operation unaffected by

 

 

 

 

 

 

Addr[1:0]

 

 

 

 

 

 

 

0

0

bx00

WSync

Normal

Word[Addr]

 

 

 

 

 

 

 

 

0

0

bxx1, bx1x

WSync

Unpredictable

-

Word[Align32(Addr)]

 

 

 

 

 

 

 

0

0

bxxx

Multi-word

Normal

Word[Align32(Addr)]

Operation unaffected by

 

 

 

 

 

 

Addr[1:0]

 

 

 

 

 

 

 

0

0

b000

Two-word

Normal

Word[Addr]

 

 

 

 

 

 

 

 

0

0

bxx1,

Two-word

Unpredictable

-

Same as LDM2 or STM2

 

 

bx1x, b1xx

 

 

 

 

 

 

 

 

 

 

 

0

0

b000

DWSync

Normal

Word[Addr]

 

 

 

 

 

 

 

 

0

0

bxx1,

DWSync

Unpredictable

-

DWord[Align64(Addr)];

 

 

bx1x,

 

 

 

Operation unaffected by

 

 

b1xx

 

 

 

Addr[2:0]

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1

-

-

-

-

ARMv6 unaligned support

 

 

 

 

 

 

 

0

1

bxxx

Byte, BSync

Normal

Byte[Addr]

 

ARM DDI 0333H

Copyright © 2004-2009 ARM Limited. All rights reserved.

4-14

ID012410

Non-Confidential, Unrestricted Access

 

Unaligned and Mixed-endian Data Access Support

Table 4-3 Unalignment fault occurrence when access behavior is architecturally unpredictable (continued)

A

U

Addr[2:0]

Access

Architectural

Memory accessed

Note

types

Behavior

 

 

 

 

 

 

 

 

 

 

 

 

0

1

bxxx

Halfword

Normal

Halfword[Addr]

 

 

 

 

 

 

 

 

0

1

bxx0

HWSync

Normal

Halfword[Addr]

 

 

 

 

 

 

 

 

0

1

bxx1

HWSync

Alignment fault

 

 

 

 

 

 

 

 

 

0

1

bxxx

Wload,

Normal

Word[Addr]

 

 

 

 

WStore

 

 

 

 

 

 

 

 

 

 

0

1

bx00

WSync,

Normal

Word[Addr]

 

 

 

 

Multi-word,

 

 

 

 

 

 

Two-word

 

 

 

 

 

 

 

 

 

 

0

1

bxx1, bx1x

WSync,

Alignment fault

-

-

 

 

 

Multi-word,

 

 

 

 

 

 

Two-word

 

 

 

 

 

 

 

 

 

 

0

1

b000

DWSync

Normal

Word[Addr]

 

 

 

 

 

 

 

 

0

1

bxx1,

DWSync

Alignment fault

-

 

 

 

bx1x, b1xx

 

 

 

 

 

 

 

 

 

 

 

1

x

-

-

-

-

Full alignment faulting

 

 

 

 

 

 

 

1

x

bxxx

Byte, BSync

Normal

Byte[Addr]

 

 

 

 

 

 

 

 

1

x

bxx0

Halfword,

Normal

Halfword[Addr]

 

 

 

 

HWSync

 

 

 

 

 

 

 

 

 

 

1

x

bxx1

Halfword,

Alignment fault

-

 

 

 

 

HWSync

 

 

 

 

 

 

 

 

 

 

1

x

bx00

WLoad,

Normal

Word[Addr]

 

 

 

 

WStore,

 

 

 

 

 

 

WSync,

 

 

 

 

 

 

Multi-word

 

 

 

 

 

 

 

 

 

 

1

x

bxx1, bx1x

WLoad,

Alignment fault

-

 

 

 

 

WStore,

 

 

 

 

 

 

WSync,

 

 

 

 

 

 

Multi-word

 

 

 

 

 

 

 

 

 

 

1

x

b000

Two-word

Normal

Word[Addr]

 

 

 

 

 

 

 

 

1

0

b100

Two-word

Alignment fault

-

 

 

 

 

 

 

 

 

1

1

b100

Two-word

Normal

Word[Addr]

 

 

 

 

 

 

 

 

1

x

bxx1, bx1x

Two-word

Alignment fault

-

 

 

 

 

 

 

 

 

1

x

b000

DWSync

Normal

Word[Addr]

 

 

 

 

 

 

 

 

1

x

bxx1,

DWSync

Alignment fault

-

 

 

 

bx1x, b1xx

 

 

 

 

 

 

 

 

 

 

 

The following causes override the behavior specified in the Table 4-3 on page 4-14:

An LDR instruction that loads the PC, has Addr[1:0] != b00, and is specified in the table as having Normal behavior instead has Unpredictable behavior.

ARM DDI 0333H

Copyright © 2004-2009 ARM Limited. All rights reserved.

4-15

ID012410

Non-Confidential, Unrestricted Access

 

Unaligned and Mixed-endian Data Access Support

The reason why this applies only to LDR is that most other load instructions are Unpredictable regardless of alignment if the PC is specified as their destination register.

The exceptions are ARM LDM and RFE instructions, and Thumbs POP instruction. If the instruction for them is Addr[1:0] != b00, the effective address of the transfer has its two least significant bits forced to 0 if A is set 0 and U is set to 0. Otherwise the behavior specified in Table 4-3 on page 4-14 is either Unpredictable or Alignment Fault regardless of the destination register.

Any WLoad, WStore, WSync, Two-word, or Multi-word instruction that accesses device memory, has Addr[1:0] != b00, and Table 4-3 on page 4-14 lists them as having Normal behavior instead has Unpredictable behavior.

Any Halfword instruction that accesses device memory, has Addr[0] != 0, and is specified in the table as having Normal behavior instead has Unpredictable behavior.

ARM DDI 0333H

Copyright © 2004-2009 ARM Limited. All rights reserved.

4-16

ID012410

Non-Confidential, Unrestricted Access

 

Соседние файлы в папке ARM