Rev. 1.50, 10/04, page 408 of 448
10.3.19 FSCA (Floating Point Sine And Cosine Approximate): Floating-Point Instruction
PR
Format
Operation
Instruction Code
Cycle
T Bit
0
FSCA FPUL,DRn
sin(FPUL)
→
FRn
cos(FPUL)
→
FR[n+1]
1111nnn011111101
3 —
1 —
reserved
1111nnnn11111101
—
—
Description:
This instruction calculates the sine and cosine approximations of FPUL (absolute
error is within
±
2^–21) as single-precision floating point values, and places the values of the sine
and cosine in FRn and FR[n
+
1], respectively. Since this instruction is an approximate operation
instruction, an imprecision exception is always required (even if the input is a 0, the result is
imprecise).
When FPSCR.enable.I is set, an FPU exception trap is generated. When an exception occurs,
correct exception information is reflected in FPSCR.cause and FPSCR.flag, and FRn and FR[n
+
1] is not updated. Appropriate processing should therefore be performed by software.
Notes:
None
Operation:
void FSCA(int n){
float angle;
long offset = 0x00010000;
long fraction = 0x0000ffff;
case((FPSCR.PR){
0: clear_cause();
set_I();
/* extract sub-rotation (fraction) part */
fraction &= FPUL;
/* convert to float */
angle = fraction;
/* convert to radian */
angle = 2*M_PI*angle / offset;
FR[n] ~= sin(angle)
FR[n+1] ~= cos(angle)
pc += 2; break;
Summary of Contents for SuperH SH-4A
Page 2: ...Rev 1 50 10 04 page ii of xx ...
Page 8: ...Rev 1 50 10 04 page viii of xx ...
Page 116: ...Rev 1 50 10 04 page 96 of 448 ...
Page 178: ...Rev 1 50 10 04 page 158 of 448 ...
Page 206: ...Rev 1 50 10 04 page 186 of 448 ...
Page 231: ...Rev 1 50 10 04 page 211 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 235: ...Rev 1 50 10 04 page 215 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 238: ...Rev 1 50 10 04 page 218 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 408: ...Rev 1 50 10 04 page 388 of 448 Possible Exceptions Inexact Not generated when FPSCR PR 1 ...
Page 446: ...Rev 1 50 10 04 page 426 of 448 ...
Page 468: ...Rev 1 50 10 04 page 448 of 448 ...
Page 471: ......
Page 472: ...SH 4A Software Manual ...