Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
@@ -0,0 +1,101 @@
|
||||
MEMORY
|
||||
{
|
||||
BEGIN : origin = 0x00000000, length = 0x00000002
|
||||
BOOT_RSVD : origin = 0x00000002, length = 0x00000126
|
||||
|
||||
RAMM0 : origin = 0x00000128, length = 0x000002D8
|
||||
RAMM1 : origin = 0x00000400, length = 0x00000380 /* on-chip RAM block M1 */
|
||||
BOOT_RSVD_SYSBIOS: origin = 0x00000780, length = 0x00000080
|
||||
|
||||
RAMLS : origin = 0x00008000, length = 0x00003FF8
|
||||
//RAMLS1 : origin = 0x0000A000, length = 0x00001FF8
|
||||
RAMLS1_RSVD : origin = 0x0000BFF8, length = 0x00000008
|
||||
|
||||
RESET : origin = 0x003FFFC0, length = 0x00000002
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH_BANK0_SEC_0_7 : origin = 0x080002, length = 0x1FFE /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_8_15 : origin = 0x082000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_16_23 : origin = 0x084000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_24 : origin = 0x086000, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_25 : origin = 0x086400, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_26 : origin = 0x086800, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_27 : origin = 0x086C00, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_28 : origin = 0x087000, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_29 : origin = 0x087400, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_30 : origin = 0x087800, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_31 : origin = 0x087C00, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_32 : origin = 0x088080, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_33 : origin = 0x088480, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_34 : origin = 0x088880, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_35 : origin = 0x088C80, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_36 : origin = 0x089080, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_37 : origin = 0x089480, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_38 : origin = 0x089880, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_39 : origin = 0x089C80, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_40_47 : origin = 0x08A000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_48_55 : origin = 0x08C000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_56_63 : origin = 0x08E000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_64_71 : origin = 0x090000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_72_79 : origin = 0x092000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_80_87 : origin = 0x094000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_88 : origin = 0x096000, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_89 : origin = 0x096400, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_90 : origin = 0x096800, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_91 : origin = 0x096C00, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_92 : origin = 0x097000, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_93 : origin = 0x097400, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_94 : origin = 0x097800, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_95 : origin = 0x097C00, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_96 : origin = 0x098080, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_97 : origin = 0x098480, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_98 : origin = 0x098880, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_99 : origin = 0x098C80, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_100 : origin = 0x099080, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_101 : origin = 0x099480, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_102 : origin = 0x099880, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_103 : origin = 0x099C80, length = 0x0380 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_104_111 : origin = 0x09A000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_112_119 : origin = 0x09C000, length = 0x2000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC_120_127 : origin = 0x09E000, length = 0x1FF0 /* on-chip Flash */
|
||||
|
||||
FLASH_BANK0_SEC_127_RSVD : origin = 0x0A0FF0, length = 0x0010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
}
|
||||
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN
|
||||
.TI.ramfunc : > RAMM0
|
||||
.text : >> RAMLS
|
||||
.cinit : > RAMM0
|
||||
.switch : > RAMM0
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.bss : > RAMLS
|
||||
.bss:output : > RAMLS
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS
|
||||
.data : > RAMLS
|
||||
.sysmem : > RAMLS
|
||||
.bss:cio : > RAMLS
|
||||
#else
|
||||
.pinit : > RAMM0
|
||||
.ebss : > RAMLS
|
||||
.econst : > RAMLS
|
||||
.esysmem : > RAMLS
|
||||
.cio : > RAMLS
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMLS
|
||||
ramgs1 : > RAMLS
|
||||
|
||||
/* Allocate IQ math areas: */
|
||||
IQmath : > RAMLS
|
||||
IQmathTables : > RAMLS
|
||||
FpuRegsFile : > RAMLS
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
MEMORY
|
||||
{
|
||||
BOOT_RSVD : origin = 0x00000000, length = 0x00000050
|
||||
RAMM0 : origin = 0x00000050, length = 0x000003B0
|
||||
|
||||
RAMLS4567 : origin = 0x0000A000, length = 0x00002000
|
||||
|
||||
RESET : origin = 0x003FFFC0, length = 0x00000002
|
||||
|
||||
FLASHBANK1 : origin = 0x00080000, length = 0x00010000
|
||||
BOOTROM : origin = 0x003F0000, length = 0x00008000
|
||||
BOOTROM_EXT : origin = 0x003F8000, length = 0x00007FC0
|
||||
|
||||
|
||||
RAMM1 : origin = 0x00000400, length = 0x00000380 /* on-chip RAM block M1 */
|
||||
BOOT_RSVD_SYSBIOS: origin = 0x00000780, length = 0x00000080
|
||||
RAMGS0 : origin = 0x0000C000, length = 0x00000800
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 15009000
|
||||
.TI.ramfunc : {} > RAMM0
|
||||
#else
|
||||
ramfuncs : > RAMM0
|
||||
#endif
|
||||
#endif
|
||||
.text : >> RAMM0 | RAMM1 | RAMLS4567 | RAMGS0
|
||||
.cinit : > RAMLS4567
|
||||
.switch : > RAMM0
|
||||
// .reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
#if defined(__TI_EABI__)
|
||||
.bss : > RAMM0
|
||||
.bss:output : > RAMLS4567
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS4567
|
||||
.data : > RAMLS4567
|
||||
.sysmem : > RAMLS4567
|
||||
#else
|
||||
.pinit : > RAMM0
|
||||
.ebss : >> RAMLS4567
|
||||
.econst : > RAMLS4567
|
||||
.esysmem : > RAMLS4567
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0
|
||||
ramgs1 : > RAMGS0
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
MEMORY
|
||||
{
|
||||
BEGIN : origin = 0x00080000, length = 0x00000002
|
||||
BOOT_RSVD : origin = 0x00000002, length = 0x00000126
|
||||
|
||||
RAMM0 : origin = 0x00000128, length = 0x000002D8
|
||||
RAMM1 : origin = 0x00000400, length = 0x00000380 /* on-chip RAM block M1 */
|
||||
BOOT_RSVD_SYSBIOS: origin = 0x00000780, length = 0x00000080
|
||||
|
||||
RAMLS0 : origin = 0x00008000, length = 0x00000800
|
||||
RAMLS1 : origin = 0x00008800, length = 0x00000800
|
||||
RAMLS2 : origin = 0x00009000, length = 0x00000800
|
||||
RAMLS3 : origin = 0x00009800, length = 0x00000800
|
||||
RAMLS4 : origin = 0x0000A000, length = 0x00000800
|
||||
RAMLS5 : origin = 0x0000A800, length = 0x00000800
|
||||
RAMLS6 : origin = 0x0000B000, length = 0x00000800
|
||||
RAMLS7 : origin = 0x0000B800, length = 0x00000800
|
||||
|
||||
RAMGS0 : origin = 0x0000C000, length = 0x00001000
|
||||
RAMGS1 : origin = 0x0000D000, length = 0x00001000
|
||||
RAMGS2 : origin = 0x0000E000, length = 0x00001000
|
||||
RAMGS3 : origin = 0x0000F000, length = 0x00001000
|
||||
|
||||
BOOTROM : origin = 0x003F8000, length = 0x00007FC0
|
||||
SECURE_ROM : origin = 0x003F2000, length = 0x00006000
|
||||
|
||||
RESET : origin = 0x003FFFC0, length = 0x00000002
|
||||
|
||||
/* Flash sectors */
|
||||
/* BANK 0 */
|
||||
FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE
|
||||
FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000
|
||||
FLASH_BANK0_SEC2 : origin = 0x082000, length = 0x001000
|
||||
FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000
|
||||
FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000
|
||||
FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000
|
||||
FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000
|
||||
FLASH_BANK0_SEC7 : origin = 0x087000, length = 0x001000
|
||||
FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000
|
||||
FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000
|
||||
FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000
|
||||
FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000
|
||||
FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000
|
||||
FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000
|
||||
FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000
|
||||
FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000
|
||||
|
||||
/* BANK 1 */
|
||||
FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000
|
||||
FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000
|
||||
FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000
|
||||
FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000
|
||||
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000
|
||||
FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000
|
||||
FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000
|
||||
FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000
|
||||
FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000
|
||||
FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000
|
||||
FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000
|
||||
FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000
|
||||
FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000
|
||||
FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000
|
||||
FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000
|
||||
FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x001000
|
||||
|
||||
/* BANK 2 */
|
||||
FLASH_BANK2_SEC0 : origin = 0x0A0000, length = 0x001000
|
||||
FLASH_BANK2_SEC1 : origin = 0x0A1000, length = 0x001000
|
||||
FLASH_BANK2_SEC2 : origin = 0x0A2000, length = 0x001000
|
||||
FLASH_BANK2_SEC3 : origin = 0x0A3000, length = 0x001000
|
||||
FLASH_BANK2_SEC4 : origin = 0x0A4000, length = 0x001000
|
||||
FLASH_BANK2_SEC5 : origin = 0x0A5000, length = 0x001000
|
||||
FLASH_BANK2_SEC6 : origin = 0x0A6000, length = 0x001000
|
||||
FLASH_BANK2_SEC7 : origin = 0x0A7000, length = 0x001000
|
||||
FLASH_BANK2_SEC8 : origin = 0x0A8000, length = 0x001000
|
||||
FLASH_BANK2_SEC9 : origin = 0x0A9000, length = 0x001000
|
||||
FLASH_BANK2_SEC10 : origin = 0x0AA000, length = 0x001000
|
||||
FLASH_BANK2_SEC11 : origin = 0x0AB000, length = 0x001000
|
||||
FLASH_BANK2_SEC12 : origin = 0x0AC000, length = 0x001000
|
||||
FLASH_BANK2_SEC13 : origin = 0x0AD000, length = 0x001000
|
||||
FLASH_BANK2_SEC14 : origin = 0x0AE000, length = 0x001000
|
||||
FLASH_BANK2_SEC15 : origin = 0x0AF000, length = 0x001000
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, ALIGN(8)
|
||||
.text : >> FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4, ALIGN(8)
|
||||
.cinit : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
.switch : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.init_array : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.bss:cio : > RAMLS0
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
.const : > FLASH_BANK0_SEC4, ALIGN(8)
|
||||
#else
|
||||
.pinit : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
.ebss : > RAMLS5
|
||||
.esysmem : > RAMLS5
|
||||
.cio : > RAMLS0
|
||||
.econst : > FLASH_BANK0_SEC4, ALIGN(8)
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0
|
||||
ramgs1 : > RAMGS0
|
||||
|
||||
/* Allocate IQ math areas: */
|
||||
IQmath : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
IQmathTables : > FLASH_BANK0_SEC2, ALIGN(8)
|
||||
|
||||
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(8)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
MEMORY
|
||||
{
|
||||
BEGIN : origin = 0x00000000, length = 0x00000002
|
||||
BOOT_RSVD : origin = 0x00000002, length = 0x00000126
|
||||
|
||||
RAMM0 : origin = 0x00000128, length = 0x000002D8
|
||||
RAMM1 : origin = 0x00000400, length = 0x00000380 /* on-chip RAM block M1 */
|
||||
BOOT_RSVD_SYSBIOS: origin = 0x00000780, length = 0x00000080
|
||||
|
||||
|
||||
RAMLS0 : origin = 0x00008000, length = 0x00000800
|
||||
RAMLS1 : origin = 0x00008800, length = 0x00000800
|
||||
RAMLS2 : origin = 0x00009000, length = 0x00000800
|
||||
RAMLS3 : origin = 0x00009800, length = 0x00000800
|
||||
RAMLS4 : origin = 0x0000A000, length = 0x00000800
|
||||
RAMLS5 : origin = 0x0000A800, length = 0x00000800
|
||||
RAMLS6 : origin = 0x0000B000, length = 0x00000800
|
||||
RAMLS7 : origin = 0x0000B800, length = 0x00000800
|
||||
|
||||
RAMGS0 : origin = 0x0000C000, length = 0x00001000
|
||||
RAMGS1 : origin = 0x0000D000, length = 0x00001000
|
||||
RAMGS2 : origin = 0x0000E000, length = 0x00001000
|
||||
RAMGS3 : origin = 0x0000F000, length = 0x00001000
|
||||
|
||||
BOOTROM : origin = 0x003F8000, length = 0x00007FC0
|
||||
SECURE_ROM : origin = 0x003F2000, length = 0x00006000
|
||||
|
||||
|
||||
RESET : origin = 0x003FFFC0, length = 0x00000002
|
||||
|
||||
/* Flash sectors */
|
||||
/* BANK 0 */
|
||||
FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE
|
||||
FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000
|
||||
FLASH_BANK0_SEC2 : origin = 0x082000, length = 0x001000
|
||||
FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000
|
||||
FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000
|
||||
FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000
|
||||
FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000
|
||||
FLASH_BANK0_SEC7 : origin = 0x087000, length = 0x001000
|
||||
FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000
|
||||
FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000
|
||||
FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000
|
||||
FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000
|
||||
FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000
|
||||
FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000
|
||||
FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000
|
||||
FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000
|
||||
|
||||
/* BANK 1 */
|
||||
FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000
|
||||
FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000
|
||||
FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000
|
||||
FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000
|
||||
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000
|
||||
FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000
|
||||
FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000
|
||||
FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000
|
||||
FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000
|
||||
FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000
|
||||
FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000
|
||||
FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000
|
||||
FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000
|
||||
FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000
|
||||
FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000
|
||||
FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x001000
|
||||
|
||||
/* BANK 2 */
|
||||
FLASH_BANK2_SEC0 : origin = 0x0A0000, length = 0x001000
|
||||
FLASH_BANK2_SEC1 : origin = 0x0A1000, length = 0x001000
|
||||
FLASH_BANK2_SEC2 : origin = 0x0A2000, length = 0x001000
|
||||
FLASH_BANK2_SEC3 : origin = 0x0A3000, length = 0x001000
|
||||
FLASH_BANK2_SEC4 : origin = 0x0A4000, length = 0x001000
|
||||
FLASH_BANK2_SEC5 : origin = 0x0A5000, length = 0x001000
|
||||
FLASH_BANK2_SEC6 : origin = 0x0A6000, length = 0x001000
|
||||
FLASH_BANK2_SEC7 : origin = 0x0A7000, length = 0x001000
|
||||
FLASH_BANK2_SEC8 : origin = 0x0A8000, length = 0x001000
|
||||
FLASH_BANK2_SEC9 : origin = 0x0A9000, length = 0x001000
|
||||
FLASH_BANK2_SEC10 : origin = 0x0AA000, length = 0x001000
|
||||
FLASH_BANK2_SEC11 : origin = 0x0AB000, length = 0x001000
|
||||
FLASH_BANK2_SEC12 : origin = 0x0AC000, length = 0x001000
|
||||
FLASH_BANK2_SEC13 : origin = 0x0AD000, length = 0x001000
|
||||
FLASH_BANK2_SEC14 : origin = 0x0AE000, length = 0x001000
|
||||
FLASH_BANK2_SEC15 : origin = 0x0AF000, length = 0x001000
|
||||
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN
|
||||
.TI.ramfunc : > RAMM0
|
||||
.text : >> RAMGS0 | RAMGS1
|
||||
.cinit : > RAMM0
|
||||
.switch : > RAMM0
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS5
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
.bss:cio : > RAMLS0
|
||||
#else
|
||||
.pinit : > RAMM0
|
||||
.ebss : > RAMLS5
|
||||
.econst : > RAMLS5
|
||||
.esysmem : > RAMLS5
|
||||
.cio : > RAMLS0
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0
|
||||
ramgs1 : > RAMGS1
|
||||
|
||||
/* Allocate IQ math areas: */
|
||||
IQmath : > RAMLS4
|
||||
IQmathTables : > RAMLS4
|
||||
FpuRegsFile : > RAMGS2
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AE /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B0, length = 0x000250
|
||||
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x001000
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
|
||||
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, ALIGN(4)
|
||||
.text : >> FLASH1 | FLASH2 | FLASH3 | FLASH4, ALIGN(4)
|
||||
.cinit : > FLASH1, ALIGN(4)
|
||||
.switch : > FLASH1, ALIGN(4)
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
.stack : > RAMM1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.init_array : > FLASH1, ALIGN(4)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.bss:cio : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH5, ALIGN(4)
|
||||
#else
|
||||
.pinit : > FLASH1, ALIGN(4)
|
||||
.ebss : > RAMLS5
|
||||
.esysmem : > RAMLS5
|
||||
.cio : > RAMLS5
|
||||
/* Initalized sections go in Flash */
|
||||
.econst : >> FLASH4 | FLASH5, ALIGN(4)
|
||||
#endif
|
||||
|
||||
|
||||
MSGRAM_CPU1_TO_CPU2 : > CPU1TOCPU2RAM
|
||||
MSGRAM_CPU2_TO_CPU1 : > CPU2TOCPU1RAM
|
||||
MSGRAM_CPU_TO_CM : > CPUTOCMRAM
|
||||
MSGRAM_CM_TO_CPU : > CMTOCPURAM
|
||||
|
||||
/* The following section definition are for SDFM examples */
|
||||
Filter_RegsFile : > RAMGS0
|
||||
Filter1_RegsFile : > RAMGS1, fill=0x1111
|
||||
Filter2_RegsFile : > RAMGS2, fill=0x2222
|
||||
Filter3_RegsFile : > RAMGS3, fill=0x3333
|
||||
Filter4_RegsFile : > RAMGS4, fill=0x4444
|
||||
Difference_RegsFile : >RAMGS5, fill=0x3333
|
||||
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 15009000
|
||||
#if defined(__TI_EABI__)
|
||||
.TI.ramfunc : {} LOAD = FLASH3,
|
||||
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(4)
|
||||
#else
|
||||
.TI.ramfunc : {} LOAD = FLASH3,
|
||||
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
|
||||
LOAD_START(_RamfuncsLoadStart),
|
||||
LOAD_SIZE(_RamfuncsLoadSize),
|
||||
LOAD_END(_RamfuncsLoadEnd),
|
||||
RUN_START(_RamfuncsRunStart),
|
||||
RUN_SIZE(_RamfuncsRunSize),
|
||||
RUN_END(_RamfuncsRunEnd),
|
||||
ALIGN(4)
|
||||
#endif
|
||||
#else
|
||||
ramfuncs : LOAD = FLASH3,
|
||||
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(4)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,115 @@
|
||||
MEMORY
|
||||
{
|
||||
/* BEGIN is used for the "boot to SARAM" bootloader mode */
|
||||
BEGIN : origin = 0x000000, length = 0x000002
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AE /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B0, length = 0x000250
|
||||
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0_LS1 : origin = 0x008000, length = 0x001000
|
||||
//RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x001000
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN
|
||||
.text : >> RAMD0 | RAMD1 | RAMLS0_LS1 | RAMLS2 | RAMLS3
|
||||
.cinit : > RAMM0
|
||||
.switch : > RAMM0
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
#if defined(__TI_EABI__)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS4
|
||||
#else
|
||||
.pinit : > RAMM0
|
||||
.ebss : >> RAMLS5 | RAMLS6
|
||||
.econst : > RAMLS5
|
||||
.esysmem : > RAMLS5
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0
|
||||
ramgs1 : > RAMGS1
|
||||
|
||||
MSGRAM_CPU1_TO_CPU2 > CPU1TOCPU2RAM
|
||||
MSGRAM_CPU2_TO_CPU1 > CPU2TOCPU1RAM
|
||||
MSGRAM_CPU_TO_CM > CPUTOCMRAM
|
||||
MSGRAM_CM_TO_CPU > CMTOCPURAM
|
||||
|
||||
/* The following section definition are for SDFM examples */
|
||||
Filter_RegsFile : > RAMGS0
|
||||
Filter1_RegsFile : > RAMGS1, fill=0x1111
|
||||
Filter2_RegsFile : > RAMGS2, fill=0x2222
|
||||
Filter3_RegsFile : > RAMGS3, fill=0x3333
|
||||
Filter4_RegsFile : > RAMGS4, fill=0x4444
|
||||
Difference_RegsFile : >RAMGS5, fill=0x3333
|
||||
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 15009000
|
||||
.TI.ramfunc : {} > RAMM0
|
||||
#else
|
||||
ramfuncs : > RAMM0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
Binary file not shown.
+24
@@ -0,0 +1,24 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="fastintdiv_example"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --idiv_support=idiv0 --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f28002x/driverlib/" scope="project" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28002x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28002x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28002x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28002x/common/targetConfigs/TMS320F280025C.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../cmd/28002x_RAM_lnk.cmd" targetDirectory="" applicableConfigurations="RAM" />
|
||||
<file action="copy" path="../../../../../../../driverlib/f28002x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28002x/common/source/f28002x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../../driverlib/f28002x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../fastintdiv_example.c" targetDirectory="" />
|
||||
<file action="copy" path="../fastintdiv_example.h" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,641 @@
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file fastintdiv_example.c
|
||||
//!
|
||||
//! \brief Performs various types of fast Division using FASTINTDIV Intrinsics
|
||||
//! \date Feb 14, 2019
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: TMS320f28002xx
|
||||
//
|
||||
// The following example showcases how various FASTINTDIV intrinsics can be used
|
||||
// to perform various types of division in the fastest way possible. The
|
||||
// example tests each of the 21 intrinsics by providing two sets of input data
|
||||
// and compares the quotient and remainder with the expect value. If both the
|
||||
// values match the pass counter is incremented for every intrinsic test. If
|
||||
// all the intrinsics give correct value then the value of "pass_count" should
|
||||
// be 21 at the end of the code and value of "success" will be 1.
|
||||
//
|
||||
// Add following watch variables to expressions window
|
||||
// -: pass_count
|
||||
// -: success
|
||||
//
|
||||
// Number of software cycles required for each integer division intrinsic including
|
||||
// cycles for output value assignment are indicated below
|
||||
//
|
||||
// 16-bit by 16-bit
|
||||
// __traditional_div_i16byi16() or int/int -> 16 cycles
|
||||
// __euclidean_div_i16byi16() -> 14 cycles
|
||||
// __modulo_div_i16byi16() -> 14 cycles
|
||||
// __traditional_div_u16byu16() or uint16_t/uint16_t -> 14 cycles
|
||||
//
|
||||
// 32-bit by 32-bit
|
||||
// __traditional_div_i32byi32() or long/long -> 13 cycles
|
||||
// __euclidean_div_i32byi32() -> 14 cycles
|
||||
// __modulo_div_i32byi32() -> 14 cycles
|
||||
// __traditional_div_i32byu32() or long/unsigned long -> 14 cycles
|
||||
// __modulo_div_i32byu32() -> 14 cycles
|
||||
// __traditional_div_u32byu32() or unsigned long/unsigned long -> 12 cycles
|
||||
//
|
||||
// 32-bit by 16-bit
|
||||
// __traditional_div_i32byi16() or long/int -> 18 cycles
|
||||
// __euclidean_div_i32byi16() -> 16 cycles
|
||||
// __modulo_div_i32byi16() -> 16 cycles
|
||||
// __traditional_div_u32byu16() or unsigned long/uint16_t -> 13 cycles
|
||||
//
|
||||
// 64-bit by 64-bit
|
||||
// __traditional_div_i64byi64() or long long/long long -> 42 cycles
|
||||
// __euclidean_div_i64byi64() -> 42 cycles
|
||||
// __modulo_div_i64byi64() -> 42 cycles
|
||||
// __traditional_div_i64byu64() or long long/unsigned long long -> 42 cycles
|
||||
// __euclidean_div_i64byu64() -> 42 cycles
|
||||
// __modulo_div_i64byu64() -> 42 cycles
|
||||
// __traditional_div_u64byu64() or unsigned long long/unsigned long long -> 42 cycles
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include <stdlib.h>
|
||||
#include "fastintdiv_example.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
|
||||
// 16-bit by 16-bit
|
||||
uint16_t test_traditional_div_i16byi16();
|
||||
uint16_t test_euclidean_div_i16byi16();
|
||||
uint16_t test_modulo_div_i16byi16();
|
||||
uint16_t test_traditional_div_u16byu16();
|
||||
|
||||
// 32-bit by 32-bit
|
||||
uint16_t test_traditional_div_i32byi32();
|
||||
uint16_t test_euclidean_div_i32byi32();
|
||||
uint16_t test_modulo_div_i32byi32();
|
||||
uint16_t test_traditional_div_i32byu32();
|
||||
uint16_t test_modulo_div_i32byu32();
|
||||
uint16_t test_traditional_div_u32byu32();
|
||||
|
||||
|
||||
// 32-bit by 16-bit
|
||||
uint16_t test_traditional_div_i32byi16();
|
||||
uint16_t test_euclidean_div_i32byi16();
|
||||
uint16_t test_modulo_div_i32byi16();
|
||||
uint16_t test_traditional_div_u32byu16();
|
||||
|
||||
// 64-bit by 64-bit
|
||||
uint16_t test_traditional_div_i64byi64();
|
||||
uint16_t test_euclidean_div_i64byi64();
|
||||
uint16_t test_modulo_div_i64byi64();
|
||||
uint16_t test_traditional_div_i64byu64();
|
||||
uint16_t test_euclidean_div_i64byu64();
|
||||
uint16_t test_modulo_div_i64byu64();
|
||||
uint16_t test_euclidean_div_i64byi64();
|
||||
uint16_t test_traditional_div_u64byu64();
|
||||
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t pass_count = 0, success = 0;
|
||||
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
|
||||
//
|
||||
// Calling routines for testing the fast division intrinsics
|
||||
// and updating pass counter value
|
||||
//
|
||||
|
||||
// 16-bit by 16-bit
|
||||
pass_count += test_traditional_div_i16byi16();
|
||||
pass_count += test_euclidean_div_i16byi16();
|
||||
pass_count += test_modulo_div_i16byi16();
|
||||
pass_count += test_traditional_div_u16byu16();
|
||||
|
||||
// 32-bit by 32-bit
|
||||
pass_count += test_traditional_div_i32byi32();
|
||||
pass_count += test_euclidean_div_i32byi32();
|
||||
pass_count += test_modulo_div_i32byi32();
|
||||
pass_count += test_traditional_div_i32byu32();
|
||||
pass_count += test_modulo_div_i32byu32();
|
||||
pass_count += test_traditional_div_u32byu32();
|
||||
|
||||
|
||||
// 32-bit by 16-bit
|
||||
pass_count += test_traditional_div_i32byi16();
|
||||
pass_count += test_euclidean_div_i32byi16();
|
||||
pass_count += test_modulo_div_i32byi16();
|
||||
pass_count += test_traditional_div_u32byu16();
|
||||
|
||||
// 64-bit by 64-bit
|
||||
pass_count += test_traditional_div_i64byi64();
|
||||
pass_count += test_euclidean_div_i64byi64();
|
||||
pass_count += test_modulo_div_i64byi64();
|
||||
pass_count += test_traditional_div_i64byu64();
|
||||
pass_count += test_euclidean_div_i64byu64();
|
||||
pass_count += test_modulo_div_i64byu64();
|
||||
pass_count += test_traditional_div_u64byu64();
|
||||
|
||||
//
|
||||
// Updating the "success" variable based on pass counter
|
||||
//
|
||||
if (pass_count == 21)
|
||||
success = 1;
|
||||
else
|
||||
success = 0;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i16/i16
|
||||
//
|
||||
uint16_t test_traditional_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-25,-12}, data2 = {2477,-23,-107,16};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i16/i16
|
||||
//
|
||||
uint16_t test_euclidean_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-26,8}, data2 = {2477,-23,-107,16};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i16byi16(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i16byi16(data2.dividend, data2.divisor);
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i16/i16
|
||||
//
|
||||
uint16_t test_modulo_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-26,8}, data2 = {2477,-23,-108,-7};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i16byi16(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i16byi16(data2.dividend, data2.divisor);
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u16/u16
|
||||
//
|
||||
uint16_t test_traditional_div_u16byu16()
|
||||
{
|
||||
parameters_div_u16byu16 data1 = {512,20,25,12}, data2 = {2477,23,107,16};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/i32
|
||||
//
|
||||
uint16_t test_traditional_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-77,-74},data2 = {10414,-83,-125,39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i32/i32
|
||||
//
|
||||
uint16_t test_euclidean_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-78,172}, data2 = {10414,-83,-125,39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i32byi32(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i32byi32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/i32
|
||||
//
|
||||
uint16_t test_modulo_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-78,172}, data2 = {10414,-83,-126,-44};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byi32(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byi32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/u32
|
||||
//
|
||||
uint16_t test_traditional_div_i32byu32()
|
||||
{
|
||||
parameters_div_i32byu32 data1 = {-19016,246,-77,-74}, data2 = {-10414,83,-125,-39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __traditional_div_i32byu32(data1.dividend, data1.divisor);
|
||||
result2 = __traditional_div_i32byu32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/u32
|
||||
//
|
||||
uint16_t test_modulo_div_i32byu32()
|
||||
{
|
||||
parameters_div_i32byu32 data1 = {-19016,246,-78,172}, data2 = {-10414,83,-126,44};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byu32(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byu32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u32/u32
|
||||
//
|
||||
uint16_t test_traditional_div_u32byu32()
|
||||
{
|
||||
parameters_div_u32byu32 data1 = {19016,246,77,74}, data2 = {10414,83,125,39};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/i16
|
||||
//
|
||||
uint16_t test_traditional_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-950,-16}, data2 = {10414,-23,-452,18};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i32/i16
|
||||
//
|
||||
uint16_t test_euclidean_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-951,4}, data2 = {10414,-23,-452,18};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i32byi16(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i32byi16(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/i16
|
||||
//
|
||||
uint16_t test_modulo_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-951,4}, data2 = {10414,-23,-453,-5};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byi16(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byi16(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u32/u16
|
||||
//
|
||||
uint16_t test_traditional_div_u32byu16()
|
||||
{
|
||||
parameters_div_u32byu16 data1 = {19016,20,950,16}, data2 = {10414,23,452,18};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i64/i64
|
||||
//
|
||||
uint16_t test_traditional_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2497,-204}, data2 = {5949371,-3471,-1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i64/i64
|
||||
//
|
||||
uint16_t test_euclidean_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,-3471,-1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i64byi64(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i64byi64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i64/i64
|
||||
//
|
||||
uint16_t test_modulo_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,-3471,-1715,-3394};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i64byi64(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i64byi64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i64/u64
|
||||
//
|
||||
uint16_t test_traditional_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2497,-204}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __traditional_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __traditional_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i64/u64
|
||||
//
|
||||
uint16_t test_euclidean_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i64/u64
|
||||
//
|
||||
uint16_t test_modulo_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u64/u64
|
||||
//
|
||||
uint16_t test_traditional_div_u64byu64()
|
||||
{
|
||||
parameters_div_u64byu64 data1 = {3218837,1289,2497,204}, data2 = {5949371,3471,1714,77};
|
||||
__ulldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file fastintdiv_example.h
|
||||
//!
|
||||
//! \brief Header file for fast integer division example
|
||||
//! \date Feb 14, 2019
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: TMS320f28002x
|
||||
//
|
||||
// The header file defines various types of user-defined data types used for
|
||||
// storing input data passed to various forms of division tests
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#ifndef FASTINTDIV_EXAMPLE_H_
|
||||
#define FASTINTDIV_EXAMPLE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t dividend; int16_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i16byi16;
|
||||
|
||||
typedef struct {
|
||||
uint16_t dividend; uint16_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u16byu16;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; int32_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byi32;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; uint32_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byu32;
|
||||
|
||||
typedef struct {
|
||||
uint32_t dividend; uint32_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u32byu32;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; int16_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byi16;
|
||||
|
||||
typedef struct {
|
||||
uint32_t dividend; uint16_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u32byu16;
|
||||
|
||||
typedef struct {
|
||||
int64_t dividend; int64_t divisor; int64_t quotient; int64_t remainder;
|
||||
} parameters_div_i64byi64;
|
||||
|
||||
typedef struct {
|
||||
int64_t dividend; uint64_t divisor; int64_t quotient; int64_t remainder;
|
||||
} parameters_div_i64byu64;
|
||||
|
||||
typedef struct {
|
||||
uint64_t dividend; uint64_t divisor; uint64_t quotient; uint64_t remainder;
|
||||
} parameters_div_u64byu64;
|
||||
|
||||
#endif /* FASTINTDIV_EXAMPLE_H_ */
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="fastintdiv_example"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --idiv_support=idiv0 --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f28003x/driverlib/" scope="project" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28003x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28003x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28003x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28003x/common/targetConfigs/TMS320F280039C.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../cmd/28003x_RAM_lnk.cmd" targetDirectory="" applicableConfigurations="RAM" />
|
||||
<file action="copy" path="../../../../../../../driverlib/f28003x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../../device_support/f28003x/common/source/f28003x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../../driverlib/f28003x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../fastintdiv_example.c" targetDirectory="" />
|
||||
<file action="copy" path="../fastintdiv_example.h" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,641 @@
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file fastintdiv_example.c
|
||||
//!
|
||||
//! \brief Performs various types of fast Division using FASTINTDIV Intrinsics
|
||||
//! \date Feb 14, 2019
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: TMS320f28002xx
|
||||
//
|
||||
// The following example showcases how various FASTINTDIV intrinsics can be used
|
||||
// to perform various types of division in the fastest way possible. The
|
||||
// example tests each of the 21 intrinsics by providing two sets of input data
|
||||
// and compares the quotient and remainder with the expect value. If both the
|
||||
// values match the pass counter is incremented for every intrinsic test. If
|
||||
// all the intrinsics give correct value then the value of "pass_count" should
|
||||
// be 21 at the end of the code and value of "success" will be 1.
|
||||
//
|
||||
// Add following watch variables to expressions window
|
||||
// -: pass_count
|
||||
// -: success
|
||||
//
|
||||
// Number of software cycles required for each integer division intrinsic including
|
||||
// cycles for output value assignment are indicated below
|
||||
//
|
||||
// 16-bit by 16-bit
|
||||
// __traditional_div_i16byi16() or int/int -> 16 cycles
|
||||
// __euclidean_div_i16byi16() -> 14 cycles
|
||||
// __modulo_div_i16byi16() -> 14 cycles
|
||||
// __traditional_div_u16byu16() or uint16_t/uint16_t -> 14 cycles
|
||||
//
|
||||
// 32-bit by 32-bit
|
||||
// __traditional_div_i32byi32() or long/long -> 13 cycles
|
||||
// __euclidean_div_i32byi32() -> 14 cycles
|
||||
// __modulo_div_i32byi32() -> 14 cycles
|
||||
// __traditional_div_i32byu32() or long/unsigned long -> 14 cycles
|
||||
// __modulo_div_i32byu32() -> 14 cycles
|
||||
// __traditional_div_u32byu32() or unsigned long/unsigned long -> 12 cycles
|
||||
//
|
||||
// 32-bit by 16-bit
|
||||
// __traditional_div_i32byi16() or long/int -> 18 cycles
|
||||
// __euclidean_div_i32byi16() -> 16 cycles
|
||||
// __modulo_div_i32byi16() -> 16 cycles
|
||||
// __traditional_div_u32byu16() or unsigned long/uint16_t -> 13 cycles
|
||||
//
|
||||
// 64-bit by 64-bit
|
||||
// __traditional_div_i64byi64() or long long/long long -> 42 cycles
|
||||
// __euclidean_div_i64byi64() -> 42 cycles
|
||||
// __modulo_div_i64byi64() -> 42 cycles
|
||||
// __traditional_div_i64byu64() or long long/unsigned long long -> 42 cycles
|
||||
// __euclidean_div_i64byu64() -> 42 cycles
|
||||
// __modulo_div_i64byu64() -> 42 cycles
|
||||
// __traditional_div_u64byu64() or unsigned long long/unsigned long long -> 42 cycles
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include <stdlib.h>
|
||||
#include "fastintdiv_example.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
|
||||
// 16-bit by 16-bit
|
||||
uint16_t test_traditional_div_i16byi16();
|
||||
uint16_t test_euclidean_div_i16byi16();
|
||||
uint16_t test_modulo_div_i16byi16();
|
||||
uint16_t test_traditional_div_u16byu16();
|
||||
|
||||
// 32-bit by 32-bit
|
||||
uint16_t test_traditional_div_i32byi32();
|
||||
uint16_t test_euclidean_div_i32byi32();
|
||||
uint16_t test_modulo_div_i32byi32();
|
||||
uint16_t test_traditional_div_i32byu32();
|
||||
uint16_t test_modulo_div_i32byu32();
|
||||
uint16_t test_traditional_div_u32byu32();
|
||||
|
||||
|
||||
// 32-bit by 16-bit
|
||||
uint16_t test_traditional_div_i32byi16();
|
||||
uint16_t test_euclidean_div_i32byi16();
|
||||
uint16_t test_modulo_div_i32byi16();
|
||||
uint16_t test_traditional_div_u32byu16();
|
||||
|
||||
// 64-bit by 64-bit
|
||||
uint16_t test_traditional_div_i64byi64();
|
||||
uint16_t test_euclidean_div_i64byi64();
|
||||
uint16_t test_modulo_div_i64byi64();
|
||||
uint16_t test_traditional_div_i64byu64();
|
||||
uint16_t test_euclidean_div_i64byu64();
|
||||
uint16_t test_modulo_div_i64byu64();
|
||||
uint16_t test_euclidean_div_i64byi64();
|
||||
uint16_t test_traditional_div_u64byu64();
|
||||
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t pass_count = 0, success = 0;
|
||||
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
|
||||
//
|
||||
// Calling routines for testing the fast division intrinsics
|
||||
// and updating pass counter value
|
||||
//
|
||||
|
||||
// 16-bit by 16-bit
|
||||
pass_count += test_traditional_div_i16byi16();
|
||||
pass_count += test_euclidean_div_i16byi16();
|
||||
pass_count += test_modulo_div_i16byi16();
|
||||
pass_count += test_traditional_div_u16byu16();
|
||||
|
||||
// 32-bit by 32-bit
|
||||
pass_count += test_traditional_div_i32byi32();
|
||||
pass_count += test_euclidean_div_i32byi32();
|
||||
pass_count += test_modulo_div_i32byi32();
|
||||
pass_count += test_traditional_div_i32byu32();
|
||||
pass_count += test_modulo_div_i32byu32();
|
||||
pass_count += test_traditional_div_u32byu32();
|
||||
|
||||
|
||||
// 32-bit by 16-bit
|
||||
pass_count += test_traditional_div_i32byi16();
|
||||
pass_count += test_euclidean_div_i32byi16();
|
||||
pass_count += test_modulo_div_i32byi16();
|
||||
pass_count += test_traditional_div_u32byu16();
|
||||
|
||||
// 64-bit by 64-bit
|
||||
pass_count += test_traditional_div_i64byi64();
|
||||
pass_count += test_euclidean_div_i64byi64();
|
||||
pass_count += test_modulo_div_i64byi64();
|
||||
pass_count += test_traditional_div_i64byu64();
|
||||
pass_count += test_euclidean_div_i64byu64();
|
||||
pass_count += test_modulo_div_i64byu64();
|
||||
pass_count += test_traditional_div_u64byu64();
|
||||
|
||||
//
|
||||
// Updating the "success" variable based on pass counter
|
||||
//
|
||||
if (pass_count == 21)
|
||||
success = 1;
|
||||
else
|
||||
success = 0;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i16/i16
|
||||
//
|
||||
uint16_t test_traditional_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-25,-12}, data2 = {2477,-23,-107,16};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i16/i16
|
||||
//
|
||||
uint16_t test_euclidean_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-26,8}, data2 = {2477,-23,-107,16};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i16byi16(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i16byi16(data2.dividend, data2.divisor);
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i16/i16
|
||||
//
|
||||
uint16_t test_modulo_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-26,8}, data2 = {2477,-23,-108,-7};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i16byi16(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i16byi16(data2.dividend, data2.divisor);
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u16/u16
|
||||
//
|
||||
uint16_t test_traditional_div_u16byu16()
|
||||
{
|
||||
parameters_div_u16byu16 data1 = {512,20,25,12}, data2 = {2477,23,107,16};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/i32
|
||||
//
|
||||
uint16_t test_traditional_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-77,-74},data2 = {10414,-83,-125,39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i32/i32
|
||||
//
|
||||
uint16_t test_euclidean_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-78,172}, data2 = {10414,-83,-125,39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i32byi32(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i32byi32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/i32
|
||||
//
|
||||
uint16_t test_modulo_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-78,172}, data2 = {10414,-83,-126,-44};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byi32(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byi32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/u32
|
||||
//
|
||||
uint16_t test_traditional_div_i32byu32()
|
||||
{
|
||||
parameters_div_i32byu32 data1 = {-19016,246,-77,-74}, data2 = {-10414,83,-125,-39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __traditional_div_i32byu32(data1.dividend, data1.divisor);
|
||||
result2 = __traditional_div_i32byu32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/u32
|
||||
//
|
||||
uint16_t test_modulo_div_i32byu32()
|
||||
{
|
||||
parameters_div_i32byu32 data1 = {-19016,246,-78,172}, data2 = {-10414,83,-126,44};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byu32(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byu32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u32/u32
|
||||
//
|
||||
uint16_t test_traditional_div_u32byu32()
|
||||
{
|
||||
parameters_div_u32byu32 data1 = {19016,246,77,74}, data2 = {10414,83,125,39};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/i16
|
||||
//
|
||||
uint16_t test_traditional_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-950,-16}, data2 = {10414,-23,-452,18};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i32/i16
|
||||
//
|
||||
uint16_t test_euclidean_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-951,4}, data2 = {10414,-23,-452,18};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i32byi16(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i32byi16(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/i16
|
||||
//
|
||||
uint16_t test_modulo_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-951,4}, data2 = {10414,-23,-453,-5};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byi16(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byi16(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u32/u16
|
||||
//
|
||||
uint16_t test_traditional_div_u32byu16()
|
||||
{
|
||||
parameters_div_u32byu16 data1 = {19016,20,950,16}, data2 = {10414,23,452,18};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i64/i64
|
||||
//
|
||||
uint16_t test_traditional_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2497,-204}, data2 = {5949371,-3471,-1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i64/i64
|
||||
//
|
||||
uint16_t test_euclidean_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,-3471,-1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i64byi64(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i64byi64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i64/i64
|
||||
//
|
||||
uint16_t test_modulo_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,-3471,-1715,-3394};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i64byi64(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i64byi64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i64/u64
|
||||
//
|
||||
uint16_t test_traditional_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2497,-204}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __traditional_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __traditional_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i64/u64
|
||||
//
|
||||
uint16_t test_euclidean_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i64/u64
|
||||
//
|
||||
uint16_t test_modulo_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u64/u64
|
||||
//
|
||||
uint16_t test_traditional_div_u64byu64()
|
||||
{
|
||||
parameters_div_u64byu64 data1 = {3218837,1289,2497,204}, data2 = {5949371,3471,1714,77};
|
||||
__ulldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file fastintdiv_example.h
|
||||
//!
|
||||
//! \brief Header file for fast integer division example
|
||||
//! \date Feb 14, 2019
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: TMS320f28002x
|
||||
//
|
||||
// The header file defines various types of user-defined data types used for
|
||||
// storing input data passed to various forms of division tests
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#ifndef FASTINTDIV_EXAMPLE_H_
|
||||
#define FASTINTDIV_EXAMPLE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t dividend; int16_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i16byi16;
|
||||
|
||||
typedef struct {
|
||||
uint16_t dividend; uint16_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u16byu16;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; int32_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byi32;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; uint32_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byu32;
|
||||
|
||||
typedef struct {
|
||||
uint32_t dividend; uint32_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u32byu32;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; int16_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byi16;
|
||||
|
||||
typedef struct {
|
||||
uint32_t dividend; uint16_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u32byu16;
|
||||
|
||||
typedef struct {
|
||||
int64_t dividend; int64_t divisor; int64_t quotient; int64_t remainder;
|
||||
} parameters_div_i64byi64;
|
||||
|
||||
typedef struct {
|
||||
int64_t dividend; uint64_t divisor; int64_t quotient; int64_t remainder;
|
||||
} parameters_div_i64byu64;
|
||||
|
||||
typedef struct {
|
||||
uint64_t dividend; uint64_t divisor; uint64_t quotient; uint64_t remainder;
|
||||
} parameters_div_u64byu64;
|
||||
|
||||
#endif /* FASTINTDIV_EXAMPLE_H_ */
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="fastintdiv_example"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcu2 --idiv_support=idiv0 --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcu2 --idiv_support=idiv0 --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<file action="copy" path="../../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../fastintdiv_example.c" targetDirectory="" />
|
||||
<file action="copy" path="../fastintdiv_example.h" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,641 @@
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file fastintdiv_example.c
|
||||
//!
|
||||
//! \brief Performs various types of fast Division using FASTINTDIV Intrinsics
|
||||
//! \date Feb 14, 2019
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: TMS320f2838x
|
||||
//
|
||||
// The following example showcases how various FASTINTDIV intrinsics can be used
|
||||
// to perform various types of division in the fastest way possible. The
|
||||
// example tests each of the 21 intrinsics by providing two sets of input data
|
||||
// and compares the quotient and remainder with the expect value. If both the
|
||||
// values match the pass counter is incremented for every intrinsic test. If
|
||||
// all the intrinsics give correct value then the value of "pass_count" should
|
||||
// be 21 at the end of the code and value of "success" will be 1.
|
||||
//
|
||||
// Add following watch variables to expressions window
|
||||
// -: pass_count
|
||||
// -: success
|
||||
//
|
||||
// Number of software cycles required for each integer division intrinsic including
|
||||
// cycles for output value assignment are indicated below
|
||||
//
|
||||
// 16-bit by 16-bit
|
||||
// __traditional_div_i16byi16() or int/int -> 16 cycles
|
||||
// __euclidean_div_i16byi16() -> 14 cycles
|
||||
// __modulo_div_i16byi16() -> 14 cycles
|
||||
// __traditional_div_u16byu16() or uint16_t/uint16_t -> 14 cycles
|
||||
//
|
||||
// 32-bit by 32-bit
|
||||
// __traditional_div_i32byi32() or long/long -> 13 cycles
|
||||
// __euclidean_div_i32byi32() -> 14 cycles
|
||||
// __modulo_div_i32byi32() -> 14 cycles
|
||||
// __traditional_div_i32byu32() or long/unsigned long -> 14 cycles
|
||||
// __modulo_div_i32byu32() -> 14 cycles
|
||||
// __traditional_div_u32byu32() or unsigned long/unsigned long -> 12 cycles
|
||||
//
|
||||
// 32-bit by 16-bit
|
||||
// __traditional_div_i32byi16() or long/int -> 18 cycles
|
||||
// __euclidean_div_i32byi16() -> 16 cycles
|
||||
// __modulo_div_i32byi16() -> 16 cycles
|
||||
// __traditional_div_u32byu16() or unsigned long/uint16_t -> 13 cycles
|
||||
//
|
||||
// 64-bit by 64-bit
|
||||
// __traditional_div_i64byi64() or long long/long long -> 42 cycles
|
||||
// __euclidean_div_i64byi64() -> 42 cycles
|
||||
// __modulo_div_i64byi64() -> 42 cycles
|
||||
// __traditional_div_i64byu64() or long long/unsigned long long -> 42 cycles
|
||||
// __euclidean_div_i64byu64() -> 42 cycles
|
||||
// __modulo_div_i64byu64() -> 42 cycles
|
||||
// __traditional_div_u64byu64() or unsigned long long/unsigned long long -> 42 cycles
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include <stdlib.h>
|
||||
#include "fastintdiv_example.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
|
||||
// 16-bit by 16-bit
|
||||
uint16_t test_traditional_div_i16byi16();
|
||||
uint16_t test_euclidean_div_i16byi16();
|
||||
uint16_t test_modulo_div_i16byi16();
|
||||
uint16_t test_traditional_div_u16byu16();
|
||||
|
||||
// 32-bit by 32-bit
|
||||
uint16_t test_traditional_div_i32byi32();
|
||||
uint16_t test_euclidean_div_i32byi32();
|
||||
uint16_t test_modulo_div_i32byi32();
|
||||
uint16_t test_traditional_div_i32byu32();
|
||||
uint16_t test_modulo_div_i32byu32();
|
||||
uint16_t test_traditional_div_u32byu32();
|
||||
|
||||
|
||||
// 32-bit by 16-bit
|
||||
uint16_t test_traditional_div_i32byi16();
|
||||
uint16_t test_euclidean_div_i32byi16();
|
||||
uint16_t test_modulo_div_i32byi16();
|
||||
uint16_t test_traditional_div_u32byu16();
|
||||
|
||||
// 64-bit by 64-bit
|
||||
uint16_t test_traditional_div_i64byi64();
|
||||
uint16_t test_euclidean_div_i64byi64();
|
||||
uint16_t test_modulo_div_i64byi64();
|
||||
uint16_t test_traditional_div_i64byu64();
|
||||
uint16_t test_euclidean_div_i64byu64();
|
||||
uint16_t test_modulo_div_i64byu64();
|
||||
uint16_t test_euclidean_div_i64byi64();
|
||||
uint16_t test_traditional_div_u64byu64();
|
||||
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t pass_count = 0, success = 0;
|
||||
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
|
||||
//
|
||||
// Calling routines for testing the fast division intrinsics
|
||||
// and updating pass counter value
|
||||
//
|
||||
|
||||
// 16-bit by 16-bit
|
||||
pass_count += test_traditional_div_i16byi16();
|
||||
pass_count += test_euclidean_div_i16byi16();
|
||||
pass_count += test_modulo_div_i16byi16();
|
||||
pass_count += test_traditional_div_u16byu16();
|
||||
|
||||
// 32-bit by 32-bit
|
||||
pass_count += test_traditional_div_i32byi32();
|
||||
pass_count += test_euclidean_div_i32byi32();
|
||||
pass_count += test_modulo_div_i32byi32();
|
||||
pass_count += test_traditional_div_i32byu32();
|
||||
pass_count += test_modulo_div_i32byu32();
|
||||
pass_count += test_traditional_div_u32byu32();
|
||||
|
||||
|
||||
// 32-bit by 16-bit
|
||||
pass_count += test_traditional_div_i32byi16();
|
||||
pass_count += test_euclidean_div_i32byi16();
|
||||
pass_count += test_modulo_div_i32byi16();
|
||||
pass_count += test_traditional_div_u32byu16();
|
||||
|
||||
// 64-bit by 64-bit
|
||||
pass_count += test_traditional_div_i64byi64();
|
||||
pass_count += test_euclidean_div_i64byi64();
|
||||
pass_count += test_modulo_div_i64byi64();
|
||||
pass_count += test_traditional_div_i64byu64();
|
||||
pass_count += test_euclidean_div_i64byu64();
|
||||
pass_count += test_modulo_div_i64byu64();
|
||||
pass_count += test_traditional_div_u64byu64();
|
||||
|
||||
//
|
||||
// Updating the "success" variable based on pass counter
|
||||
//
|
||||
if (pass_count == 21)
|
||||
success = 1;
|
||||
else
|
||||
success = 0;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i16/i16
|
||||
//
|
||||
uint16_t test_traditional_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-25,-12}, data2 = {2477,-23,-107,16};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i16/i16
|
||||
//
|
||||
uint16_t test_euclidean_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-26,8}, data2 = {2477,-23,-107,16};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i16byi16(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i16byi16(data2.dividend, data2.divisor);
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i16/i16
|
||||
//
|
||||
uint16_t test_modulo_div_i16byi16()
|
||||
{
|
||||
parameters_div_i16byi16 data1 = {-512,20,-26,8}, data2 = {2477,-23,-108,-7};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i16byi16(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i16byi16(data2.dividend, data2.divisor);
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u16/u16
|
||||
//
|
||||
uint16_t test_traditional_div_u16byu16()
|
||||
{
|
||||
parameters_div_u16byu16 data1 = {512,20,25,12}, data2 = {2477,23,107,16};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/i32
|
||||
//
|
||||
uint16_t test_traditional_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-77,-74},data2 = {10414,-83,-125,39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i32/i32
|
||||
//
|
||||
uint16_t test_euclidean_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-78,172}, data2 = {10414,-83,-125,39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i32byi32(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i32byi32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/i32
|
||||
//
|
||||
uint16_t test_modulo_div_i32byi32()
|
||||
{
|
||||
parameters_div_i32byi32 data1 = {-19016,246,-78,172}, data2 = {10414,-83,-126,-44};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byi32(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byi32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/u32
|
||||
//
|
||||
uint16_t test_traditional_div_i32byu32()
|
||||
{
|
||||
parameters_div_i32byu32 data1 = {-19016,246,-77,-74}, data2 = {-10414,83,-125,-39};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __traditional_div_i32byu32(data1.dividend, data1.divisor);
|
||||
result2 = __traditional_div_i32byu32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/u32
|
||||
//
|
||||
uint16_t test_modulo_div_i32byu32()
|
||||
{
|
||||
parameters_div_i32byu32 data1 = {-19016,246,-78,172}, data2 = {-10414,83,-126,44};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byu32(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byu32(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u32/u32
|
||||
//
|
||||
uint16_t test_traditional_div_u32byu32()
|
||||
{
|
||||
parameters_div_u32byu32 data1 = {19016,246,77,74}, data2 = {10414,83,125,39};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i32/i16
|
||||
//
|
||||
uint16_t test_traditional_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-950,-16}, data2 = {10414,-23,-452,18};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i32/i16
|
||||
//
|
||||
uint16_t test_euclidean_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-951,4}, data2 = {10414,-23,-452,18};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i32byi16(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i32byi16(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i32/i16
|
||||
//
|
||||
uint16_t test_modulo_div_i32byi16()
|
||||
{
|
||||
parameters_div_i32byi16 data1 = {-19016,20,-951,4}, data2 = {10414,-23,-453,-5};
|
||||
ldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i32byi16(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i32byi16(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u32/u16
|
||||
//
|
||||
uint16_t test_traditional_div_u32byu16()
|
||||
{
|
||||
parameters_div_u32byu16 data1 = {19016,20,950,16}, data2 = {10414,23,452,18};
|
||||
__uldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i64/i64
|
||||
//
|
||||
uint16_t test_traditional_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2497,-204}, data2 = {5949371,-3471,-1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i64/i64
|
||||
//
|
||||
uint16_t test_euclidean_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,-3471,-1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i64byi64(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i64byi64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i64/i64
|
||||
//
|
||||
uint16_t test_modulo_div_i64byi64()
|
||||
{
|
||||
parameters_div_i64byi64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,-3471,-1715,-3394};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i64byi64(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i64byi64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional i64/u64
|
||||
//
|
||||
uint16_t test_traditional_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2497,-204}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __traditional_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __traditional_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing euclidean i64/u64
|
||||
//
|
||||
uint16_t test_euclidean_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __euclidean_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __euclidean_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing modulo i64/u64
|
||||
//
|
||||
uint16_t test_modulo_div_i64byu64()
|
||||
{
|
||||
parameters_div_i64byu64 data1 = {-3218837,1289,-2498,1085}, data2 = {5949371,3471,1714,77};
|
||||
lldiv_t result1,result2;
|
||||
|
||||
result1 = __modulo_div_i64byu64(data1.dividend, data1.divisor);
|
||||
result2 = __modulo_div_i64byu64(data2.dividend, data2.divisor);
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Routine for testing traditional u64/u64
|
||||
//
|
||||
uint16_t test_traditional_div_u64byu64()
|
||||
{
|
||||
parameters_div_u64byu64 data1 = {3218837,1289,2497,204}, data2 = {5949371,3471,1714,77};
|
||||
__ulldiv_t result1,result2;
|
||||
|
||||
result1.quot = data1.dividend / data1.divisor;
|
||||
result1.rem = data1.dividend % data1.divisor;
|
||||
result2.quot = data2.dividend / data2.divisor;
|
||||
result2.rem = data2.dividend % data2.divisor;
|
||||
|
||||
if ((result1.quot == data1.quotient) && (result1.rem == data1.remainder) &&
|
||||
(result2.quot == data2.quotient) && (result2.rem = data2.remainder))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
//#############################################################################
|
||||
//
|
||||
//! \file fastintdiv_example.h
|
||||
//!
|
||||
//! \brief Header file for fast integer division example
|
||||
//! \date Feb 14, 2019
|
||||
//
|
||||
// Group: C2000
|
||||
// Target Device: TMS320f2838x
|
||||
//
|
||||
// The header file defines various types of user-defined data types used for
|
||||
// storing input data passed to various forms of division tests
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#ifndef FASTINTDIV_EXAMPLE_H_
|
||||
#define FASTINTDIV_EXAMPLE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t dividend; int16_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i16byi16;
|
||||
|
||||
typedef struct {
|
||||
uint16_t dividend; uint16_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u16byu16;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; int32_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byi32;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; uint32_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byu32;
|
||||
|
||||
typedef struct {
|
||||
uint32_t dividend; uint32_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u32byu32;
|
||||
|
||||
typedef struct {
|
||||
int32_t dividend; int16_t divisor; int32_t quotient; int32_t remainder;
|
||||
} parameters_div_i32byi16;
|
||||
|
||||
typedef struct {
|
||||
uint32_t dividend; uint16_t divisor; uint32_t quotient; uint32_t remainder;
|
||||
} parameters_div_u32byu16;
|
||||
|
||||
typedef struct {
|
||||
int64_t dividend; int64_t divisor; int64_t quotient; int64_t remainder;
|
||||
} parameters_div_i64byi64;
|
||||
|
||||
typedef struct {
|
||||
int64_t dividend; uint64_t divisor; int64_t quotient; int64_t remainder;
|
||||
} parameters_div_i64byu64;
|
||||
|
||||
typedef struct {
|
||||
uint64_t dividend; uint64_t divisor; uint64_t quotient; uint64_t remainder;
|
||||
} parameters_div_u64byu64;
|
||||
|
||||
#endif /* FASTINTDIV_EXAMPLE_H_ */
|
||||
Reference in new issue
Block a user