| 1 | #ifndef morpheo_behavioural_Parameters_h | 
|---|
| 2 | #define morpheo_behavioural_Parameters_h | 
|---|
| 3 |  | 
|---|
| 4 | /* | 
|---|
| 5 | * $Id: Parameters.h 117 2009-05-16 14:42:39Z rosiere $ | 
|---|
| 6 | * | 
|---|
| 7 | * [ Description ] | 
|---|
| 8 | * | 
|---|
| 9 | */ | 
|---|
| 10 |  | 
|---|
| 11 | #include "Common/include/Environment.h" | 
|---|
| 12 | #include "Behavioural/include/Parameters_test.h" | 
|---|
| 13 | #include "Behavioural/include/Constants.h" | 
|---|
| 14 | #include "Behavioural/include/Test.h" | 
|---|
| 15 | #include "Common/include/ErrorMorpheo.h" | 
|---|
| 16 | #include "Common/include/ToString.h" | 
|---|
| 17 | #include "Common/include/Log2.h" | 
|---|
| 18 | #include "Common/include/Debug.h" | 
|---|
| 19 | #include <stdint.h> | 
|---|
| 20 | #include <iostream> | 
|---|
| 21 | #include <math.h> | 
|---|
| 22 |  | 
|---|
| 23 | namespace morpheo     { | 
|---|
| 24 | namespace behavioural { | 
|---|
| 25 |  | 
|---|
| 26 | #ifdef COPY | 
|---|
| 27 | #error "Need COPY macro" | 
|---|
| 28 | #endif | 
|---|
| 29 |  | 
|---|
| 30 | #define COPY(param) do {duplicate(param); param->copy();} while (0) | 
|---|
| 31 |  | 
|---|
| 32 | // Virtual Class - Interface of each component | 
|---|
| 33 | class Parameters | 
|---|
| 34 | { | 
|---|
| 35 | public   :        const std::string _type; | 
|---|
| 36 |  | 
|---|
| 37 | // -----[ fields ]---------------------------------------------------- | 
|---|
| 38 | public   : static const uint32_t   _size_instruction              = 32; | 
|---|
| 39 | public   : static const uint32_t   _size_spr                      = 32; | 
|---|
| 40 | public   : static const uint32_t   _nb_operation                  = MAX_OPERATION; | 
|---|
| 41 | public   : static const uint32_t   _nb_type                       = MAX_TYPE; | 
|---|
| 42 | public   : static const uint32_t   _size_operation                = SIZE_OPERATION; | 
|---|
| 43 | public   : static const uint32_t   _size_type                     = SIZE_TYPE; | 
|---|
| 44 | public   : static const uint32_t   _size_exception                = SIZE_EXCEPTION; | 
|---|
| 45 | public   : static const uint32_t   _size_exception_use            = SIZE_EXCEPTION_USE; | 
|---|
| 46 | public   : static const uint32_t   _size_exception_memory         = SIZE_EXCEPTION_MEMORY; | 
|---|
| 47 | public   : static const uint32_t   _size_exception_custom         = SIZE_EXCEPTION_CUSTOM; | 
|---|
| 48 | public   : static const uint32_t   _size_exception_alu            = SIZE_EXCEPTION_ALU   ; | 
|---|
| 49 | public   : static const uint32_t   _size_exception_decod          = SIZE_EXCEPTION_DECOD ; | 
|---|
| 50 | public   : static const uint32_t   _size_exception_ifetch         = SIZE_EXCEPTION_IFETCH; | 
|---|
| 51 | public   : static const uint32_t   _size_icache_type              = SIZE_ICACHE_TYPE; | 
|---|
| 52 | public   : static const uint32_t   _size_icache_error             = SIZE_ICACHE_ERROR; | 
|---|
| 53 | public   : static const uint32_t   _size_dcache_type              = SIZE_DCACHE_TYPE; | 
|---|
| 54 | public   : static const uint32_t   _size_dcache_error             = SIZE_DCACHE_ERROR; | 
|---|
| 55 | public   : static const uint32_t   _nb_general_register_logic     = 32; | 
|---|
| 56 | public   : static const uint32_t   _nb_special_register_logic     = NB_SPR_LOGIC; | 
|---|
| 57 | public   : static const uint32_t   _size_general_register_logic   = 5; | 
|---|
| 58 | public   : static const uint32_t   _size_special_register_logic   = LOG2_NB_SPR_LOGIC; | 
|---|
| 59 | public   : static const uint32_t   _size_special_address_group    = 5; | 
|---|
| 60 | public   : static const uint32_t   _size_special_address_register = 11; | 
|---|
| 61 | public   : static const uint32_t   _size_event_state              = SIZE_EVENT_STATE; | 
|---|
| 62 | public   : static const uint32_t   _size_event_type               = SIZE_EVENT_TYPE; | 
|---|
| 63 | public   : static const uint32_t   _size_branch_state             = SIZE_BRANCH_STATE; | 
|---|
| 64 | public   : static const uint32_t   _size_branch_condition         = SIZE_BRANCH_CONDITION; | 
|---|
| 65 |  | 
|---|
| 66 | public   : static const uint32_t   _shift_spr_num_group           = _size_special_address_register; | 
|---|
| 67 | public   : static const uint32_t   _mask_spr_num_group            = 0x1f ; //        1_1111 | 
|---|
| 68 | public   : static const uint32_t   _mask_spr_num_reg              = 0x7ff; // 111_1111_1111 | 
|---|
| 69 |  | 
|---|
| 70 | // simulation | 
|---|
| 71 | public  :               uint64_t   _simulation_nb_cyle                    ; | 
|---|
| 72 | public  :               uint64_t   _simulation_nb_instruction             ; | 
|---|
| 73 |  | 
|---|
| 74 | // parameters depends | 
|---|
| 75 | public   :              uint32_t   _size_context_id                       ; | 
|---|
| 76 | public   :              bool       _have_port_context_id                  ; | 
|---|
| 77 |  | 
|---|
| 78 | public   :              uint32_t   _size_front_end_id                     ; | 
|---|
| 79 | public   :              bool       _have_port_front_end_id                ; | 
|---|
| 80 |  | 
|---|
| 81 | public   :              uint32_t   _size_ooo_engine_id                    ; | 
|---|
| 82 | public   :              bool       _have_port_ooo_engine_id               ; | 
|---|
| 83 |  | 
|---|
| 84 | public   :              uint32_t   _size_instruction_address              ; | 
|---|
| 85 | //public   :              bool       _have_port_instruction_address         ; // always true | 
|---|
| 86 |  | 
|---|
| 87 | public   :              uint32_t   _size_data_address                     ; | 
|---|
| 88 | //public   :              bool       _have_port_data_address                ; // always true | 
|---|
| 89 |  | 
|---|
| 90 | public   :              uint32_t   _size_nb_inst_decod                    ; | 
|---|
| 91 | //public   :              bool       _have_port_nb_inst_decod               ; // always true | 
|---|
| 92 |  | 
|---|
| 93 | public   :              uint32_t   _size_nb_inst_commit                   ; | 
|---|
| 94 | //public   :              bool       _have_port_nb_inst_commit              ; // always true | 
|---|
| 95 |  | 
|---|
| 96 | public   :              uint32_t   _size_depth                            ; | 
|---|
| 97 | public   :              bool       _have_port_depth                       ; | 
|---|
| 98 |  | 
|---|
| 99 | public   :              uint32_t   _size_ifetch_queue_ptr                 ; | 
|---|
| 100 | public   :              bool       _have_port_ifetch_queue_ptr            ; | 
|---|
| 101 |  | 
|---|
| 102 | public   :              uint32_t   _size_inst_ifetch_ptr                  ; // nb_inst_fetch | 
|---|
| 103 | public   :              bool       _have_port_inst_ifetch_ptr             ; | 
|---|
| 104 |  | 
|---|
| 105 | //public   :              uint32_t   _size_branch_update_prediction_id      ; // = size_depth | 
|---|
| 106 | //public   :              bool       _have_port_branch_update_prediction_id ; // = size_depth | 
|---|
| 107 |  | 
|---|
| 108 | public   :              uint32_t   _size_rob_ptr                          ; | 
|---|
| 109 | public   :              bool       _have_port_rob_ptr                     ; | 
|---|
| 110 |  | 
|---|
| 111 | public   :              uint32_t   _size_load_queue_ptr                   ; | 
|---|
| 112 | public   :              bool       _have_port_load_queue_ptr              ; | 
|---|
| 113 |  | 
|---|
| 114 | public   :              uint32_t   _size_store_queue_ptr                  ; | 
|---|
| 115 | public   :              bool       _have_port_store_queue_ptr             ; // always true (min = 1) | 
|---|
| 116 |  | 
|---|
| 117 | public   :              uint32_t   _size_general_data                     ; | 
|---|
| 118 | //public   :              bool       _have_port_general_data                ; // always true | 
|---|
| 119 |  | 
|---|
| 120 | public   :              uint32_t   _size_special_data                     ; | 
|---|
| 121 | //public   :              bool       _have_port_special_data                ; // always true | 
|---|
| 122 |  | 
|---|
| 123 | public   :              uint32_t   _size_general_register                 ; | 
|---|
| 124 | //public   :              bool       _have_port_general_register            ; // always true | 
|---|
| 125 |  | 
|---|
| 126 | public   :              uint32_t   _size_special_register                 ; | 
|---|
| 127 | //public   :              bool       _have_port_special_register            ; // always true | 
|---|
| 128 |  | 
|---|
| 129 | // -----[ methods ]--------------------------------------------------- | 
|---|
| 130 | public   :                            Parameters (void); | 
|---|
| 131 | public   :                            Parameters (std::string type); | 
|---|
| 132 | public   : virtual                   ~Parameters (); | 
|---|
| 133 |  | 
|---|
| 134 | // methods to print and test parameters | 
|---|
| 135 | public   : virtual std::string        print       (uint32_t depth) = 0; | 
|---|
| 136 | public   : virtual Parameters_test    msg_error   (void) = 0; | 
|---|
| 137 | public   : virtual std::string        id          (void) const {return "";} | 
|---|
| 138 |  | 
|---|
| 139 | // methods to copy depends parameters | 
|---|
| 140 | // (these parameters can't be static : because can have multi instance of toplevel) | 
|---|
| 141 | public   : virtual void               copy        (void) = 0; | 
|---|
| 142 | //public   :         void               copy        (Parameters * param); | 
|---|
| 143 | public   :         void               duplicate   (Parameters * param); | 
|---|
| 144 |  | 
|---|
| 145 | // methods to test | 
|---|
| 146 | public   :         void               test        (void); | 
|---|
| 147 | }; | 
|---|
| 148 | }; // end namespace behavioural | 
|---|
| 149 | }; // end namespace morpheo | 
|---|
| 150 |  | 
|---|
| 151 | #endif | 
|---|