Ignore:
Timestamp:
Dec 10, 2008, 7:31:39 PM (15 years ago)
Author:
rosiere
Message:

Almost complete design
with Test and test platform

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters.h

    r82 r88  
    99 */
    1010
    11 #include <stdint.h>
    12 #include <iostream>
    13 #include <math.h>
    14 #include "Behavioural/include/Environment.h"
     11#include "Common/include/Environment.h"
     12#include "Behavioural/include/Parameters_test.h"
    1513#include "Behavioural/include/Constants.h"
    1614#include "Behavioural/include/Test.h"
     
    1917#include "Common/include/Log2.h"
    2018#include "Common/include/Debug.h"
     19#include <stdint.h>
     20#include <iostream>
     21#include <math.h>
    2122
    2223namespace morpheo     {
    2324namespace behavioural {
     25 
     26#ifdef COPY
     27#error "Need COPY macro"
     28#endif
    2429
    25   template <typename T> bool test (uint32_t size)
    26   {
    27     return (size <= (8*sizeof(T)));
    28   };
    29 
    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);};
    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";}
    49   public    : std::string print       (void)            { return _error + _warning + _information;};
    50   };
     30#define COPY(param) do {duplicate(param); param->copy();} while (0)
    5131
    5232  // Virtual Class - Interface of each component
     
    5434  {
    5535    // -----[ fields ]----------------------------------------------------
    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;
     36  public   : static const uint32_t   _size_instruction              = 32;
     37  public   : static const uint32_t   _size_spr                      = 32;
     38  public   : static const uint32_t   _nb_operation                  = MAX_OPERATION;
     39  public   : static const uint32_t   _nb_type                       = MAX_TYPE;
     40  public   : static const uint32_t   _size_operation                = SIZE_OPERATION;
     41  public   : static const uint32_t   _size_type                     = SIZE_TYPE;     
     42  public   : static const uint32_t   _size_exception                = SIZE_EXCEPTION;
     43  public   : static const uint32_t   _size_exception_use            = SIZE_EXCEPTION_USE;
     44  public   : static const uint32_t   _size_exception_memory         = SIZE_EXCEPTION_MEMORY;
     45  public   : static const uint32_t   _size_exception_custom         = SIZE_EXCEPTION_CUSTOM;
     46  public   : static const uint32_t   _size_exception_alu            = SIZE_EXCEPTION_ALU   ;
     47  public   : static const uint32_t   _size_exception_decod          = SIZE_EXCEPTION_DECOD ;
     48  public   : static const uint32_t   _size_exception_ifetch         = SIZE_EXCEPTION_IFETCH;
     49  public   : static const uint32_t   _size_icache_type              = SIZE_ICACHE_TYPE;
     50  public   : static const uint32_t   _size_icache_error             = SIZE_ICACHE_ERROR;
     51  public   : static const uint32_t   _size_dcache_type              = SIZE_DCACHE_TYPE;
     52  public   : static const uint32_t   _size_dcache_error             = SIZE_DCACHE_ERROR;
     53  public   : static const uint32_t   _nb_general_register_logic     = 32;
     54  public   : static const uint32_t   _nb_special_register_logic     = NB_SPR_LOGIC;
     55  public   : static const uint32_t   _size_general_register_logic   = 5;
     56  public   : static const uint32_t   _size_special_register_logic   = LOG2_NB_SPR_LOGIC;
     57  public   : static const uint32_t   _size_special_address_group    = 5;
     58  public   : static const uint32_t   _size_special_address_register = 11;
     59  public   : static const uint32_t   _size_event_state              = SIZE_EVENT_STATE;
     60  public   : static const uint32_t   _size_event_type               = SIZE_EVENT_TYPE;
     61  public   : static const uint32_t   _size_branch_state             = SIZE_BRANCH_STATE;
     62  public   : static const uint32_t   _size_branch_condition         = SIZE_BRANCH_CONDITION;
     63
     64  public   : static const uint32_t   _shift_spr_num_group           = _size_special_address_register;
     65  public   : static const uint32_t   _mask_spr_num_group            = 0x1f ; //        1_1111
     66  public   : static const uint32_t   _mask_spr_num_reg              = 0x7ff; // 111_1111_1111
     67
     68    // simulation
     69  public  :               uint64_t   _simulation_nb_cyle                    ;
     70  public  :               uint64_t   _simulation_nb_instruction             ;
     71
     72    // parameters depends
     73  public   :              uint32_t   _size_context_id                       ;
     74  public   :              bool       _have_port_context_id                  ;
     75
     76  public   :              uint32_t   _size_front_end_id                     ;
     77  public   :              bool       _have_port_front_end_id                ;
     78
     79  public   :              uint32_t   _size_ooo_engine_id                    ;
     80  public   :              bool       _have_port_ooo_engine_id               ;
     81                         
     82  public   :              uint32_t   _size_instruction_address              ;
     83//public   :              bool       _have_port_instruction_address         ; // always true
     84
     85  public   :              uint32_t   _size_data_address                     ;
     86//public   :              bool       _have_port_data_address                ; // always true
     87
     88  public   :              uint32_t   _size_nb_inst_decod                    ;
     89//public   :              bool       _have_port_nb_inst_decod               ; // always true
     90
     91  public   :              uint32_t   _size_nb_inst_commit                   ;
     92//public   :              bool       _have_port_nb_inst_commit              ; // always true
     93                         
     94  public   :              uint32_t   _size_depth                            ;
     95  public   :              bool       _have_port_depth                       ;
     96                         
     97  public   :              uint32_t   _size_ifetch_queue_ptr                 ;
     98  public   :              bool       _have_port_ifetch_queue_ptr            ;
     99                         
     100  public   :              uint32_t   _size_inst_ifetch_ptr                  ; // nb_inst_fetch
     101  public   :              bool       _have_port_inst_ifetch_ptr             ;
     102                         
     103//public   :              uint32_t   _size_branch_update_prediction_id      ; // = size_depth
     104//public   :              bool       _have_port_branch_update_prediction_id ; // = size_depth
     105
     106  public   :              uint32_t   _size_rob_ptr                          ;
     107  public   :              bool       _have_port_rob_ptr                     ;
     108
     109  public   :              uint32_t   _size_load_queue_ptr                   ;
     110  public   :              bool       _have_port_load_queue_ptr              ;
     111
     112  public   :              uint32_t   _size_store_queue_ptr                  ;
     113//public   :              bool       _have_port_store_queue_ptr             ; // always true (min = 1)
     114
     115  public   :              uint32_t   _size_general_data                     ;
     116//public   :              bool       _have_port_general_data                ; // always true
     117                         
     118  public   :              uint32_t   _size_special_data                     ;
     119//public   :              bool       _have_port_special_data                ; // always true
     120 
     121  public   :              uint32_t   _size_general_register                 ;
     122//public   :              bool       _have_port_general_register            ; // always true
     123
     124  public   :              uint32_t   _size_special_register                 ;
     125//public   :              bool       _have_port_special_register            ; // always true
    80126
    81127    // -----[ methods ]---------------------------------------------------
     
    87133  public   : virtual Parameters_test    msg_error   (void) = 0;
    88134
    89     // methods to generate configuration file
    90    
     135    // methods to copy depends parameters
     136    // (these parameters can't be static : because can have multi instance of toplevel)
     137  public   : virtual void               copy        (void) = 0;
     138//public   :         void               copy        (Parameters * param);
     139  public   :         void               duplicate   (Parameters * param);
     140
    91141    // methods to test
    92142  public   :         void               test        (void);
Note: See TracChangeset for help on using the changeset viewer.