[81] | 1 | #include "Behavioural/include/Usage.h" |
---|
| 2 | #include "Common/include/Debug.h" |
---|
| 3 | #include "Common/include/ErrorMorpheo.h" |
---|
| 4 | |
---|
| 5 | namespace morpheo { |
---|
| 6 | namespace behavioural { |
---|
| 7 | |
---|
| 8 | Tusage_t usage_set (Tusage_t usage, Tusage_t flag) |
---|
| 9 | { |
---|
| 10 | return ( usage | flag); |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | Tusage_t usage_unset (Tusage_t usage, Tusage_t flag) |
---|
| 14 | { |
---|
| 15 | return ~(~usage | flag); |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | bool usage_is_set (Tusage_t usage, Tusage_t flag) |
---|
| 19 | { |
---|
| 20 | return ((usage & flag) != 0); |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | void usage_environment (Tusage_t usage) |
---|
| 24 | { |
---|
| 25 | #ifndef SYSTEMC |
---|
| 26 | if (usage_is_set(usage,USE_SYSTEMC)) |
---|
| 27 | throw ErrorMorpheo(_("Component use the flag \"USE_SYSTEMC\", but the macro's compiler \"SYSTEMC\" is unset.")); |
---|
| 28 | #endif |
---|
| 29 | #ifndef VHDL |
---|
| 30 | if (usage_is_set(usage,USE_VHDL)) |
---|
| 31 | throw ErrorMorpheo(_("Component use the flag \"USE_VHDL\", but the macro's compiler \"VHDL\" is unset.")); |
---|
| 32 | #endif |
---|
| 33 | #ifndef VHDL_TESTBENCH |
---|
| 34 | if (usage_is_set(usage,USE_VHDL_TESTBENCH)) |
---|
| 35 | throw ErrorMorpheo(_("Component use the flag \"USE_VHDL_TESTBENCH\", but the macro's compiler \"VHDL_TESTBENCH\" is unset.")); |
---|
| 36 | #endif |
---|
| 37 | #ifndef VHDL_TESTBENCH_ASSERT |
---|
| 38 | if (usage_is_set(usage,USE_VHDL_TESTBENCH_ASSERT)) |
---|
| 39 | throw ErrorMorpheo(_("Component use the flag \"USE_VHDL_TESTBENCH_ASSERT\", but the macro's compiler \"VHDL_TESTBENCH_ASSERT\" is unset.")); |
---|
| 40 | #endif |
---|
| 41 | #ifndef POSITION |
---|
| 42 | if (usage_is_set(usage,USE_POSITION)) |
---|
| 43 | throw ErrorMorpheo(_("Component use the flag \"USE_POSITION\", but the macro's compiler \"POSITION\" is unset.")); |
---|
| 44 | #endif |
---|
| 45 | #ifndef STATISTICS |
---|
| 46 | if (usage_is_set(usage,USE_STATISTICS)) |
---|
| 47 | throw ErrorMorpheo(_("Component use the flag \"USE_STATISTICS\", but the macro's compiler \"STATISTICS\" is unset.")); |
---|
| 48 | #endif |
---|
| 49 | #ifndef INFORMATION |
---|
| 50 | if (usage_is_set(usage,USE_INFORMATION)) |
---|
| 51 | throw ErrorMorpheo(_("Component use the flag \"USE_INFORMATION\", but the macro's compiler \"INFORMATION\" is unset.")); |
---|
| 52 | #endif |
---|
| 53 | |
---|
| 54 | #ifndef DEBUG |
---|
| 55 | #endif |
---|
| 56 | |
---|
| 57 | if (usage_is_set(usage,USE_STATISTICS) and not usage_is_set(usage,USE_SYSTEMC)) |
---|
| 58 | throw ErrorMorpheo(_("Usage flags conflit : to use the statistics, you must set flag USE_SYSTEMC")); |
---|
| 59 | |
---|
| 60 | if (usage_is_set(usage,USE_INFORMATION) and not usage_is_set(usage,USE_STATISTICS)) |
---|
| 61 | throw ErrorMorpheo(_("Usage flags conflit : to use the information, you must set flag USE_STATISTICS")); |
---|
| 62 | |
---|
| 63 | if (usage_is_set(usage,USE_VHDL_TESTBENCH) and not usage_is_set(usage,USE_SYSTEMC)) |
---|
| 64 | throw ErrorMorpheo(_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_SYSTEMC")); |
---|
| 65 | |
---|
| 66 | if (usage_is_set(usage,USE_VHDL_TESTBENCH) and not usage_is_set(usage,USE_VHDL)) |
---|
| 67 | throw ErrorMorpheo(_("Usage flags conflit : to use the vhdl's test bench, you must set flag USE_VHDL")); |
---|
| 68 | |
---|
| 69 | if (usage_is_set(usage,USE_VHDL_TESTBENCH_ASSERT) and not usage_is_set(usage,USE_VHDL_TESTBENCH)) |
---|
| 70 | throw ErrorMorpheo(_("Usage flags conflit : to use an assert in vhdl's test bench, you must set flag USE_VHDL_TESTBENCH")); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | Tusage_t usage_all (void) |
---|
| 74 | { |
---|
| 75 | Tusage_t usage = USE_NONE; |
---|
| 76 | |
---|
| 77 | #ifdef SYSTEMC |
---|
| 78 | usage = usage_set(usage,USE_SYSTEMC); |
---|
| 79 | #endif |
---|
| 80 | #ifdef VHDL |
---|
| 81 | usage = usage_set(usage,USE_VHDL); |
---|
| 82 | #endif |
---|
| 83 | #ifdef VHDL_TESTBENCH |
---|
| 84 | usage = usage_set(usage,USE_VHDL_TESTBENCH); |
---|
| 85 | #endif |
---|
| 86 | #ifdef VHDL_TESTBENCH_ASSERT |
---|
| 87 | usage = usage_set(usage,USE_VHDL_TESTBENCH_ASSERT); |
---|
| 88 | #endif |
---|
| 89 | #ifdef POSITION |
---|
| 90 | usage = usage_set(usage,USE_POSITION); |
---|
| 91 | #endif |
---|
| 92 | #ifdef STATISTICS |
---|
| 93 | usage = usage_set(usage,USE_STATISTICS); |
---|
| 94 | #endif |
---|
| 95 | #ifdef INFORMATION |
---|
| 96 | usage = usage_set(usage,USE_INFORMATION); |
---|
| 97 | #endif |
---|
| 98 | |
---|
| 99 | #ifdef DEBUG |
---|
| 100 | #endif |
---|
| 101 | |
---|
| 102 | return usage; |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | }; // end namespace behavioural |
---|
| 107 | }; // end namespace morpheo |
---|