[2] | 1 | #ifndef morpheo_behavioural_Parameters_h |
---|
| 2 | #define morpheo_behavioural_Parameters_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id: Parameters.h 82 2008-05-01 16:48:45Z rosiere $ |
---|
| 6 | * |
---|
[77] | 7 | * [ Description ] |
---|
[2] | 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #include <stdint.h> |
---|
| 12 | #include <iostream> |
---|
| 13 | #include <math.h> |
---|
[81] | 14 | #include "Behavioural/include/Environment.h" |
---|
[72] | 15 | #include "Behavioural/include/Constants.h" |
---|
[78] | 16 | #include "Behavioural/include/Test.h" |
---|
[44] | 17 | #include "Common/include/ErrorMorpheo.h" |
---|
| 18 | #include "Common/include/ToString.h" |
---|
[62] | 19 | #include "Common/include/Log2.h" |
---|
[44] | 20 | #include "Common/include/Debug.h" |
---|
[2] | 21 | |
---|
| 22 | namespace morpheo { |
---|
| 23 | namespace behavioural { |
---|
| 24 | |
---|
[81] | 25 | template <typename T> bool test (uint32_t size) |
---|
| 26 | { |
---|
| 27 | return (size <= (8*sizeof(T))); |
---|
| 28 | }; |
---|
| 29 | |
---|
[78] | 30 | class Parameters_test |
---|
| 31 | { |
---|
| 32 | private : std::string _component; |
---|
| 33 | protected : std::string _error; |
---|
| 34 | protected : std::string _warning; |
---|
| 35 | protected : std::string _information; |
---|
| 36 | |
---|
| 37 | public : Parameters_test (std::string component) |
---|
| 38 | { |
---|
| 39 | _component = component; |
---|
| 40 | _error = ""; |
---|
| 41 | _warning = ""; |
---|
| 42 | }; |
---|
| 43 | public : ~Parameters_test (void) {}; |
---|
| 44 | |
---|
| 45 | public : bool have_error (void) { return (_error.length() != 0);}; |
---|
[82] | 46 | public : void error (std::string str) { _error += MSG_ERROR ; _error += " <" + _component + "> " + str + "\n";} |
---|
| 47 | public : void warning (std::string str) { _warning += MSG_WARNING ; _warning += " <" + _component + "> " + str + "\n";} |
---|
| 48 | public : void information (std::string str) { _information += MSG_INFORMATION; _information += " <" + _component + "> " + str + "\n";} |
---|
[78] | 49 | public : std::string print (void) { return _error + _warning + _information;}; |
---|
| 50 | }; |
---|
| 51 | |
---|
[2] | 52 | // Virtual Class - Interface of each component |
---|
| 53 | class Parameters |
---|
| 54 | { |
---|
[77] | 55 | // -----[ fields ]---------------------------------------------------- |
---|
[78] | 56 | public : static const uint32_t _size_instruction = 32; |
---|
| 57 | public : static const uint32_t _nb_operation = MAX_OPERATION; |
---|
| 58 | public : static const uint32_t _nb_type = MAX_TYPE; |
---|
| 59 | public : static const uint32_t _size_operation = SIZE_OPERATION; |
---|
| 60 | public : static const uint32_t _size_type = SIZE_TYPE; |
---|
| 61 | public : static const uint32_t _size_exception = SIZE_EXCEPTION; |
---|
| 62 | public : static const uint32_t _size_exception_use = SIZE_EXCEPTION_USE; |
---|
| 63 | public : static const uint32_t _size_exception_memory = SIZE_EXCEPTION_MEMORY; |
---|
| 64 | public : static const uint32_t _size_exception_custom = SIZE_EXCEPTION_CUSTOM; |
---|
| 65 | public : static const uint32_t _size_exception_alu = SIZE_EXCEPTION_ALU ; |
---|
| 66 | public : static const uint32_t _size_exception_decod = SIZE_EXCEPTION_DECOD ; |
---|
| 67 | public : static const uint32_t _size_exception_ifetch = SIZE_EXCEPTION_IFETCH; |
---|
| 68 | public : static const uint32_t _size_icache_type = SIZE_ICACHE_TYPE; |
---|
| 69 | public : static const uint32_t _size_icache_error = SIZE_ICACHE_ERROR; |
---|
| 70 | public : static const uint32_t _size_dcache_type = SIZE_DCACHE_TYPE; |
---|
| 71 | public : static const uint32_t _size_dcache_error = SIZE_DCACHE_ERROR; |
---|
| 72 | public : static const uint32_t _nb_general_register_logic = 32; |
---|
| 73 | public : static const uint32_t _nb_special_register_logic = NB_SPR_LOGIC; |
---|
| 74 | public : static const uint32_t _size_general_register_logic = 5; |
---|
| 75 | public : static const uint32_t _size_special_register_logic = LOG2_NB_SPR_LOGIC; |
---|
| 76 | public : static const uint32_t _size_event_state = SIZE_EVENT_STATE; |
---|
| 77 | public : static const uint32_t _size_event_type = SIZE_EVENT_TYPE; |
---|
| 78 | public : static const uint32_t _size_branch_state = SIZE_BRANCH_STATE; |
---|
| 79 | public : static const uint32_t _size_branch_condition = SIZE_BRANCH_CONDITION; |
---|
[2] | 80 | |
---|
[77] | 81 | // -----[ methods ]--------------------------------------------------- |
---|
[81] | 82 | public : Parameters (void); |
---|
| 83 | public : virtual ~Parameters (); |
---|
[2] | 84 | |
---|
| 85 | // methods to print and test parameters |
---|
[81] | 86 | public : virtual std::string print (uint32_t depth) = 0; |
---|
| 87 | public : virtual Parameters_test msg_error (void) = 0; |
---|
[2] | 88 | |
---|
| 89 | // methods to generate configuration file |
---|
| 90 | |
---|
| 91 | // methods to test |
---|
[81] | 92 | public : void test (void); |
---|
[2] | 93 | }; |
---|
| 94 | }; // end namespace behavioural |
---|
| 95 | }; // end namespace morpheo |
---|
| 96 | |
---|
| 97 | #endif |
---|