From e4add180442d9016090a61ff4429d1539840d8d6 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Mon, 17 Feb 2025 14:45:05 +0000 Subject: [PATCH] smoke tests might be due to lack of mp testing --- developer/python/template_N.py | 334 ++++++++++++------------- tester/python/template_test_N32.py | 290 ++++++++++----------- "tester/tool\360\237\226\211/makefile" | 2 +- 3 files changed, 313 insertions(+), 313 deletions(-) diff --git a/developer/python/template_N.py b/developer/python/template_N.py index 45a4b9e..dc90aaa 100644 --- a/developer/python/template_N.py +++ b/developer/python/template_N.py @@ -4,7 +4,7 @@ def N(namespace: str ,digit_type: str ,digit_extent: int ,constants_block: str) """ template = template_N() code = template.format( - NAMESPACE = namespace + NS = namespace ,DIGIT_TYPE = digit_type ,DIGIT_EXTENT = digit_extent ,CONSTANTS_BLOCK = constants_block @@ -37,18 +37,18 @@ def template_N(): */ -#define {NAMESPACE}·DEBUG +#define {NS}·DEBUG #ifndef FACE -#define {NAMESPACE}·IMPLEMENTATION +#define {NS}·IMPLEMENTATION #define FACE #endif //-------------------------------------------------------------------------------- // Interface -#ifndef {NAMESPACE}·FACE -#define {NAMESPACE}·FACE +#ifndef {NS}·FACE +#define {NS}·FACE #include #include @@ -61,81 +61,81 @@ def template_N(): typedef uint32_t Extent; typedef uint32_t Digit; - typedef struct {NAMESPACE}·T {NAMESPACE}·T; + typedef struct {NS}·T {NS}·T; - extern {NAMESPACE}·T *{NAMESPACE}·zero; - extern {NAMESPACE}·T *{NAMESPACE}·one; - extern {NAMESPACE}·T *{NAMESPACE}·all_one_bit; - extern {NAMESPACE}·T *{NAMESPACE}·lsb; - extern {NAMESPACE}·T *{NAMESPACE}·msb; + extern {NS}·T *{NS}·zero; + extern {NS}·T *{NS}·one; + extern {NS}·T *{NS}·all_one_bit; + extern {NS}·T *{NS}·lsb; + extern {NS}·T *{NS}·msb; //---------------------------------------- // Return/Error Status and handlers typedef enum{{ - {NAMESPACE}·Status·ok = 0 - ,{NAMESPACE}·Status·overflow = 1 - ,{NAMESPACE}·Status·accumulator1_overflow = 2 - ,{NAMESPACE}·Status·carry = 3 - ,{NAMESPACE}·Status·borrow = 4 - ,{NAMESPACE}·Status·undefined_divide_by_zero = 5 - ,{NAMESPACE}·Status·undefined_modulus_zero = 6 - ,{NAMESPACE}·Status·gt_max_shift_count = 7 - ,{NAMESPACE}·Status·spill_eq_operand = 8 // not currently signaled, result will be spill value - ,{NAMESPACE}·Status·one_word_product = 9 - ,{NAMESPACE}·Status·two_word_product = 10 - }} {NAMESPACE}·Status; + {NS}·Status·ok = 0 + ,{NS}·Status·overflow = 1 + ,{NS}·Status·accumulator1_overflow = 2 + ,{NS}·Status·carry = 3 + ,{NS}·Status·borrow = 4 + ,{NS}·Status·undefined_divide_by_zero = 5 + ,{NS}·Status·undefined_modulus_zero = 6 + ,{NS}·Status·gt_max_shift_count = 7 + ,{NS}·Status·spill_eq_operand = 8 // not currently signaled, result will be spill value + ,{NS}·Status·one_word_product = 9 + ,{NS}·Status·two_word_product = 10 + }} {NS}·Status; typedef enum{{ - {NAMESPACE}·Order_lt = -1 - ,{NAMESPACE}·Order_eq = 0 - ,{NAMESPACE}·Order_gt = 1 - }} {NAMESPACE}·Order; + {NS}·Order_lt = -1 + ,{NS}·Order_eq = 0 + ,{NS}·Order_gt = 1 + }} {NS}·Order; - typedef {NAMESPACE}·T *( *{NAMESPACE}·Allocate_MemoryFault )(Extent); + typedef {NS}·T *( *{NS}·Allocate_MemoryFault )(Extent); //---------------------------------------- // Interface typedef struct{{ - {NAMESPACE}·T *(*allocate_array_zero)(Extent, {NAMESPACE}·Allocate_MemoryFault); - {NAMESPACE}·T *(*allocate_array)(Extent, {NAMESPACE}·Allocate_MemoryFault); - void (*deallocate)({NAMESPACE}·T*); - - void (*copy)({NAMESPACE}·T*, {NAMESPACE}·T*); - void (*bit_and)({NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - void (*bit_or)({NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - void (*bit_complement)({NAMESPACE}·T*, {NAMESPACE}·T*); - void (*bit_twos_complement)({NAMESPACE}·T*, {NAMESPACE}·T*); - {NAMESPACE}·Order (*compare)({NAMESPACE}·T*, {NAMESPACE}·T*); - bool (*lt)({NAMESPACE}·T*, {NAMESPACE}·T*); - bool (*gt)({NAMESPACE}·T*, {NAMESPACE}·T*); - bool (*eq)({NAMESPACE}·T*, {NAMESPACE}·T*); - bool (*eq_zero)({NAMESPACE}·T*); - {NAMESPACE}·Status (*accumulate)({NAMESPACE}·T *accumulator1 ,{NAMESPACE}·T *accumulator0 ,...); - {NAMESPACE}·Status (*add)({NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - bool (*increment)({NAMESPACE}·T *a); - {NAMESPACE}·Status (*subtract)({NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - {NAMESPACE}·Status (*multiply)({NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - {NAMESPACE}·Status (*divide)({NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - {NAMESPACE}·Status (*modulus)({NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - {NAMESPACE}·Status (*shift_left)(Extent, {NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - {NAMESPACE}·Status (*shift_right)(Extent, {NAMESPACE}·T*, {NAMESPACE}·T*, {NAMESPACE}·T*); - {NAMESPACE}·Status (*arithmetic_shift_right)(Extent, {NAMESPACE}·T*, {NAMESPACE}·T*); - - {NAMESPACE}·T* (*access)({NAMESPACE}·T*, Extent); - void (*from_uint32)({NAMESPACE}·T *destination ,uint32_t value); - }} {NAMESPACE}·Λ; - - Local const {NAMESPACE}·Λ {NAMESPACE}·λ; // initialized in the LOCAL section + {NS}·T *(*allocate_array_zero)(Extent, {NS}·Allocate_MemoryFault); + {NS}·T *(*allocate_array)(Extent, {NS}·Allocate_MemoryFault); + void (*deallocate)({NS}·T*); + + void (*copy)({NS}·T*, {NS}·T*); + void (*bit_and)({NS}·T*, {NS}·T*, {NS}·T*); + void (*bit_or)({NS}·T*, {NS}·T*, {NS}·T*); + void (*bit_complement)({NS}·T*, {NS}·T*); + void (*bit_twos_complement)({NS}·T*, {NS}·T*); + {NS}·Order (*compare)({NS}·T*, {NS}·T*); + bool (*lt)({NS}·T*, {NS}·T*); + bool (*gt)({NS}·T*, {NS}·T*); + bool (*eq)({NS}·T*, {NS}·T*); + bool (*eq_zero)({NS}·T*); + {NS}·Status (*accumulate)({NS}·T *accumulator1 ,{NS}·T *accumulator0 ,...); + {NS}·Status (*add)({NS}·T*, {NS}·T*, {NS}·T*); + bool (*increment)({NS}·T *a); + {NS}·Status (*subtract)({NS}·T*, {NS}·T*, {NS}·T*); + {NS}·Status (*multiply)({NS}·T*, {NS}·T*, {NS}·T*, {NS}·T*); + {NS}·Status (*divide)({NS}·T*, {NS}·T*, {NS}·T*, {NS}·T*); + {NS}·Status (*modulus)({NS}·T*, {NS}·T*, {NS}·T*); + {NS}·Status (*shift_left)(Extent, {NS}·T*, {NS}·T*, {NS}·T*); + {NS}·Status (*shift_right)(Extent, {NS}·T*, {NS}·T*, {NS}·T*); + {NS}·Status (*arithmetic_shift_right)(Extent, {NS}·T*, {NS}·T*); + + {NS}·T* (*access)({NS}·T*, Extent); + void (*from_uint32)({NS}·T *destination ,uint32_t value); + }} {NS}·Λ; + + Local const {NS}·Λ {NS}·λ; // initialized in the LOCAL section #endif //-------------------------------------------------------------------------------- // Implementation -#ifdef {NAMESPACE}·IMPLEMENTATION +#ifdef {NS}·IMPLEMENTATION // this part goes into the library #ifndef LOCAL @@ -143,41 +143,41 @@ def template_N(): #include #include - struct {NAMESPACE}·T{{ + struct {NS}·T{{ Digit d0; }}; - {NAMESPACE}·T {NAMESPACE}·constant[4] = {{ + {NS}·T {NS}·constant[4] = {{ {{.d0 = 0}}, {{.d0 = 1}}, {{.d0 = ~(uint32_t)0}}, {{.d0 = 1 << 31}} }}; - {NAMESPACE}·T *{NAMESPACE}·zero = &{NAMESPACE}·constant[0]; - {NAMESPACE}·T *{NAMESPACE}·one = &{NAMESPACE}·constant[1]; - {NAMESPACE}·T *{NAMESPACE}·all_one_bit = &{NAMESPACE}·constant[2]; - {NAMESPACE}·T *{NAMESPACE}·msb = &{NAMESPACE}·constant[3]; - {NAMESPACE}·T *{NAMESPACE}·lsb = &{NAMESPACE}·constant[1]; + {NS}·T *{NS}·zero = &{NS}·constant[0]; + {NS}·T *{NS}·one = &{NS}·constant[1]; + {NS}·T *{NS}·all_one_bit = &{NS}·constant[2]; + {NS}·T *{NS}·msb = &{NS}·constant[3]; + {NS}·T *{NS}·lsb = &{NS}·constant[1]; // the allocate an array of N32 - {NAMESPACE}·T *{NAMESPACE}·allocate_array(Extent extent ,{NAMESPACE}·Allocate_MemoryFault memory_fault){{ - {NAMESPACE}·T *instance = malloc((extent + 1) * sizeof({NAMESPACE}·T) ); + {NS}·T *{NS}·allocate_array(Extent extent ,{NS}·Allocate_MemoryFault memory_fault){{ + {NS}·T *instance = malloc((extent + 1) * sizeof({NS}·T) ); if(!instance){{ return memory_fault ? memory_fault(extent) : NULL; }} return instance; }} - {NAMESPACE}·T *{NAMESPACE}·allocate_array_zero(Extent extent ,{NAMESPACE}·Allocate_MemoryFault memory_fault){{ - {NAMESPACE}·T *instance = calloc( extent + 1 ,sizeof({NAMESPACE}·T) ); + {NS}·T *{NS}·allocate_array_zero(Extent extent ,{NS}·Allocate_MemoryFault memory_fault){{ + {NS}·T *instance = calloc( extent + 1 ,sizeof({NS}·T) ); if(!instance){{ return memory_fault ? memory_fault(extent) : NULL; }} return instance; }} - void {NAMESPACE}·deallocate({NAMESPACE}·T *unencumbered){{ + void {NS}·deallocate({NS}·T *unencumbered){{ free(unencumbered); }} @@ -188,7 +188,7 @@ def template_N(): // instance - struct {NAMESPACE}·T{{ + struct {NS}·T{{ Digit d0; }}; @@ -197,106 +197,106 @@ def template_N(): // allocating a block once is more efficient // library code writes these, they are not on the interface - Local {NAMESPACE}·T {NAMESPACE}·t[4]; + Local {NS}·T {NS}·t[4]; // allocation - extern {NAMESPACE}·T *{NAMESPACE}·allocate_array(Extent, {NAMESPACE}·Allocate_MemoryFault); - extern {NAMESPACE}·T *{NAMESPACE}·allocate_array_zero(Extent, {NAMESPACE}·Allocate_MemoryFault); - extern void {NAMESPACE}·deallocate({NAMESPACE}·T *); + extern {NS}·T *{NS}·allocate_array(Extent, {NS}·Allocate_MemoryFault); + extern {NS}·T *{NS}·allocate_array_zero(Extent, {NS}·Allocate_MemoryFault); + extern void {NS}·deallocate({NS}·T *); // so the user can access numbers in an array allocation - Local {NAMESPACE}·T* {NAMESPACE}·access({NAMESPACE}·T *array ,Extent index){{ + Local {NS}·T* {NS}·access({NS}·T *array ,Extent index){{ return &array[index]; }} - Local void {NAMESPACE}·from_uint32({NAMESPACE}·T *destination ,uint32_t value){{ + Local void {NS}·from_uint32({NS}·T *destination ,uint32_t value){{ if(destination == NULL) return; destination->d0 = value; }} // copy, convenience copy - Local void {NAMESPACE}·copy({NAMESPACE}·T *destination ,{NAMESPACE}·T *source){{ + Local void {NS}·copy({NS}·T *destination ,{NS}·T *source){{ if(source == destination) return; // that was easy! *destination = *source; }} - Local void {NAMESPACE}·set_to_zero({NAMESPACE}·T *instance){{ + Local void {NS}·set_to_zero({NS}·T *instance){{ instance->d0 = 0; }} - Local void {NAMESPACE}·set_to_one({NAMESPACE}·T *instance){{ + Local void {NS}·set_to_one({NS}·T *instance){{ instance->d0 = 1; }} // bit operations - Local void {NAMESPACE}·bit_and({NAMESPACE}·T *result, {NAMESPACE}·T *a, {NAMESPACE}·T *b){{ + Local void {NS}·bit_and({NS}·T *result, {NS}·T *a, {NS}·T *b){{ result->d0 = a->d0 & b->d0; }} // result can be one of the operands - Local void {NAMESPACE}·bit_or({NAMESPACE}·T *result, {NAMESPACE}·T *a, {NAMESPACE}·T *b){{ + Local void {NS}·bit_or({NS}·T *result, {NS}·T *a, {NS}·T *b){{ result->d0 = a->d0 | b->d0; }} // result can the same as the operand - Local void {NAMESPACE}·bit_complement({NAMESPACE}·T *result, {NAMESPACE}·T *a){{ + Local void {NS}·bit_complement({NS}·T *result, {NS}·T *a){{ result->d0 = ~a->d0; }} // result can the same as the operand - Local void {NAMESPACE}·bit_twos_complement({NAMESPACE}·T *result ,{NAMESPACE}·T *a){{ + Local void {NS}·bit_twos_complement({NS}·T *result ,{NS}·T *a){{ result->d0 = ~a->d0 + 1; }} // test functions - Local {NAMESPACE}·Order {NAMESPACE}·compare({NAMESPACE}·T *a, {NAMESPACE}·T *b){{ - if(a->d0 < b->d0) return {NAMESPACE}·Order_lt; - if(a->d0 > b->d0) return {NAMESPACE}·Order_gt; - return {NAMESPACE}·Order_eq; + Local {NS}·Order {NS}·compare({NS}·T *a, {NS}·T *b){{ + if(a->d0 < b->d0) return {NS}·Order_lt; + if(a->d0 > b->d0) return {NS}·Order_gt; + return {NS}·Order_eq; }} - Local bool {NAMESPACE}·lt({NAMESPACE}·T *a ,{NAMESPACE}·T *b){{ + Local bool {NS}·lt({NS}·T *a ,{NS}·T *b){{ return a->d0 < b->d0; }} - Local bool {NAMESPACE}·gt({NAMESPACE}·T *a ,{NAMESPACE}·T *b){{ + Local bool {NS}·gt({NS}·T *a ,{NS}·T *b){{ return a->d0 > b->d0; }} - Local bool {NAMESPACE}·eq({NAMESPACE}·T *a ,{NAMESPACE}·T *b){{ + Local bool {NS}·eq({NS}·T *a ,{NS}·T *b){{ return a->d0 == b->d0; }} - Local bool {NAMESPACE}·eq_zero({NAMESPACE}·T *a){{ + Local bool {NS}·eq_zero({NS}·T *a){{ return a->d0 == 0; }} // arithmetic operations - // For a large number of summands for the lower precision Natural implementations, for accumulate/add/sub, the 'overflow' operand could overflow and thus this routine will halt and return {NAMESPACE}·Status·accumulator1_overflow + // For a large number of summands for the lower precision Natural implementations, for accumulate/add/sub, the 'overflow' operand could overflow and thus this routine will halt and return {NS}·Status·accumulator1_overflow // // When accumulator1 and accumulator0 point to the same location, the result is the accumulator1 value. - Local {NAMESPACE}·Status {NAMESPACE}·accumulate({NAMESPACE}·T *accumulator1 ,{NAMESPACE}·T *accumulator0 ,...){{ + Local {NS}·Status {NS}·accumulate({NS}·T *accumulator1 ,{NS}·T *accumulator0 ,...){{ va_list args; va_start(args ,accumulator0); uint32_t sum = accumulator0->d0; uint32_t carry = 0; - {NAMESPACE}·T *current; + {NS}·T *current; - while( (current = va_arg(args ,{NAMESPACE}·T *)) ){{ + while( (current = va_arg(args ,{NS}·T *)) ){{ sum += current->d0; if(sum < current->d0){{ // Accumulator1 into carry (carry)++; if(carry == 0){{ va_end(args); - return {NAMESPACE}·Status·accumulator1_overflow; + return {NS}·Status·accumulator1_overflow; }} }} }} @@ -305,50 +305,50 @@ def template_N(): // wipes out prior value of accumulator1 accumulator1->d0 = carry; - return {NAMESPACE}·Status·ok; + return {NS}·Status·ok; }} - Local {NAMESPACE}·Status {NAMESPACE}·add({NAMESPACE}·T *sum ,{NAMESPACE}·T *a ,{NAMESPACE}·T *b){{ + Local {NS}·Status {NS}·add({NS}·T *sum ,{NS}·T *a ,{NS}·T *b){{ uint64_t result = (uint64_t)a->d0 + (uint64_t)b->d0; sum->d0 = (uint32_t)result; - return (result >> 32) ? {NAMESPACE}·Status·carry : {NAMESPACE}·Status·ok; + return (result >> 32) ? {NS}·Status·carry : {NS}·Status·ok; }} - Local bool {NAMESPACE}·increment({NAMESPACE}·T *a){{ + Local bool {NS}·increment({NS}·T *a){{ a->d0++; return a->d0 == 0; }} - Local {NAMESPACE}·Status {NAMESPACE}·subtract({NAMESPACE}·T *difference ,{NAMESPACE}·T *a ,{NAMESPACE}·T *b){{ + Local {NS}·Status {NS}·subtract({NS}·T *difference ,{NS}·T *a ,{NS}·T *b){{ uint64_t diff = (uint64_t) a->d0 - (uint64_t) b->d0; difference->d0 = (uint32_t)diff; - return (diff > a->d0) ? {NAMESPACE}·Status·borrow : {NAMESPACE}·Status·ok; + return (diff > a->d0) ? {NS}·Status·borrow : {NS}·Status·ok; }} - Local {NAMESPACE}·Status {NAMESPACE}·multiply({NAMESPACE}·T *product1 ,{NAMESPACE}·T *product0 ,{NAMESPACE}·T *a ,{NAMESPACE}·T *b){{ + Local {NS}·Status {NS}·multiply({NS}·T *product1 ,{NS}·T *product0 ,{NS}·T *a ,{NS}·T *b){{ uint64_t product = (uint64_t)a->d0 * (uint64_t)b->d0; product0->d0 = (uint32_t)product; product1->d0 = (uint32_t)(product >> 32); - if(product1->d0 == 0) return {NAMESPACE}·Status·one_word_product; - return {NAMESPACE}·Status·two_word_product; + if(product1->d0 == 0) return {NS}·Status·one_word_product; + return {NS}·Status·two_word_product; }} - Local {NAMESPACE}·Status {NAMESPACE}·divide({NAMESPACE}·T *remainder ,{NAMESPACE}·T *quotient ,{NAMESPACE}·T *a ,{NAMESPACE}·T *b){{ - if(b->d0 == 0) return {NAMESPACE}·Status·undefined_divide_by_zero; + Local {NS}·Status {NS}·divide({NS}·T *remainder ,{NS}·T *quotient ,{NS}·T *a ,{NS}·T *b){{ + if(b->d0 == 0) return {NS}·Status·undefined_divide_by_zero; quotient->d0 = a->d0 / b->d0; remainder->d0 = a->d0 - (quotient->d0 * b->d0); - return {NAMESPACE}·Status·ok; + return {NS}·Status·ok; }} - Local {NAMESPACE}·Status {NAMESPACE}·modulus({NAMESPACE}·T *remainder ,{NAMESPACE}·T *a ,{NAMESPACE}·T *b){{ - if(b->d0 == 0) return {NAMESPACE}·Status·undefined_modulus_zero; + Local {NS}·Status {NS}·modulus({NS}·T *remainder ,{NS}·T *a ,{NS}·T *b){{ + if(b->d0 == 0) return {NS}·Status·undefined_modulus_zero; uint32_t quotient = a->d0 / b->d0; remainder->d0 = a->d0 - (quotient * b->d0); - return {NAMESPACE}·Status·ok; + return {NS}·Status·ok; }} // bit motion @@ -365,105 +365,105 @@ def template_N(): // modifies all three of its operands // in the case of duplicate operands this is the order: first modifies operand, then fill, then spill, - Local {NAMESPACE}·Status {NAMESPACE}·shift + Local {NS}·Status {NS}·shift ( uint32_t shift_count - ,{NAMESPACE}·T *spill - ,{NAMESPACE}·T *operand - ,{NAMESPACE}·T *fill + ,{NS}·T *spill + ,{NS}·T *operand + ,{NS}·T *fill ,ShiftOp shift_op ,ShiftOp complement_shift_op ){{ // If no result is needed, return immediately. - if(operand == NULL && spill == NULL) return {NAMESPACE}·Status·ok; + if(operand == NULL && spill == NULL) return {NS}·Status·ok; // Treat NULL operand as zero. if(operand == NULL){{ - operand = &{NAMESPACE}·t[0]; - {NAMESPACE}·copy(operand, {NAMESPACE}·zero); + operand = &{NS}·t[0]; + {NS}·copy(operand, {NS}·zero); }} // Shifting more than one word breaks our fill/spill model. - if(shift_count > 31) return {NAMESPACE}·Status·gt_max_shift_count; + if(shift_count > 31) return {NS}·Status·gt_max_shift_count; // The given operand is still required after it is modified, so we copy it. - {NAMESPACE}·T *given_operand = &{NAMESPACE}·t[1]; - {NAMESPACE}·copy(given_operand, operand); + {NS}·T *given_operand = &{NS}·t[1]; + {NS}·copy(given_operand, operand); // Perform the shift operand->d0 = shift_op(given_operand->d0, shift_count); if(fill != NULL){{ fill->d0 = complement_shift_op(fill->d0, (32 - shift_count)); - {NAMESPACE}·bit_or(operand, operand, fill); + {NS}·bit_or(operand, operand, fill); }} if(spill != NULL){{ spill->d0 = shift_op(spill->d0, shift_count); spill->d0 += complement_shift_op(given_operand->d0, (32 - shift_count)); }} - return {NAMESPACE}·Status·ok; + return {NS}·Status·ok; }} // Define concrete shift functions using valid C function pointers - Local {NAMESPACE}·Status - {NAMESPACE}·shift_left(uint32_t shift_count, {NAMESPACE}·T *spill, {NAMESPACE}·T *operand, {NAMESPACE}·T *fill){{ - return {NAMESPACE}·shift(shift_count, spill, operand, fill, shift_left_op, shift_right_op); + Local {NS}·Status + {NS}·shift_left(uint32_t shift_count, {NS}·T *spill, {NS}·T *operand, {NS}·T *fill){{ + return {NS}·shift(shift_count, spill, operand, fill, shift_left_op, shift_right_op); }} - Local {NAMESPACE}·Status - {NAMESPACE}·shift_right(uint32_t shift_count, {NAMESPACE}·T *spill, {NAMESPACE}·T *operand, {NAMESPACE}·T *fill){{ - return {NAMESPACE}·shift(shift_count, spill, operand, fill, shift_right_op, shift_left_op); + Local {NS}·Status + {NS}·shift_right(uint32_t shift_count, {NS}·T *spill, {NS}·T *operand, {NS}·T *fill){{ + return {NS}·shift(shift_count, spill, operand, fill, shift_right_op, shift_left_op); }} - Local {NAMESPACE}·Status - {NAMESPACE}·arithmetic_shift_right(uint32_t shift_count, {NAMESPACE}·T *operand, {NAMESPACE}·T *spill){{ + Local {NS}·Status + {NS}·arithmetic_shift_right(uint32_t shift_count, {NS}·T *operand, {NS}·T *spill){{ // Guard against excessive shift counts - if(shift_count > 31) return {NAMESPACE}·Status·gt_max_shift_count; + if(shift_count > 31) return {NS}·Status·gt_max_shift_count; // A NULL operand is treated as zero if(operand == NULL){{ - operand = &{NAMESPACE}·t[0]; - {NAMESPACE}·copy(operand, {NAMESPACE}·zero); + operand = &{NS}·t[0]; + {NS}·copy(operand, {NS}·zero); }} // Pick the fill value based on the sign bit - {NAMESPACE}·T *fill = (operand->d0 & 0x80000000) ? {NAMESPACE}·all_one_bit : {NAMESPACE}·zero; + {NS}·T *fill = (operand->d0 & 0x80000000) ? {NS}·all_one_bit : {NS}·zero; // Call shift_right with the appropriate fill - return {NAMESPACE}·shift_right(shift_count, spill, operand, fill); + return {NS}·shift_right(shift_count, spill, operand, fill); }} - Local const {NAMESPACE}·Λ {NAMESPACE}·λ = {{ - - .allocate_array = {NAMESPACE}·allocate_array - ,.allocate_array_zero = {NAMESPACE}·allocate_array_zero - ,.deallocate = {NAMESPACE}·deallocate - - ,.copy = {NAMESPACE}·copy - ,.bit_and = {NAMESPACE}·bit_and - ,.bit_or = {NAMESPACE}·bit_or - ,.bit_complement = {NAMESPACE}·bit_complement - ,.bit_twos_complement = {NAMESPACE}·bit_twos_complement - ,.compare = {NAMESPACE}·compare - ,.lt = {NAMESPACE}·lt - ,.gt = {NAMESPACE}·gt - ,.eq = {NAMESPACE}·eq - ,.eq_zero = {NAMESPACE}·eq_zero - ,.accumulate = {NAMESPACE}·accumulate - ,.add = {NAMESPACE}·add - ,.increment = {NAMESPACE}·increment - ,.subtract = {NAMESPACE}·subtract - ,.multiply = {NAMESPACE}·multiply - ,.divide = {NAMESPACE}·divide - ,.modulus = {NAMESPACE}·modulus - ,.shift_left = {NAMESPACE}·shift_left - ,.shift_right = {NAMESPACE}·shift_right - ,.arithmetic_shift_right = {NAMESPACE}·arithmetic_shift_right - - ,.access = {NAMESPACE}·access - ,.from_uint32 = {NAMESPACE}·from_uint32 + Local const {NS}·Λ {NS}·λ = {{ + + .allocate_array = {NS}·allocate_array + ,.allocate_array_zero = {NS}·allocate_array_zero + ,.deallocate = {NS}·deallocate + + ,.copy = {NS}·copy + ,.bit_and = {NS}·bit_and + ,.bit_or = {NS}·bit_or + ,.bit_complement = {NS}·bit_complement + ,.bit_twos_complement = {NS}·bit_twos_complement + ,.compare = {NS}·compare + ,.lt = {NS}·lt + ,.gt = {NS}·gt + ,.eq = {NS}·eq + ,.eq_zero = {NS}·eq_zero + ,.accumulate = {NS}·accumulate + ,.add = {NS}·add + ,.increment = {NS}·increment + ,.subtract = {NS}·subtract + ,.multiply = {NS}·multiply + ,.divide = {NS}·divide + ,.modulus = {NS}·modulus + ,.shift_left = {NS}·shift_left + ,.shift_right = {NS}·shift_right + ,.arithmetic_shift_right = {NS}·arithmetic_shift_right + + ,.access = {NS}·access + ,.from_uint32 = {NS}·from_uint32 }}; #endif diff --git a/tester/python/template_test_N32.py b/tester/python/template_test_N32.py index e2211d4..7d26285 100644 --- a/tester/python/template_test_N32.py +++ b/tester/python/template_test_N32.py @@ -1,4 +1,4 @@ -# {NAMESPACE} must be a N32 type. +# {NS} must be a N32 type. # # test_N32 can be used to test any 32 bit natural number types. As examples: N32PN the processor native type; N32_4_by_8 a 32 bit natural number type made of 4 digits, where each digit is 8 bits. # @@ -9,7 +9,7 @@ def test_N32(namespace: str) -> str: """ template = template_test_N32() code = template.format( - NAMESPACE = namespace + NS = namespace ) return code @@ -21,7 +21,7 @@ def template_test_N32(): // Enable interface section #define FACE -#include "{NAMESPACE}.lib.c" +#include "{NS}.lib.c" #undef FACE // Jump buffer for signal handling @@ -97,285 +97,285 @@ int main(int argc ,char **argv){{ bool test_copy(){{ // Allocate memory - {NAMESPACE}·T *array = {NAMESPACE}·λ.allocate_array(2 ,NULL); + {NS}·T *array = {NS}·λ.allocate_array(2 ,NULL); if( !array ) return false; // Access elements via access function - {NAMESPACE}·T *a = {NAMESPACE}·λ.access(array ,0); - {NAMESPACE}·T *b = {NAMESPACE}·λ.access(array ,1); + {NS}·T *a = {NS}·λ.access(array ,0); + {NS}·T *b = {NS}·λ.access(array ,1); // Assign value and copy - {NAMESPACE}·λ.from_uint32(a ,42); - {NAMESPACE}·λ.copy(b ,a); + {NS}·λ.from_uint32(a ,42); + {NS}·λ.copy(b ,a); - bool success = ( {NAMESPACE}·λ.compare(b ,a) == {NAMESPACE}·Order_eq ); - {NAMESPACE}·λ.deallocate(array); + bool success = ( {NS}·λ.compare(b ,a) == {NS}·Order_eq ); + {NS}·λ.deallocate(array); return success; }} bool test_arithmetic(){{ // Allocate memory - {NAMESPACE}·T *array = {NAMESPACE}·λ.allocate_array(3 ,NULL); + {NS}·T *array = {NS}·λ.allocate_array(3 ,NULL); if( !array ) return false; - {NAMESPACE}·T *a = {NAMESPACE}·λ.access(array ,0); - {NAMESPACE}·T *b = {NAMESPACE}·λ.access(array ,1); - {NAMESPACE}·T *result = {NAMESPACE}·λ.access(array ,2); + {NS}·T *a = {NS}·λ.access(array ,0); + {NS}·T *b = {NS}·λ.access(array ,1); + {NS}·T *result = {NS}·λ.access(array ,2); - {NAMESPACE}·λ.from_uint32(a ,20); - {NAMESPACE}·λ.from_uint32(b ,22); + {NS}·λ.from_uint32(a ,20); + {NS}·λ.from_uint32(b ,22); - if( {NAMESPACE}·λ.add(result ,a ,b) != {NAMESPACE}·Status·ok ) return false; - if( {NAMESPACE}·λ.compare(result ,{NAMESPACE}·λ.access(array ,0)) != {NAMESPACE}·Order_gt ) return false; + if( {NS}·λ.add(result ,a ,b) != {NS}·Status·ok ) return false; + if( {NS}·λ.compare(result ,{NS}·λ.access(array ,0)) != {NS}·Order_gt ) return false; - if( {NAMESPACE}·λ.subtract(result ,b ,a) != {NAMESPACE}·Status·ok ) return false; - if( {NAMESPACE}·λ.compare(result ,{NAMESPACE}·λ.access(array ,0)) != {NAMESPACE}·Order_lt ) return false; + if( {NS}·λ.subtract(result ,b ,a) != {NS}·Status·ok ) return false; + if( {NS}·λ.compare(result ,{NS}·λ.access(array ,0)) != {NS}·Order_lt ) return false; - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.deallocate(array); return true; }} bool test_bitwise_operations(){{ // Allocate memory - {NAMESPACE}·T *array = {NAMESPACE}·λ.allocate_array(3, NULL); + {NS}·T *array = {NS}·λ.allocate_array(3, NULL); if(!array) return false; - {NAMESPACE}·T *a = {NAMESPACE}·λ.access(array, 0); - {NAMESPACE}·T *b = {NAMESPACE}·λ.access(array, 1); - {NAMESPACE}·T *result = {NAMESPACE}·λ.access(array, 2); + {NS}·T *a = {NS}·λ.access(array, 0); + {NS}·T *b = {NS}·λ.access(array, 1); + {NS}·T *result = {NS}·λ.access(array, 2); // a = 0x0F0F0F0F, b = 0xF0F0F0F0 - {NAMESPACE}·λ.from_uint32(a, 0x0F0F0F0F); - {NAMESPACE}·λ.from_uint32(b, 0xF0F0F0F0); + {NS}·λ.from_uint32(a, 0x0F0F0F0F); + {NS}·λ.from_uint32(b, 0xF0F0F0F0); // bit_and => expect 0x00000000 - {NAMESPACE}·λ.bit_and(result, a, b); - {NAMESPACE}·λ.from_uint32(a, 0x00000000); - if({NAMESPACE}·λ.compare(result, a) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.bit_and(result, a, b); + {NS}·λ.from_uint32(a, 0x00000000); + if({NS}·λ.compare(result, a) != {NS}·Order_eq){{ + {NS}·λ.deallocate(array); return false; }} // Reset a to 0x0F0F0F0F for next tests - {NAMESPACE}·λ.from_uint32(a, 0x0F0F0F0F); + {NS}·λ.from_uint32(a, 0x0F0F0F0F); // bit_or => expect 0xFFFFFFFF - {NAMESPACE}·λ.bit_or(result, a, b); - {NAMESPACE}·λ.from_uint32(b, 0xFFFFFFFF); - if({NAMESPACE}·λ.compare(result, b) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.bit_or(result, a, b); + {NS}·λ.from_uint32(b, 0xFFFFFFFF); + if({NS}·λ.compare(result, b) != {NS}·Order_eq){{ + {NS}·λ.deallocate(array); return false; }} // bit_complement(a=0x0F0F0F0F) => expect 0xF0F0F0F0 - {NAMESPACE}·λ.from_uint32(a, 0x0F0F0F0F); - {NAMESPACE}·λ.bit_complement(result, a); - {NAMESPACE}·λ.from_uint32(b, 0xF0F0F0F0); - if({NAMESPACE}·λ.compare(result, b) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(a, 0x0F0F0F0F); + {NS}·λ.bit_complement(result, a); + {NS}·λ.from_uint32(b, 0xF0F0F0F0); + if({NS}·λ.compare(result, b) != {NS}·Order_eq){{ + {NS}·λ.deallocate(array); return false; }} // bit_twos_complement(a=0x0F0F0F0F) => expect 0xF0F0F0F1 - {NAMESPACE}·λ.from_uint32(a, 0x0F0F0F0F); - {NAMESPACE}·λ.bit_twos_complement(result, a); - {NAMESPACE}·λ.from_uint32(b, 0xF0F0F0F1); - if({NAMESPACE}·λ.compare(result, b) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(a, 0x0F0F0F0F); + {NS}·λ.bit_twos_complement(result, a); + {NS}·λ.from_uint32(b, 0xF0F0F0F1); + if({NS}·λ.compare(result, b) != {NS}·Order_eq){{ + {NS}·λ.deallocate(array); return false; }} - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.deallocate(array); return true; }} bool test_comparisons(){{ // Allocate memory - {NAMESPACE}·T *array = {NAMESPACE}·λ.allocate_array(3, NULL); + {NS}·T *array = {NS}·λ.allocate_array(3, NULL); if(!array) return false; - {NAMESPACE}·T *a = {NAMESPACE}·λ.access(array, 0); - {NAMESPACE}·T *b = {NAMESPACE}·λ.access(array, 1); - {NAMESPACE}·T *c = {NAMESPACE}·λ.access(array, 2); + {NS}·T *a = {NS}·λ.access(array, 0); + {NS}·T *b = {NS}·λ.access(array, 1); + {NS}·T *c = {NS}·λ.access(array, 2); // First set: a=0, b=42, c=42 - {NAMESPACE}·λ.from_uint32(a, 0); - {NAMESPACE}·λ.from_uint32(b, 42); - {NAMESPACE}·λ.from_uint32(c, 42); + {NS}·λ.from_uint32(a, 0); + {NS}·λ.from_uint32(b, 42); + {NS}·λ.from_uint32(c, 42); // eq_zero(a) => true - if(!{NAMESPACE}·λ.eq_zero(a)){{ - {NAMESPACE}·λ.deallocate(array); + if(!{NS}·λ.eq_zero(a)){{ + {NS}·λ.deallocate(array); return false; }} // eq_zero(b) => false - if({NAMESPACE}·λ.eq_zero(b)){{ - {NAMESPACE}·λ.deallocate(array); + if({NS}·λ.eq_zero(b)){{ + {NS}·λ.deallocate(array); return false; }} // eq(b, c) => true - if(!{NAMESPACE}·λ.eq(b, c)){{ - {NAMESPACE}·λ.deallocate(array); + if(!{NS}·λ.eq(b, c)){{ + {NS}·λ.deallocate(array); return false; }} // eq(a, b) => false - if({NAMESPACE}·λ.eq(a, b)){{ - {NAMESPACE}·λ.deallocate(array); + if({NS}·λ.eq(a, b)){{ + {NS}·λ.deallocate(array); return false; }} - // compare(a, b) => {NAMESPACE}·Order_lt - if({NAMESPACE}·λ.compare(a, b) != {NAMESPACE}·Order_lt){{ - {NAMESPACE}·λ.deallocate(array); + // compare(a, b) => {NS}·Order_lt + if({NS}·λ.compare(a, b) != {NS}·Order_lt){{ + {NS}·λ.deallocate(array); return false; }} - // compare(b, a) => {NAMESPACE}·Order_gt - if({NAMESPACE}·λ.compare(b, a) != {NAMESPACE}·Order_gt){{ - {NAMESPACE}·λ.deallocate(array); + // compare(b, a) => {NS}·Order_gt + if({NS}·λ.compare(b, a) != {NS}·Order_gt){{ + {NS}·λ.deallocate(array); return false; }} - // compare(b, c) => {NAMESPACE}·Order_eq - if({NAMESPACE}·λ.compare(b, c) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(array); + // compare(b, c) => {NS}·Order_eq + if({NS}·λ.compare(b, c) != {NS}·Order_eq){{ + {NS}·λ.deallocate(array); return false; }} // lt(a, b) => true, gt(b, a) => true - if(!{NAMESPACE}·λ.lt(a, b) || !{NAMESPACE}·λ.gt(b, a)){{ - {NAMESPACE}·λ.deallocate(array); + if(!{NS}·λ.lt(a, b) || !{NS}·λ.gt(b, a)){{ + {NS}·λ.deallocate(array); return false; }} // Second set: a=100, b=50 - {NAMESPACE}·λ.from_uint32(a, 100); - {NAMESPACE}·λ.from_uint32(b, 50); - if({NAMESPACE}·λ.compare(a, b) != {NAMESPACE}·Order_gt){{ - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(a, 100); + {NS}·λ.from_uint32(b, 50); + if({NS}·λ.compare(a, b) != {NS}·Order_gt){{ + {NS}·λ.deallocate(array); return false; }} // eq_zero(a) => false - if({NAMESPACE}·λ.eq_zero(a)){{ - {NAMESPACE}·λ.deallocate(array); + if({NS}·λ.eq_zero(a)){{ + {NS}·λ.deallocate(array); return false; }} // eq_zero(b) => false - if({NAMESPACE}·λ.eq_zero(b)){{ - {NAMESPACE}·λ.deallocate(array); + if({NS}·λ.eq_zero(b)){{ + {NS}·λ.deallocate(array); return false; }} - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.deallocate(array); return true; }} bool test_shifts(){{ // Allocate memory for operand, fill, spill - {NAMESPACE}·T *array = {NAMESPACE}·λ.allocate_array(3, NULL); + {NS}·T *array = {NS}·λ.allocate_array(3, NULL); if(!array) return false; - {NAMESPACE}·T *operand = {NAMESPACE}·λ.access(array, 0); - {NAMESPACE}·T *fill = {NAMESPACE}·λ.access(array, 1); - {NAMESPACE}·T *spill = {NAMESPACE}·λ.access(array, 2); + {NS}·T *operand = {NS}·λ.access(array, 0); + {NS}·T *fill = {NS}·λ.access(array, 1); + {NS}·T *spill = {NS}·λ.access(array, 2); // Subtest A: shift_left(4) with operand=1 => expect operand=16, fill=0, spill=0 - {NAMESPACE}·λ.from_uint32(operand, 1); - {NAMESPACE}·λ.from_uint32(fill, 0); - {NAMESPACE}·λ.from_uint32(spill, 0); - if({NAMESPACE}·λ.shift_left(4, spill, operand, fill) != {NAMESPACE}·Status·ok){{ - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(operand, 1); + {NS}·λ.from_uint32(fill, 0); + {NS}·λ.from_uint32(spill, 0); + if({NS}·λ.shift_left(4, spill, operand, fill) != {NS}·Status·ok){{ + {NS}·λ.deallocate(array); return false; }} - {NAMESPACE}·T *temp = {NAMESPACE}·λ.allocate_array(1, NULL); + {NS}·T *temp = {NS}·λ.allocate_array(1, NULL); if(!temp){{ - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.deallocate(array); return false; }} - {NAMESPACE}·λ.from_uint32(temp, 16); - if({NAMESPACE}·λ.compare(operand, temp) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(temp, 16); + if({NS}·λ.compare(operand, temp) != {NS}·Order_eq){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - if({NAMESPACE}·λ.compare(fill, {NAMESPACE}·zero) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + if({NS}·λ.compare(fill, {NS}·zero) != {NS}·Order_eq){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - if({NAMESPACE}·λ.compare(spill, {NAMESPACE}·zero) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + if({NS}·λ.compare(spill, {NS}·zero) != {NS}·Order_eq){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} // Subtest B: shift_left(1) with operand=0x80000000 => expect operand=0, spill=1 - {NAMESPACE}·λ.from_uint32(operand, 0x80000000); - {NAMESPACE}·λ.from_uint32(fill, 0); - {NAMESPACE}·λ.from_uint32(spill, 0); - if({NAMESPACE}·λ.shift_left(1, spill, operand, fill) != {NAMESPACE}·Status·ok){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(operand, 0x80000000); + {NS}·λ.from_uint32(fill, 0); + {NS}·λ.from_uint32(spill, 0); + if({NS}·λ.shift_left(1, spill, operand, fill) != {NS}·Status·ok){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - if(!{NAMESPACE}·λ.eq_zero(operand)){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + if(!{NS}·λ.eq_zero(operand)){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - {NAMESPACE}·λ.from_uint32(temp, 1); - if({NAMESPACE}·λ.compare(spill, temp) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(temp, 1); + if({NS}·λ.compare(spill, temp) != {NS}·Order_eq){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} // Subtest C: shift_right(1) with operand=0x80000000 => expect operand=0x40000000, spill=0 - {NAMESPACE}·λ.from_uint32(operand, 0x80000000); - {NAMESPACE}·λ.from_uint32(fill, 0); - {NAMESPACE}·λ.from_uint32(spill, 0); - if({NAMESPACE}·λ.shift_right(1, spill, operand, fill) != {NAMESPACE}·Status·ok){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(operand, 0x80000000); + {NS}·λ.from_uint32(fill, 0); + {NS}·λ.from_uint32(spill, 0); + if({NS}·λ.shift_right(1, spill, operand, fill) != {NS}·Status·ok){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - {NAMESPACE}·λ.from_uint32(temp, 0x40000000); - if({NAMESPACE}·λ.compare(operand, temp) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(temp, 0x40000000); + if({NS}·λ.compare(operand, temp) != {NS}·Order_eq){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - if(!{NAMESPACE}·λ.eq_zero(spill)){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + if(!{NS}·λ.eq_zero(spill)){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} // Subtest D: arithmetic_shift_right(1) with operand=0x80000000 => expect operand=0xC0000000, spill=0 - {NAMESPACE}·λ.from_uint32(operand, 0x80000000); - {NAMESPACE}·λ.from_uint32(spill, 0); - if({NAMESPACE}·λ.arithmetic_shift_right(1, operand, spill) != {NAMESPACE}·Status·ok){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(operand, 0x80000000); + {NS}·λ.from_uint32(spill, 0); + if({NS}·λ.arithmetic_shift_right(1, operand, spill) != {NS}·Status·ok){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - {NAMESPACE}·λ.from_uint32(temp, 0xC0000000); - if({NAMESPACE}·λ.compare(operand, temp) != {NAMESPACE}·Order_eq){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.from_uint32(temp, 0xC0000000); + if({NS}·λ.compare(operand, temp) != {NS}·Order_eq){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - if(!{NAMESPACE}·λ.eq_zero(spill)){{ - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + if(!{NS}·λ.eq_zero(spill)){{ + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return false; }} - {NAMESPACE}·λ.deallocate(temp); - {NAMESPACE}·λ.deallocate(array); + {NS}·λ.deallocate(temp); + {NS}·λ.deallocate(array); return true; }} -// Include the local section of {NAMESPACE}.lib.c for testing +// Include the local section of {NS}.lib.c for testing #define LOCAL -#include "{NAMESPACE}.lib.c" +#include "{NS}.lib.c" #undef LOCAL ''' diff --git "a/tester/tool\360\237\226\211/makefile" "b/tester/tool\360\237\226\211/makefile" index 9b933d5..99161fd 100644 --- "a/tester/tool\360\237\226\211/makefile" +++ "b/tester/tool\360\237\226\211/makefile" @@ -3,7 +3,7 @@ RT-INCOMMON:=$(REPO_HOME)/tool_shared/third_party/RT-project-share/release include $(RT-INCOMMON)/make/environment_RT_0 -CFLAGS+=-Werror -include "$(RT-INCOMMON)/make/RT_0.h" +CFLAGS+= -g -O0 -Werror -include "$(RT-INCOMMON)/make/RT_0.h" LINKFLAGS+= -l$(PROJECT) LIBFILE=$(LIBDIR)/lib$(PROJECT).a -- 2.20.1