#undef _XSCOPE_PROBES_INCLUDE_FILE #define __XC__ 1 #define __llvm__ 1 #define __ATOMIC_RELAXED 0 #define __ATOMIC_CONSUME 1 #define __ATOMIC_ACQUIRE 2 #define __ATOMIC_RELEASE 3 #define __ATOMIC_ACQ_REL 4 #define __ATOMIC_SEQ_CST 5 #define __PRAGMA_REDEFINE_EXTNAME 1 #define __VERSION__ "4.2.1 Compatible XMOS-235-acbb966-Dec-01-2019 Clang 3.6.0 " #define __CONSTANT_CFSTRINGS__ 1 #define __ORDER_LITTLE_ENDIAN__ 1234 #define __ORDER_BIG_ENDIAN__ 4321 #define __ORDER_PDP_ENDIAN__ 3412 #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __LITTLE_ENDIAN__ 1 #define _ILP32 1 #define __ILP32__ 1 #define __CHAR_BIT__ 8 #define __SCHAR_MAX__ 127 #define __SHRT_MAX__ 32767 #define __INT_MAX__ 2147483647 #define __LONG_MAX__ 2147483647L #define __LONG_LONG_MAX__ 9223372036854775807LL #define __WCHAR_MAX__ 255 #define __INTMAX_MAX__ 9223372036854775807LL #define __SIZE_MAX__ 4294967295U #define __SIZEOF_DOUBLE__ 8 #define __SIZEOF_FLOAT__ 4 #define __SIZEOF_INT__ 4 #define __SIZEOF_LONG__ 4 #define __SIZEOF_LONG_DOUBLE__ 8 #define __SIZEOF_LONG_LONG__ 8 #define __SIZEOF_POINTER__ 4 #define __SIZEOF_SHORT__ 2 #define __SIZEOF_PTRDIFF_T__ 4 #define __SIZEOF_SIZE_T__ 4 #define __SIZEOF_WCHAR_T__ 1 #define __SIZEOF_WINT_T__ 4 #define __INTMAX_TYPE__ long long int #define __INTMAX_FMTd__ "lld" #define __INTMAX_FMTi__ "lli" #define __INTMAX_C_SUFFIX__ LL #define __UINTMAX_TYPE__ long long unsigned int #define __UINTMAX_FMTo__ "llo" #define __UINTMAX_FMTu__ "llu" #define __UINTMAX_FMTx__ "llx" #define __UINTMAX_FMTX__ "llX" #define __UINTMAX_C_SUFFIX__ ULL #define __INTMAX_WIDTH__ 64 #define __PTRDIFF_TYPE__ int #define __PTRDIFF_FMTd__ "d" #define __PTRDIFF_FMTi__ "i" #define __PTRDIFF_WIDTH__ 32 #define __INTPTR_TYPE__ int #define __INTPTR_FMTd__ "d" #define __INTPTR_FMTi__ "i" #define __INTPTR_WIDTH__ 32 #define __SIZE_TYPE__ unsigned int #define __SIZE_FMTo__ "o" #define __SIZE_FMTu__ "u" #define __SIZE_FMTx__ "x" #define __SIZE_FMTX__ "X" #define __SIZE_WIDTH__ 32 #define __WCHAR_TYPE__ unsigned char #define __WCHAR_WIDTH__ 8 #define __WINT_TYPE__ unsigned int #define __WINT_WIDTH__ 32 #define __SIG_ATOMIC_WIDTH__ 32 #define __SIG_ATOMIC_MAX__ 2147483647 #define __CHAR16_TYPE__ unsigned short #define __CHAR32_TYPE__ unsigned int #define __FLT_DENORM_MIN__ 1.40129846e-45F #define __FLT_HAS_DENORM__ 1 #define __FLT_DIG__ 6 #define __FLT_EPSILON__ 1.19209290e-7F #define __FLT_HAS_INFINITY__ 1 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MANT_DIG__ 24 #define __FLT_MAX_10_EXP__ 38 #define __FLT_MAX_EXP__ 128 #define __FLT_MAX__ 3.40282347e+38F #define __FLT_MIN_10_EXP__ (-37) #define __FLT_MIN_EXP__ (-125) #define __FLT_MIN__ 1.17549435e-38F #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __DBL_HAS_DENORM__ 1 #define __DBL_DIG__ 15 #define __DBL_EPSILON__ 2.2204460492503131e-16 #define __DBL_HAS_INFINITY__ 1 #define __DBL_HAS_QUIET_NAN__ 1 #define __DBL_MANT_DIG__ 53 #define __DBL_MAX_10_EXP__ 308 #define __DBL_MAX_EXP__ 1024 #define __DBL_MAX__ 1.7976931348623157e+308 #define __DBL_MIN_10_EXP__ (-307) #define __DBL_MIN_EXP__ (-1021) #define __DBL_MIN__ 2.2250738585072014e-308 #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L #define __LDBL_HAS_DENORM__ 1 #define __LDBL_DIG__ 15 #define __LDBL_EPSILON__ 2.2204460492503131e-16L #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_HAS_QUIET_NAN__ 1 #define __LDBL_MANT_DIG__ 53 #define __LDBL_MAX_10_EXP__ 308 #define __LDBL_MAX_EXP__ 1024 #define __LDBL_MAX__ 1.7976931348623157e+308L #define __LDBL_MIN_10_EXP__ (-307) #define __LDBL_MIN_EXP__ (-1021) #define __LDBL_MIN__ 2.2250738585072014e-308L #define __POINTER_WIDTH__ 32 #define __CHAR_UNSIGNED__ 1 #define __WCHAR_UNSIGNED__ 1 #define __WINT_UNSIGNED__ 1 #define __INT8_TYPE__ signed char #define __INT8_FMTd__ "hhd" #define __INT8_FMTi__ "hhi" #define __INT8_C_SUFFIX__ #define __INT16_TYPE__ short #define __INT16_FMTd__ "hd" #define __INT16_FMTi__ "hi" #define __INT16_C_SUFFIX__ #define __INT32_TYPE__ int #define __INT32_FMTd__ "d" #define __INT32_FMTi__ "i" #define __INT32_C_SUFFIX__ #define __INT64_TYPE__ long long int #define __INT64_FMTd__ "lld" #define __INT64_FMTi__ "lli" #define __INT64_C_SUFFIX__ LL #define __USER_LABEL_PREFIX__ _ #define __FINITE_MATH_ONLY__ 0 #define __FLT_EVAL_METHOD__ 0 #define __FLT_RADIX__ 2 #define __DECIMAL_DIG__ 17 #define __xcore__ 1 #define __XS1B__ 1 #define __STDC_HOSTED__ 1 #define __STDC_UTF_16__ 1 #define __STDC_UTF_32__ 1 #define OTP_STATS 1 #define __xcore__ 1 #define __XS1B__ 1 #define XCC_VERSION_YEAR 14 #define XCC_VERSION_MONTH 4 #define XCC_VERSION_MAJOR 1404 #define XCC_VERSION_MINOR 1 #define __XCC_HAVE_FLOAT__ 1 #define _XSCOPE_PROBES_INCLUDE_FILE "c:\\Users\\swnb\\Temp\\ccQPcbaa.h" #define _xburn_h_ #define _OTP_H_ #define _xccompat_h_ #define REFERENCE_PARAM(type,name) type &name #define NULLABLE_REFERENCE_PARAM(type,name) type &?name #define NULLABLE_RESOURCE(type,name) type ?name #define NULLABLE_ARRAY_OF(type,name) type (&?name)[] #define ARRAY_OF_SIZE(type,name,size) type name[size] #define NULLABLE_ARRAY_OF_SIZE(type,name,size) type (&?name)[size] #define CLIENT_INTERFACE(tag,name) client interface tag name #define SERVER_INTERFACE(tag,name) server interface tag name typedef streaming chanend streaming_chanend_t; typedef in buffered port:1 in_buffered_port_1_t; typedef in buffered port:4 in_buffered_port_4_t; typedef in buffered port:8 in_buffered_port_8_t; typedef in buffered port:16 in_buffered_port_16_t; typedef in buffered port:32 in_buffered_port_32_t; typedef out buffered port:1 out_buffered_port_1_t; typedef out buffered port:4 out_buffered_port_4_t; typedef out buffered port:8 out_buffered_port_8_t; typedef out buffered port:16 out_buffered_port_16_t; typedef out buffered port:32 out_buffered_port_32_t; #define OTP_SIZE 0x800 #define OTP_PORTS_INITIALIZER { XS1_PORT_32B, XS1_PORT_16C, XS1_PORT_16D } typedef struct OTPPorts { port data; out port addr; out port ctrl; } OTPPorts; typedef struct OTPStats { unsigned programmed_words; unsigned programmed_bits; unsigned soaked_bits; unsigned leaky_bits; unsigned failed_to_program_words; unsigned redundant_sectors_used; } OTPStats; int otp_program(OTPPorts &ports, unsigned address, const unsigned data[], unsigned size); int otp_program_differential(OTPPorts &ports, unsigned address, const unsigned data[], unsigned size); int otp_program_no_repair(OTPPorts &ports, unsigned address, const unsigned data[], unsigned size, char failmap[]); int otp_program_differential_no_repair(OTPPorts &ports, unsigned address, const unsigned data[], unsigned size, char failmap[]); int otp_program_special_register(OTPPorts &ports, unsigned data); int otp_program_secure_config_register(OTPPorts &ports, unsigned data); int otpprogram_writeword_norepair(OTPPorts &ports, unsigned address, unsigned data); void otp_read(OTPPorts &ports, unsigned address, unsigned data[], unsigned size); void otp_read_differential(OTPPorts &ports, unsigned address, unsigned data[], unsigned size); void otp_read_special_register(OTPPorts &ports, unsigned &data); void otp_read_secure_config_register(OTPPorts &ports, unsigned &data); void otpstats_get_stats(OTPStats &stats); void otpstats_merge_stats(OTPStats &a, const OTPStats &b); void otpstats_print_stats(const OTPStats &stats); int ProgramSRMasked(OTPPorts &ports, unsigned sr, unsigned sr_mask); int ProgramSecurityConfigMasked(OTPPorts &ports, unsigned sec, unsigned sec_mask); void PrintArray(OTPPorts &ports, chanend prev, chanend next, int differential); void CollectStats(chanend c, OTPStats &stats); int ProgramSoftRedundancyForBoot(OTPPorts &ports, int differential, unsigned address, const unsigned (&?prefix)[], unsigned prefixSize, const unsigned payload[], unsigned payloadSize, unsigned maxSize, int writeDisableCrc); int CheckStats(const OTPStats &stats, unsigned allowed); #define _otp_soft_redundancy_h_ int otpsoftredundancy_program(OTPPorts &ports, unsigned address, const unsigned payload[], unsigned payloadSize, unsigned maxSize, unsigned &size); int otpsoftredundancy_program_differential(OTPPorts &ports, unsigned address, const unsigned payload[], unsigned payloadSize, unsigned maxSize, unsigned &size); int otpsoftredundancy_read(OTPPorts &ports, unsigned address, unsigned data[], unsigned size); int otpsoftredundancy_read_differential(OTPPorts &ports, unsigned address, unsigned data[], unsigned size); #include #include #include #include enum BurnStatus { STATUS_SUCCESS, STATUS_FAIL_MARGINAL, STATUS_FAIL_SOAKED, STATUS_FAIL_WRITE }; on tile[0]: OTPPorts ports_0_0 = OTP_PORTS_INITIALIZER; on tile[1]: OTPPorts ports_0_1 = OTP_PORTS_INITIALIZER; unsigned mem_0_0_0[] = { 0x00000000, 0x04060709, 0x00000102, 0x4847ffff }; unsigned mem_0_1_0[] = { 0x00000000, 0x04060709, 0x00000102, 0x4847ffff }; int program_0_0() { if(!otp_program(ports_0_0, 2044, mem_0_0_0, 4)) { return 0; } return 1; } int program_0_1() { if(!otp_program(ports_0_1, 2044, mem_0_1_0, 4)) { return 0; } return 1; } int main() { chan c[2]; par { on tile[0]: { c[0] <: program_0_0(); } on tile[1]: { c[1] <: program_0_1(); } on tile[0]: { enum BurnStatus status = STATUS_SUCCESS; for (unsigned i = 0; i < 2; i++) { int coreSuccess; c[i] :> coreSuccess; if (!coreSuccess) { status = STATUS_FAIL_WRITE; } } switch (status) { case STATUS_SUCCESS: printstr("Device successfully burnt\n"); break; case STATUS_FAIL_WRITE: printstr("Burning device failed\n"); break; } if (status != STATUS_SUCCESS) { exit(1); } } } return 0; }