1 #pragma once 2 // trace_constants.hpp: definition of constants that direct intermediate result reporting 3 // 4 // Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. 5 // 6 // This file is part of the universal numbers project, which is released under an MIT Open Source license. 7 8 namespace sw::universal { 9 10 # ifndef POSIT_VERBOSE_OUTPUT 11 // posit decode and conversion 12 constexpr bool _trace_decode = false; 13 constexpr bool _trace_conversion = false; 14 constexpr bool _trace_rounding = false; 15 16 // arithmetic operator tracing 17 constexpr bool _trace_add = false; 18 constexpr bool _trace_sub = false; 19 constexpr bool _trace_mul = false; 20 constexpr bool _trace_div = false; 21 constexpr bool _trace_reciprocate = false; 22 constexpr bool _trace_sqrt = false; 23 24 // quire update tracing 25 constexpr bool _trace_quire_add = false; 26 27 # else // !POSIT_VERBOSE_OUTPUT 28 29 #ifdef POSIT_TRACE_ALL 30 #define POSIT_TRACE_DECODE 31 #define POSIT_TRACE_CONVERSION 32 #define POSIT_TRACE_ROUNDING 33 #define POSIT_TRACE_ADD 34 #define POSIT_TRACE_SUB 35 #define POSIT_TRACE_MUL 36 #define POSIT_TRACE_DIV 37 #define POSIT_TRACE_RECIPROCATE 38 #define POSIT_TRACE_SQRT 39 40 #define VALUE_TRACE_CONVERSION 41 #define VALUE_TRACE_ADD 42 #define VALUE_TRACE_SUB 43 #define VALUE_TRACE_MUL 44 #define VALUE_TRACE_DIV 45 #endif 46 47 #ifdef QUIRE_TRACE_ALL 48 #define QUIRE_TRACE_ADD 49 #endif 50 51 // posit decode and conversion 52 53 #ifndef POSIT_TRACE_DECODE 54 constexpr bool _trace_decode = false; 55 #else 56 constexpr bool _trace_decode = true; 57 #endif 58 59 #ifndef POSIT_TRACE_CONVERSION 60 constexpr bool _trace_conversion = false; 61 #else 62 #define VALUE_TRACE_CONVERSION 63 constexpr bool _trace_conversion = true; 64 #endif 65 66 #ifndef POSIT_TRACE_ROUNDING 67 constexpr bool _trace_rounding = false; 68 #else 69 constexpr bool _trace_rounding = true; 70 #endif 71 72 // arithmetic operator tracing 73 #ifndef POSIT_TRACE_ADD 74 constexpr bool _trace_add = false; 75 #else 76 #define VALUE_TRACE_ADD 77 constexpr bool _trace_add = true; 78 #endif 79 80 #ifndef POSIT_TRACE_SUB 81 constexpr bool _trace_sub = false; 82 #else 83 #define VALUE_TRACE_SUB 84 constexpr bool _trace_sub = true; 85 #endif 86 87 #ifndef POSIT_TRACE_MUL 88 constexpr bool _trace_mul = false; 89 #else 90 #define VALUE_TRACE_MUL 91 constexpr bool _trace_mul = true; 92 #endif 93 94 #ifndef POSIT_TRACE_DIV 95 constexpr bool _trace_div = false; 96 #else 97 #define VALUE_TRACE_DIV 98 constexpr bool _trace_div = true; 99 #endif 100 101 #ifndef POSIT_TRACE_RECIPROCATE 102 constexpr bool _trace_reciprocate = false; 103 #else 104 constexpr bool _trace_reciprocate = true; 105 #endif 106 107 #ifndef POSIT_TRACE_SQRT 108 constexpr bool _trace_sqrt = false; 109 #else 110 constexpr bool _trace_sqrt = true; 111 #endif 112 113 // QUIRE tracing 114 #ifndef QUIRE_TRACE_ADD 115 constexpr bool _trace_quire_add = false; 116 #else 117 constexpr bool _trace_quire_add = true; 118 #endif 119 120 # endif 121 122 } // namespace sw::universal 123