Update repo

This commit is contained in:
2026-08-30 23:04:35 -07:00
parent 749dab5721
commit ce65a0f59a
14950 changed files with 4408250 additions and 1 deletions
@@ -0,0 +1,161 @@
let Common = system.getScript("/driverlib/Common.js");
let Pinmux = system.getScript("/driverlib/pinmux.js");
//Object.getOwnPropertyNames(inst)
//Common.printDebugObject()
let longDescription = `For additional information regarding return types, look in the c2000ware_libraries.c file.
**NOTE:** Some return types are preceded by TWO underscores.
**NOTE:** Traditional here means truncated.
For details regarding the different types of division: [**Fast Integer Division Document**](https://www.ti.com/lit/an/spracn6/spracn6.pdf?ts=1648654973770&ref_url=https%253A%252F%252Fwww.google.com%252F)
CPU Cycles for FASTINTDIV:
Function | CPU Cycles
--- | ---
FID_COMP_I16_BY_I16_T | 16 cycles
FID_COMP_U16_BY_U16_T | 14 cycles
FID_COMP_I32_BY_I32_T | 13 cycles
FID_COMP_I32_BY_U32_T | 14 cycles
FID_COMP_U32_BY_U32_T | 12 cycles
FID_COMP_I64_BY_I64_T | 42 cycles
FID_COMP_I64_BY_U64_T | 42 cycles
FID_COMP_U64_BY_U64_T | 42 cycles
FID_COMP_I32_BY_I16_T | 18 cycles
FID_COMP_U32_BY_U16_T | 13 cycles
FID_COMP_I64_BY_I32_T | 27 cycles
FID_COMP_I64_BY_U32_T | 30 cycles
FID_COMP_U64_BY_U32_T | 26 cycles
FID_COMP_I16_BY_I16_M | 14 cycles
FID_COMP_I32_BY_I32_M | 14 cycles
FID_COMP_I32_BY_U32_M | 14 cycles
FID_COMP_I64_BY_I64_M | 42 cycles
FID_COMP_I64_BY_U64_M | 42 cycles
FID_COMP_I32_BY_I16_M | 16 cycles
FID_COMP_I64_BY_I32_M | 27 cycles
FID_COMP_I64_BY_U32_M | 29 cycles
FID_COMP_I16_BY_I16_E | 14 cycles
FID_COMP_I32_BY_I32_E | 14 cycles
FID_COMP_I64_BY_I64_E | 42 cycles
FID_COMP_I64_BY_U64_E | 42 cycles
FID_COMP_I32_BY_I16_E | 16 cycles
FID_COMP_I64_BY_I32_E | 29 cycles
FID_COMP_I64_BY_U32_E | 29 cycles
`
/*
FID_COMP_I64_BY_I32_T | 27 cycles
FID_COMP_I64_BY_U32_T | 30 cycles
FID_COMP_U64_BY_U32_T | 26 cycles
FID_COMP_I64_BY_I32_M | 27 cycles
FID_COMP_I64_BY_U32_M | 29 cycles
FID_COMP_I64_BY_I32_E | 29 cycles
FID_COMP_I64_BY_U32_E | 29 cycles
Numbers were obtained from repeated testing using functions in CCS; tested against given values for other functions,
and those matched the benchmarks, so the values obtained are very likely as accurate as my testing will be
*/
let FPU_TYPE;
if((Common.getDeviceName() == "F2838x") || (Common.getDeviceName() == "F28P65x"))
{
FPU_TYPE = [
{name: "FPU32", displayName: "FPU32"},
{name: "FPU64", displayName: "FPU64"}
];
}
else
{
FPU_TYPE = [
{name: "FPU32", displayName: "FPU32"}
];
}
let FID_TYPES = [
{name: "FID_COMP_I16_BY_I16_T", displayName: "Traditional: int16_t / int16_t"},
{name: "FID_COMP_U16_BY_U16_T", displayName: "Traditional: uint16_t / uint16_t"},
{name: "FID_COMP_I32_BY_I32_T", displayName: "Traditional: int32_t / int32_t"},
{name: "FID_COMP_I32_BY_U32_T", displayName: "Traditional: int32_t / uint32_t"},
{name: "FID_COMP_U32_BY_U32_T", displayName: "Traditional: uint32_t / uint32_t"},
{name: "FID_COMP_I64_BY_I64_T", displayName: "Traditional: int64_t / int64_t"},
{name: "FID_COMP_I64_BY_U64_T", displayName: "Traditional: int64_t / uint64_t"},
{name: "FID_COMP_U64_BY_U64_T", displayName: "Traditional: uint64_t / uint64_t"},
{name: "FID_COMP_I32_BY_I16_T", displayName: "Traditional: int32_t / int16_t"},
{name: "FID_COMP_U32_BY_U16_T", displayName: "Traditional: uint32_t / uint16_t"},
{name: "FID_COMP_I64_BY_I32_T", displayName: "Traditional: int64_t / int32_t"},
{name: "FID_COMP_I64_BY_U32_T", displayName: "Traditional: int64_t / uint32_t"},
{name: "FID_COMP_U64_BY_U32_T", displayName: "Traditional: uint64_t / uint32_t"},
{name: "FID_COMP_I16_BY_I16_M", displayName: "Modulo: int16_t % int16_t"},
{name: "FID_COMP_I32_BY_I32_M", displayName: "Modulo: int32_t % int32_t"},
{name: "FID_COMP_I32_BY_U32_M", displayName: "Modulo: int32_t % uint32_t"},
{name: "FID_COMP_I64_BY_I64_M", displayName: "Modulo: int64_t % int64_t"},
{name: "FID_COMP_I64_BY_U64_M", displayName: "Modulo: int64_t % uint64_t"},
{name: "FID_COMP_I32_BY_I16_M", displayName: "Modulo: int32_t % int16_t"},
{name: "FID_COMP_I64_BY_I32_M", displayName: "Modulo: int64_t % int32_t"},
{name: "FID_COMP_I64_BY_U32_M", displayName: "Modulo: int64_t % uint32_t"},
{name: "FID_COMP_I16_BY_I16_E", displayName: "Euclidean: int16_t / int16_t"},
{name: "FID_COMP_I32_BY_I32_E", displayName: "Euclidean: int32_t / int32_t"},
{name: "FID_COMP_I64_BY_I64_E", displayName: "Euclidean: int64_t / int64_t"},
{name: "FID_COMP_I64_BY_U64_E", displayName: "Euclidean: int64_t / uint64_t"},
{name: "FID_COMP_I32_BY_I16_E", displayName: "Euclidean: int32_t / int16_t"},
{name: "FID_COMP_I64_BY_I32_E", displayName: "Euclidean: int64_t / int32_t"},
{name: "FID_COMP_I64_BY_U32_E", displayName: "Euclidean: int64_t / uint32_t"},
]
let fid_configs = [];
var moduleStatic = {
name: "fpu",
displayName: "FPU/TMU Global Settings",
config: [],
modules: Common.autoForce("fpu", "/libraries/.meta/math/FPU/FPU.js")
}
for(let i = 0; i < FID_TYPES.length; i++)
{
fid_configs = fid_configs.concat([
{
name: "fid_" + i,
displayName : FID_TYPES[i].displayName,
default : FID_TYPES[i].name,
readOnly : true
},
])
}
let config = [
{
name: "fpuType",
displayName : "FPU Configuration",
default : FPU_TYPE[0].name,
getValue : (inst) => {
return system.modules["/libraries/math/FPU/FPU.js"].$static.fpuType;
}
},
{
name: "funcOps",
displayName : "Function Options",
config : fid_configs
}
];
function onValidate(inst, validation){}
function filterHardware(component)
{
return (Common.typeMatches(component.type, ["FASTINTDIV"]));
}
var fidModule = {
c2000wareLibraryName: "FID",
displayName: "FASTINTDIV",
defaultInstanceName: "myFID",
description: "Fast Integer Division",
longDescription: longDescription,
filterHardware : filterHardware,
maxInstances : 1,
config: config,
templates: {
c2000ware_libraries_h : "/libraries/math/FASTINTDIV/templates/fid.c2000ware_libraries.h.xdt",
c2000ware_libraries_opt : "/libraries/math/FASTINTDIV/templates/fid.c2000ware_libraries.opt.xdt",
},
moduleStatic: moduleStatic,
validate : onValidate
};
exports = fidModule;
@@ -0,0 +1,154 @@
#include <stdlib.h>
% var moduleName = "fastintdiv"
% let Common = system.getScript("/driverlib/Common.js");
% var module = system.modules['/libraries/math/FASTINTDIV' + '/' + moduleName + '.js'];
% var instance = module.$instances[0];
%
%if (module != null)
%{
//
// IMPORTANT NOTE: The standard is to use data types in the format as int32_t, but the structs
// as part of the stdlib.h file do not use these types, so their corresponding
// data types are used here.
//
// Return type is ldiv_t:
//
// typedef struct {
// int32_t quot;
// int32_t rem;
// } ldiv_t;
//
// Example:
// int32_t numerator = 2000000000;
// int32_t denominator = -500;
// ldiv_t result = FID_COMP_I16_BY_I16_T(numerator, denominator);
// int32_t quotient = result.quot;
// int32_t remainder = result.rem;
//
#define `instance.fid_0` __traditional_div_i16byi16
#define `instance.fid_2` __traditional_div_i32byi32
#define `instance.fid_3` __traditional_div_i32byu32
#define `instance.fid_8` __traditional_div_i32byi16
#define `instance.fid_13` __modulo_div_i16byi16
#define `instance.fid_14` __modulo_div_i32byi32
#define `instance.fid_15` __modulo_div_i32byu32
#define `instance.fid_18` __modulo_div_i32byi16
#define `instance.fid_21` __euclidean_div_i16byi16
#define `instance.fid_22` __euclidean_div_i32byi32
#define `instance.fid_25` __euclidean_div_i32byi16
//
// Return type is __uldiv_t:
//
// typedef struct {
// uint32_t quot;
// uint32_t rem;
// } __uldiv_t;
//
// Example:
// uint32_t numerator = 3000000000;
// uint32_t denominator = 50000000;
// __uldiv_t result = FID_COMP_U32_BY_U32_T(numerator, denominator);
// uint32_t quotient = result.quot;
// uint32_t remainder = result.rem;
//
#define `instance.fid_1` __traditional_div_u16byu16
#define `instance.fid_4` __traditional_div_u32byu32
#define `instance.fid_9` __traditional_div_u32byu16
//
// Return type is lldiv_t:
//
// typedef struct {
// int64_t quot;
// int64_t rem;
// } lldiv_t;
//
// Example:
// int64_t numerator = -2000000000000000000;
// int64_t denominator = 500000000;
// lldiv_t result = FID_COMP_I64_BY_I64_T(numerator, denominator);
// int64_t quotient = result.quot;
// int64_t remainder = result.rem;
//
#define `instance.fid_5` __traditional_div_i64byi64
#define `instance.fid_6` __traditional_div_i64byu64
#define `instance.fid_11` __traditional_div_i64byu32
#define `instance.fid_16` __modulo_div_i64byi64
#define `instance.fid_17` __modulo_div_i64byu64
#define `instance.fid_23` __euclidean_div_i64byi64
#define `instance.fid_24` __euclidean_div_i64byu64
//
// Return type is __ulldiv_t:
//
// typedef struct {
// uint64_t quot;
// uint64_t rem;
// } __ulldiv_t;
//
// Example:
// uint64_t numerator = 18000000000000000000;
// uint64_t denominator = 5000000000000;
// __ulldiv_t result = FID_COMP_U64_BY_U64_T(numerator, denominator);
// uint64_t quotient = result.quot;
// uint64_t remainder = result.rem;
//
#define `instance.fid_7` __traditional_div_u64byu64
//
// Return type is __llldiv_t:
//
// typedef struct {
// int64_t quot;
// int32_t rem;
// } __llldiv_t;
//
// Example:
// int64_t numerator = -2000000000000000000;
// int32_t denominator = -2000000000;
// __llldiv_t result = FID_COMP_I64_BY_I32_T(numerator, denominator);
// int64_t quotient = result.quot;
// int32_t remainder = result.rem;
//
#define `instance.fid_10` __traditional_div_i64byi32
#define `instance.fid_19` __modulo_div_i64byi32
#define `instance.fid_20` __modulo_div_i64byu32
#define `instance.fid_26` __euclidean_div_i64byi32
#define `instance.fid_27` __euclidean_div_i64byu32
//
// Return type is __ullldiv_t:
//
// typedef struct {
// uint64_t quot;
// uint32_t rem;
// } __ullldiv_t;
//
// Example:
// uint64_t numerator = 18000000000000000000;
// uint32_t denominator = 3000000000;
// __ullldiv_t result = FID_COMP_U64_BY_U32_T(numerator, denominator);
// uint64_t quotient = result.quot;
// uint32_t remainder = result.rem;
//
#define `instance.fid_12` __traditional_div_u64byu32
%}
%
@@ -0,0 +1 @@
--idiv_support=idiv0