Добавил:
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.2Unaligned access support

Instructions must always be aligned as follows:

ARM 32-bit instructions must be word boundary aligned, Address [1:0] = b00

Thumb 16-bit instructions must be halfword boundary aligned, Address [0] = 0.

The following sections describe unaligned data access support:

Legacy support

ARMv6 extensions

Legacy and ARMv6 configurations on page 4-4

Legacy data access in ARMv6 (U=0) on page 4-4

Support for unaligned data access in ARMv6 (U=1) on page 4-4

ARMv6 unaligned data access restrictions on page 4-5.

4.2.1Legacy support

For ARM architectures prior to ARM architecture v6, data access to non-aligned word and halfword data was treated as aligned from the memory interface perspective. That is, the address is treated as truncated with Address[1:0], treated as zero for word accesses, and Address[0] treated as zero for halfword accesses.

Load single word ARM instructions are also architecturally defined to rotate right the word aligned data transferred by a non word-aligned access, see the ARM Architecture Reference Manual.

Alignment fault checking is specified for processors with architecturally compliant Memory Management Units (MMUs), under control of CP15 Register c1 A control bit, bit 1. When a transfer is not naturally aligned to the size of data transferred a Data Abort is signaled with an Alignment fault status code, see ARM Architecture Reference Manual for more details.

4.2.2ARMv6 extensions

ARMv6 adds unaligned word and halfword load and store data access support. When enabled, one or more memory accesses are used to generate the required transfer of adjacent bytes transparently, apart from a potentially greater access time where the transaction crosses a word-boundary.

The memory management specification defines a programmable mechanism to enable unaligned access support. This is controlled and programmed using the CP15 Register c1 U control bit, bit 22.

Non word-aligned for load and store multiple/double, semaphore, synchronization, and coprocessor accesses always signal Data Abort with Alignment Faults Status Code when the U bit is set.

Strict alignment checking is also supported in ARMv6, under control of the CP15 Register c1 A control bit, bit [1], and signals a Data Abort with Alignment Fault Status Code if a 16-bit access is not halfword aligned or a single 32-bit load/store transfer is not word aligned.

ARMv6 alignment fault detection is a mandatory function associated with address generation rather than optionally supported in external memory management hardware.

ARM DDI 0333H

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

4-3

ID012410

Non-Confidential, Unrestricted Access

 

Unaligned and Mixed-endian Data Access Support

4.2.3Legacy and ARMv6 configurations

Table 4-1 summarizes the unaligned access handling.

 

 

Table 4-1 Unaligned access handling

 

 

CP15 register c1:

Unaligned access model

U bit

A bit

 

 

 

 

0

0

Legacy ARMv5. See Legacy data access in ARMv6 (U=0).

 

 

 

0

1

Legacy natural alignment check.

 

 

 

1

0

ARMv6 unaligned half/word access, else strict word alignment check.

 

 

 

1

1

ARMv6 strict half/word alignment check.

 

 

 

4.2.4Legacy data access in ARMv6 (U=0)

The processor emulates earlier architecture unaligned accesses to memory as follows:

If A bit is asserted alignment faults occur for:

Halfword access

Address[0] is 1.

Word access

Address[1:0] is not b00.

LDRD or STRD

Address [2:0] is not b000.

Multiple access

Address [1:0] is not b00.

If alignment faults are enabled and the access is not aligned then the Data Abort vector is entered with an Alignment Fault status code.

If no alignment fault is enabled, that is, if bit 1 of CP15 Register c1, the A bit, is not set:

Byte access

Memory interface uses full Address [31:0].

Halfword access Memory interface uses Address [31:1]. Address [0] asserted as 0.

Word access Memory interface uses Address [31:2]. Address [1:0] asserted as 0.

ARM load data rotates the aligned read data and rotates this right by the byte-offset denoted by Address [1:0], see the ARM Architecture Reference Manual.

ARM and Thumb load-multiple accesses always treated as aligned. No rotation of read data.

ARM and Thumb store word and store multiple treated as aligned. No rotation of write data.

ARM load and store doubleword operations treated as 64-bit aligned.

For more information, see Operation of unaligned accesses on page 4-13.

4.2.5Support for unaligned data access in ARMv6 (U=1)

The processor memory interfaces can generate unaligned low order byte address offsets only for halfword and single word load and store operations, and byte accesses unless the A bit is set. These accesses produce an alignment fault if the A bit is set, and for some of the cases that

ARMv6 unaligned data access restrictions on page 4-5 describes.

If alignment faults are enabled and the access is not aligned then the Data Abort vector is entered with an Alignment Fault status code.

ARM DDI 0333H

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

4-4

ID012410

Non-Confidential, Unrestricted Access

 

Unaligned and Mixed-endian Data Access Support

4.2.6ARMv6 unaligned data access restrictions

The following restrictions apply for ARMv6 unaligned data access:

Accesses are not guaranteed atomic. They might be synthesized out of a series of aligned operations in a shared memory system without guaranteeing locked transaction cycles.

Unaligned accesses loading the PC produce an alignment trap.

Accesses typically take a greater number of cycles to complete compared to a naturally aligned transfer. The real-time implications must be carefully analyzed and key data structures might require to have their alignment adjusted for optimum performance.

Accesses can abort on either or both halves of an access where this occurs over a page boundary. The Data Abort handler must handle restartable aborts carefully after an Alignment Fault status code is signaled.

As a result, shared memory schemes must not rely on seeing monotonic updates of non-aligned data of loads, stores, and swaps for data items greater than byte width. Unaligned access operations must not be used for accessing Device memory-mapped registers, and must be used with care in Shared memory structures that are protected by aligned semaphores or synchronization variables.

An Unalignment trap occurs if unaligned accesses to Strongly Ordered or Device when both:

the MMU is enabled, that is CP15 c1 bit 0, M bit, is 1

the Subpage AP bits are disabled, that is CP15 c1 bit 23, XP bit, is 1.

Swap and synchronization primitives, multiple-word or coprocessor access produce an alignment fault regardless of the setting of the A bit.

ARM DDI 0333H

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

4-5

ID012410

Non-Confidential, Unrestricted Access

 

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