78K, RL78 using HW multiply division units

Technical Note 44885

Targets:
78K, RL78

Component:
General

Updated:
1/28/2015 10:02 AM

Introduction

Some RL78 and 78K microcontrollers have a hardware multiplier/divider unit. To include runtime support for this unit, proceed as follows.

IAR Embedded Workbench for RL78 version 2.10 and newer

In the IDE, uncheck the "Disable Hardware Multiplier/Divider Unit" option on the
Project Options>General Options>Library Configuration page. If the currently selected RL78 device does not have a hardware multiplier/divider unit, this option will not be available.

If you are building your project from the command line, you need to include the assembler file hwmdu_LibReplacement.s , which is located in the src\hw_multiply_division_units directory.

IAR Embedded Workbench for 78K or RL78 version 1.40 and older

In the IDE, select the "Use Hardware Multiplier/Divider Unit" option on the
Project Options>General Options>Library Configuration page. If the currently selected RL78 device does not have a hardware multiplier/divider unit, this option will not be available.

If you are building your project from the command line, you need to include the assembler file hwmdu_LibReplacement.snn or hwmuldiv_LibReplacement.snn , which is located in the src\<lib>\hw_multiply_division_units directory.

General

If you are not sure which kind of hardware multiplier/divider your device is equipped with, look into the device file (.menu) located in the config\devices directory. The entry <muldiv> in this XML file will have one of these values:

mul+div+mac = Has a HW multiplier, divider and MAC unit
mul+div = Has a HW multiplier and divider
mul = Has a HW multiplier
none = No support

You also need to use a linker option as follows to have these routines replacing the original library functions:

RL78 examples (version 2.10 and newer):

--redirect ?I_MUL_L02=HWMUL_16_16_16
--redirect ?L_MUL_L03=HWMUL_32_32_32
--redirect ?UC_DIV_L01=HWDIV_8_8_8
--redirect ?UI_DIV_L02=HWDIV_16_16_16
--redirect ?UL_DIV_L03=HWDIV_32_32_32
--redirect ?UC_MOD_L01=HWMOD_8_8_8
--redirect ?UI_MOD_L02=HWMOD_16_16_16
--redirect ?UL_MOD_L03=HWMOD_32_32_32
--redirect ?SC_DIV_L01=HWSDIV_8_8_8
--redirect ?SI_DIV_L02=HWSDIV_16_16_16
--redirect ?SL_DIV_L03=HWSDIV_32_32_32
--redirect ?SC_MOD_L01=HWSMOD_8_8_8
--redirect ?SI_MOD_L02=HWSMOD_16_16_16
--redirect ?SL_MOD_L03=HWSMOD_32_32_32

RL78 examples (version 1.40 and older):

-eHWDIV_8_8_8=?UC_DIV_L01
-eHWDIV_16_16_16=?UI_DIV_L02
-eHWDIV_32_32_32=?UL_DIV_L03
-eHWMUL_16_16_16=?I_MUL_L02
-eHWMUL_32_32_32=?L_MUL_L03
-eHWSDIV_8_8_8=?SC_DIV_L01
-eHWSDIV_16_16_16=?SI_DIV_L02
-eHWSDIV_32_32_32=?SL_DIV_L03

78K0R/K0/K0S examples:

-eHWMUL_16_16_16=?I_MUL_L02
-eHWMUL_32_32_32=?L_MUL_L03
-eHWDIV_8_8_8=?UC_DIV_L01
-eHWDIV_16_16_16=?UI_DIV_L02
-eHWDIV_32_32_32=?UL_DIV_L03
-eHWSDIV_8_8_8=?SC_DIV_L01
-eHWSDIV_16_16_16=?SI_DIV_L02
-eHWSDIV_32_32_32=?SL_DIV_L03

Note

The above lists are not complete. Each list can be a different list in each IAR Embedded Workbench release.

It is also described in the hwmuldiv_LibReplacement.snn or hwmdu_LibReplacement.s source file , which library function a certain assembler routine is replacing.

 

All product names are trademarks or registered trademarks of their respective owners.

Related Tech Notes

© IAR Systems 1995-2016 - All rights reserved.