こんにちは。NoMaYです。RXv3コア搭載の120MH動作のRXマイコンも、RX66T以降、RX671、RX66N、RX660と品種が増えてきましたが、RXv3コアのセールスポイントの1つであるレジスタ一括退避機能の使い方が今ひとつピンと来ません。そこで、いつものように、ちょっと好奇心からスレッドを立ててみました。(注: RX66Tは、160MHz動作、レジスタ一括退避機能未搭載、です。) いつものように、ぼちぼちと続きます。ホワイトペーパー卓越したMCU性能と電力効率を実現するRXv3コア2019年10月www.renesas.com/jp/ja/document/whp/introducing-rxv3-core-superior-performance-excellent-power-efficiency#page=6「割り込み応答時間の改善モータ制御システムなどは、高速な割り込み処理によるリアルタイム性能が必要となってきます。RXv3コアには、割り込み処理時にレジスタを高速退避/復帰するために、オプション機能として、レジスタ退避バンクと呼ばれる専用メモリを実装しています。図6に示すように、レジスタ退避バンクを使用することで割り込み応答時間を短縮でき、割り込み処理全体の時間を短縮することができます。 割り込み処理ルーチンの中で、SAVE命令を使用すると汎用レジスタとアキュムレータを1クロックで専用メモリに保存できます。RSTR命令は、保存されたレジスタを3~6cycleで復元します。レジスタ退避バンクは専用メモリを複数面持っており、多重割り込みにも対応することが可能です。図6.割り込み応答時間の改善レジスタ退避バンクは、割り込みハンドラだけでなく、RTOSコンテキスト切り替えにも使用できます。 RTOSコンテキスト切り替え時間は、レジスタバンク保存機能により最大20%高速化します。」
こんにちは。NoMaYです。RXスマートコンフィグレータの(というかFITの)BSPモジュールにも三角関数演算器を使用するソースがありますね。r_bsp/mcu/all/r_rx_intrinsic_functions.c
#ifdef BSP_MCU_TRIGONOMETRIC#ifdef __TFU/******************************************************************************** Function Name: R_BSP_InitTFU* Description : Initialize arithmetic unit for trigonometric functions.* Arguments : none* Return Value : none*******************************************************************************/R_BSP_PRAGMA_INLINE_ASM(R_BSP_InitTFU)void R_BSP_InitTFU(void){ R_BSP_ASM_BEGIN R_BSP_ASM( PUSH.L R1 ) R_BSP_ASM( MOV.L #81400H, R1 ) R_BSP_ASM( MOV.B #7, [R1] ) R_BSP_ASM( MOV.B #7, 1[R1] ) R_BSP_ASM( POP R1 ) R_BSP_ASM_END} /* End of function R_BSP_InitTFU() */#ifdef __FPU/******************************************************************************** Function Name: R_BSP_CalcSine_Cosine* Description : Uses the trigonometric function unit to calculate the sine and cosine of an angle at the same time* (single precision).* Arguments : f - Value in radians from which to calculate the sine and cosine* : sin - Address for storing the result of the sine operation* : cos - Address for storing the result of the cosine operation* Return Value : none*******************************************************************************/R_BSP_PRAGMA_INLINE_ASM(R_BSP_CalcSine_Cosine)void R_BSP_CalcSine_Cosine(float f, float *sin, float *cos){ R_BSP_ASM_BEGIN R_BSP_ASM( PUSH.L R4 ) R_BSP_ASM( MOV.L #81410H, R4 ) R_BSP_ASM( MOV.L R1, 4[R4] ) R_BSP_ASM( MOV.L 4[R4], [R2] ) R_BSP_ASM( MOV.L [R4], [R3] ) R_BSP_ASM( POP R4 ) R_BSP_ASM_END} /* End of function R_BSP_CalcSine_Cosine() *//******************************************************************************** Function Name: R_BSP_CalcAtan_SquareRoot* Description : Uses the trigonometric function unit to calculate the arc tangent of x and y and the square root of * the sum of squares of these values at the same time (single precision).* Arguments : y - Coordinate y (the numerator of the tangent)* x - Coordinate x (the denominator of the tangent)* atan2 - Address for storing the result of the arc tangent operation for y/x* hypot - Address for storing the result of the square root of the sum of squares of x and y* Return Value : none*******************************************************************************/R_BSP_PRAGMA_INLINE_ASM(R_BSP_CalcAtan_SquareRoot)void R_BSP_CalcAtan_SquareRoot(float y, float x, float *atan2, float *hypot){ R_BSP_ASM_BEGIN R_BSP_ASM( PUSHM R5-R6 ) R_BSP_ASM( MOV.L #81418H, R5 ) R_BSP_ASM( MOV.L R2, [R5] ) R_BSP_ASM( MOV.L R1, 4[R5] ) R_BSP_ASM( MOV.L 4[R5], [R3] ) R_BSP_ASM( MOV.L [R5], R6 ) R_BSP_ASM( FMUL #3F1B74EEH, R6 ) R_BSP_ASM( MOV.L R6, [R4] ) R_BSP_ASM( POPM R5-R6 ) R_BSP_ASM_END} /* End of function R_BSP_CalcAtan_SquareRoot() */#endif /* __FPU */#endif /* __TFU */#endif /* BSP_MCU_TRIGONOMETRIC */