Rev. 1.50, 10/04, page 334 of 448
10.1.77 TAS (Test And Set): Logical Instruction
Format
Operation
Instruction Code
Cycle
T Bit
TAS.B @Rn
If (Rn) = 0, 1
→
T, else 0
→
T
1
→
MSB of (Rn)
0100nnnn00011011
4 Test
result
Description:
This instruction purges the cache block corresponding to the memory area specified
by the contents of general register Rn, reads the byte data indicated by that address, and sets the T
bit to 1 if that data is zero, or clears the T bit to 0 if the data is nonzero. The instruction then sets
bit 7 to 1 and writes to the same address. The bus is not released during this period.
The purge operation is executed as follows.
In a purge operation, data is accessed using the contents of general register Rn as the effective
address. If there is a cache hit and the corresponding cache block is dirty (U bit = 1), the contents
of that cache block are written back to external memory, and the cache block is then invalidated
(by clearing the V bit to 0). If there is a cache hit and the corresponding cache block is clean (U bit
= 0), the cache block is simply invalidated (by clearing the V bit to 0). A purge is not executed in
the event of a cache miss, or if the accessed memory location is non-cacheable.
The two TAS.B memory accesses are executed automatically. Another memory access is not
executed between the two TAS.B accesses.
Notes:
None
Operation:
TAS(int n) /* TAS.B @Rn */
{
int temp;
temp = (int)Read_Byte(R[n]); /* Bus Lock */
if (temp==0) T = 1;
else T = 0;
temp |= 0x00000080;
Write_Byte(R[n],temp); /* Bus unlock */
PC += 2;
}
Содержание SuperH SH-4A
Страница 2: ...Rev 1 50 10 04 page ii of xx ...
Страница 8: ...Rev 1 50 10 04 page viii of xx ...
Страница 116: ...Rev 1 50 10 04 page 96 of 448 ...
Страница 178: ...Rev 1 50 10 04 page 158 of 448 ...
Страница 206: ...Rev 1 50 10 04 page 186 of 448 ...
Страница 231: ...Rev 1 50 10 04 page 211 of 448 Possible Exceptions Slot illegal instruction exception ...
Страница 235: ...Rev 1 50 10 04 page 215 of 448 Possible Exceptions Slot illegal instruction exception ...
Страница 238: ...Rev 1 50 10 04 page 218 of 448 Possible Exceptions Slot illegal instruction exception ...
Страница 408: ...Rev 1 50 10 04 page 388 of 448 Possible Exceptions Inexact Not generated when FPSCR PR 1 ...
Страница 445: ...Rev 1 50 10 04 page 425 of 448 Possible Exceptions Invalid operation Overflow Underflow Inexact ...
Страница 446: ...Rev 1 50 10 04 page 426 of 448 ...
Страница 468: ...Rev 1 50 10 04 page 448 of 448 ...
Страница 471: ......
Страница 472: ...SH 4A Software Manual ...