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

Almost complete design
with Test and test platform

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/Makefile

    r83 r88  
    2424library_clean                   : Context_State_library_clean
    2525
     26local_clean                     :
     27
    2628include                         $(DIR_COMPONENT)/Makefile.deps
    2729include                         $(DIR_MORPHEO)/Behavioural/Makefile.flags
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/config_min.cfg

    r83 r88  
    221       1       +1      # nb_context
    331       1       +1      # nb_decod_unit
    4 1       1       +1      # nb_ooo_engine
    541       1       +1      # nb_inst_branch_complete
    650       0       +1      # size_depth                    [0] [nb_context]
    7630      30      +1      # size_address                 
    871       1       +1      # size_inst_decod               [0] [nb_decod_unit]
    9 1       1       +1      # size_inst_commit              [0] [nb_ooo_engine]
     81       1       +1      # size_inst_commit
    1090       0       +1      # link_context_to_decod_unit    [0] [nb_context]
    11 0       0       +1      # link_decod_unit_to_ooo_engine [0] [nb_decod_unit]
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/config_mono_context.cfg

    r83 r88  
    221       1       +1      # nb_context
    331       1       *4      # nb_decod_unit
    4 1       1       *4      # nb_ooo_engine
    541       4       *4      # nb_inst_branch_complete
    650       2       +1      # size_depth                    [0] [nb_context]
    7630      30      +1      # size_address                 
    871       4       *4      # size_inst_decod               [0] [nb_decod_unit]
    9 1       4       *4      # size_inst_commit              [0] [nb_ooo_engine]
     81       4       *4      # size_inst_commit
    1090       0       +1      # link_context_to_decod_unit    [0] [nb_context]
    11 0       0       +1      # link_decod_unit_to_ooo_engine [0] [nb_decod_unit]
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/config_multi_context.cfg

    r83 r88  
    228       8       +1      # nb_context
    334       4       *4      # nb_decod_unit
    4 2       2       *4      # nb_ooo_engine
    542       2       *4      # nb_inst_branch_complete
    654       4       +1      # size_depth                    [0] [nb_context]
     
    17162       2       *4      # size_inst_decod               [2] [nb_decod_unit]
    18174       4       *4      # size_inst_decod               [3] [nb_decod_unit]
    19 8       8       *4      # size_inst_commit              [0] [nb_ooo_engine]
    20 2       2       *4      # size_inst_commit              [1] [nb_ooo_engine]
     188       8       *4      # size_inst_commit
    21190       0       +1      # link_context_to_decod_unit    [0] [nb_context]
    22201       1       +1      # link_context_to_decod_unit    [1] [nb_context]
     
    27252       2       +1      # link_context_to_decod_unit    [6] [nb_context]
    28263       3       +1      # link_context_to_decod_unit    [7] [nb_context]
    29 0       0       +1      # link_decod_unit_to_ooo_engine [0] [nb_decod_unit]
    30 1       1       +1      # link_decod_unit_to_ooo_engine [1] [nb_decod_unit]
    31 0       0       +1      # link_decod_unit_to_ooo_engine [2] [nb_decod_unit]
    32 1       1       +1      # link_decod_unit_to_ooo_engine [3] [nb_decod_unit]
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/src/main.cpp

    r83 r88  
    1616  err (_(" * nb_context                                    (uint32_t)\n"));
    1717  err (_(" * nb_decod_unit                                 (uint32_t)\n"));
    18   err (_(" * nb_ooo_engine                                 (uint32_t)\n"));
    1918  err (_(" * nb_inst_branch_complete                       (uint32_t)\n"));
    2019  err (_(" * size_depth                    [nb_context]    (uint32_t)\n"));
    2120  err (_(" * size_address                                  (uint32_t)\n"));
    2221  err (_(" * size_inst_decod               [nb_decod_unit] (uint32_t)\n"));
    23   err (_(" * size_inst_commit              [nb_ooo_engine] (uint32_t)\n"));
     22  err (_(" * size_inst_commit                              (uint32_t)\n"));
    2423  err (_(" * link_context_to_decod_unit    [nb_context]    (uint32_t)\n"));
    25   err (_(" * link_decod_unit_to_ooo_engine [nb_decod_unit] (uint32_t)\n"));
    2624
    2725  exit (1);
     
    4543  uint32_t   _nb_context              = fromString<uint32_t>(argv[x++]);
    4644  uint32_t   _nb_decod_unit           = fromString<uint32_t>(argv[x++]);
    47   uint32_t   _nb_ooo_engine           = fromString<uint32_t>(argv[x++]);
    4845  uint32_t   _nb_inst_branch_complete = fromString<uint32_t>(argv[x++]);
    4946
    50   if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_context+2*_nb_decod_unit+1*_nb_ooo_engine))
     47  if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_context+1*_nb_decod_unit))
    5148    usage (argc, argv);
    5249
     
    6057  for (uint32_t i=0; i<_nb_decod_unit; i++)
    6158    _size_inst_decod [i] = fromString<uint32_t>(argv[x++]);
    62   uint32_t * _size_inst_commit              = new uint32_t [_nb_ooo_engine];
    63   for (uint32_t i=0; i<_nb_ooo_engine; i++)
    64     _size_inst_commit [i] = fromString<uint32_t>(argv[x++]);
     59  uint32_t   _size_inst_commit              = fromString<uint32_t>(argv[x++]);
    6560  uint32_t * _link_context_to_decod_unit    = new uint32_t [_nb_context];
    6661  for (uint32_t i=0; i<_nb_context; i++)
    6762    _link_context_to_decod_unit [i] = fromString<uint32_t>(argv[x++]);
    68   uint32_t * _link_decod_unit_to_ooo_engine = new uint32_t [_nb_decod_unit];
    69   for (uint32_t i=0; i<_nb_decod_unit; i++)
    70     _link_decod_unit_to_ooo_engine [i] = fromString<uint32_t>(argv[x++]);
    7163
    7264  int _return = EXIT_SUCCESS;
     
    7668        (_nb_context                   ,
    7769         _nb_decod_unit                ,
    78          _nb_ooo_engine                ,
    7970         _nb_inst_branch_complete      ,
    8071         _size_depth                   ,
     
    8374         _size_inst_commit             ,
    8475         _link_context_to_decod_unit   ,
    85          _link_decod_unit_to_ooo_engine
     76         true
    8677         );
    8778     
     
    9889  delete [] _size_depth;                   
    9990  delete [] _size_inst_decod;             
    100   delete [] _size_inst_commit;             
    10191  delete [] _link_context_to_decod_unit;   
    102   delete [] _link_decod_unit_to_ooo_engine;
    10392
    10493  try
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/src/test.cpp

    r83 r88  
    4848  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
    4949
     50  ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_VAL               ," in_BRANCH_EVENT_VAL               ",Tcontrol_t   ,_param->_nb_context);
     51  ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_ACK               ,"out_BRANCH_EVENT_ACK               ",Tcontrol_t   ,_param->_nb_context);
     52//ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_CONTEXT_ID        ," in_BRANCH_EVENT_CONTEXT_ID        ",Tcontext_t   ,_param->_nb_context);
     53//ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_DEPTH             ," in_BRANCH_EVENT_DEPTH             ",Tdepth_t     ,_param->_nb_context);
     54//ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_MISS_PREDICTION   ," in_BRANCH_EVENT_MISS_PREDICTION   ",Tcontrol_t   ,_param->_nb_context);
     55  ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_ADDRESS_SRC       ," in_BRANCH_EVENT_ADDRESS_SRC       ",Taddress_t   ,_param->_nb_context);
     56  ALLOC1_SC_SIGNAL( in_BRANCH_EVENT_ADDRESS_DEST      ," in_BRANCH_EVENT_ADDRESS_DEST      ",Taddress_t   ,_param->_nb_context);
     57
    5058  ALLOC1_SC_SIGNAL( in_DECOD_EVENT_VAL                ," in_DECOD_EVENT_VAL                ",Tcontrol_t   ,_param->_nb_decod_unit);
    5159  ALLOC1_SC_SIGNAL(out_DECOD_EVENT_ACK                ,"out_DECOD_EVENT_ACK                ",Tcontrol_t   ,_param->_nb_decod_unit);
     
    5765  ALLOC1_SC_SIGNAL( in_DECOD_EVENT_ADDRESS_EPCR       ," in_DECOD_EVENT_ADDRESS_EPCR       ",Taddress_t   ,_param->_nb_decod_unit);
    5866                                                                                           
    59   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_VAL               ," in_COMMIT_EVENT_VAL               ",Tcontrol_t   ,_param->_nb_ooo_engine);
    60   ALLOC1_SC_SIGNAL(out_COMMIT_EVENT_ACK               ,"out_COMMIT_EVENT_ACK               ",Tcontrol_t   ,_param->_nb_ooo_engine);
    61   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_CONTEXT_ID        ," in_COMMIT_EVENT_CONTEXT_ID        ",Tcontext_t   ,_param->_nb_ooo_engine);
    62   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_DEPTH             ," in_COMMIT_EVENT_DEPTH             ",Tdepth_t     ,_param->_nb_ooo_engine);
    63   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_TYPE              ," in_COMMIT_EVENT_TYPE              ",Tevent_type_t,_param->_nb_ooo_engine);
    64   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_IS_DELAY_SLOT     ," in_COMMIT_EVENT_IS_DELAY_SLOT     ",Tcontrol_t   ,_param->_nb_ooo_engine);
    65   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_ADDRESS           ," in_COMMIT_EVENT_ADDRESS           ",Taddress_t   ,_param->_nb_ooo_engine);
    66   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_ADDRESS_EPCR      ," in_COMMIT_EVENT_ADDRESS_EPCR      ",Taddress_t   ,_param->_nb_ooo_engine);
    67   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_ADDRESS_EEAR_VAL  ," in_COMMIT_EVENT_ADDRESS_EEAR_VAL  ",Tcontrol_t   ,_param->_nb_ooo_engine);
    68   ALLOC1_SC_SIGNAL( in_COMMIT_EVENT_ADDRESS_EEAR      ," in_COMMIT_EVENT_ADDRESS_EEAR      ",Taddress_t   ,_param->_nb_ooo_engine);
     67  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_VAL               ," in_COMMIT_EVENT_VAL               ",Tcontrol_t   );
     68  ALLOC_SC_SIGNAL (out_COMMIT_EVENT_ACK               ,"out_COMMIT_EVENT_ACK               ",Tcontrol_t   );
     69  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_CONTEXT_ID        ," in_COMMIT_EVENT_CONTEXT_ID        ",Tcontext_t   );
     70  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_DEPTH             ," in_COMMIT_EVENT_DEPTH             ",Tdepth_t     );
     71  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_TYPE              ," in_COMMIT_EVENT_TYPE              ",Tevent_type_t);
     72  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_IS_DELAY_SLOT     ," in_COMMIT_EVENT_IS_DELAY_SLOT     ",Tcontrol_t   );
     73  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_ADDRESS           ," in_COMMIT_EVENT_ADDRESS           ",Taddress_t   );
     74  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EPCR      ," in_COMMIT_EVENT_ADDRESS_EPCR      ",Taddress_t   );
     75  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EEAR_VAL  ," in_COMMIT_EVENT_ADDRESS_EEAR_VAL  ",Tcontrol_t   );
     76  ALLOC_SC_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EEAR      ," in_COMMIT_EVENT_ADDRESS_EEAR      ",Taddress_t   );
    6977
    7078  ALLOC1_SC_SIGNAL( in_BRANCH_COMPLETE_VAL            ," in_BRANCH_COMPLETE_VAL            ",Tcontrol_t   ,_param->_nb_inst_branch_complete);
     
    7886
    7987                                                                                           
    80   ALLOC1_SC_SIGNAL( in_NB_INST_DECOD_ALL              ," in_NB_INST_DECOD_ALL              ",Tcounter_t   ,_param->_nb_decod_unit);
    81   ALLOC1_SC_SIGNAL( in_NB_INST_COMMIT_ALL             ," in_NB_INST_COMMIT_ALL             ",Tcounter_t   ,_param->_nb_ooo_engine);
    82   ALLOC1_SC_SIGNAL( in_NB_INST_COMMIT_MEM             ," in_NB_INST_COMMIT_MEM             ",Tcounter_t   ,_param->_nb_ooo_engine);
     88  ALLOC1_SC_SIGNAL( in_NB_INST_DECOD_ALL              ," in_NB_INST_DECOD_ALL              ",Tcounter_t   ,_param->_nb_context   );
     89  ALLOC1_SC_SIGNAL( in_NB_INST_COMMIT_ALL             ," in_NB_INST_COMMIT_ALL             ",Tcounter_t   ,_param->_nb_context   );
     90  ALLOC1_SC_SIGNAL( in_NB_INST_COMMIT_MEM             ," in_NB_INST_COMMIT_MEM             ",Tcounter_t   ,_param->_nb_context   );
    8391                                                                                           
    8492  ALLOC1_SC_SIGNAL(out_EVENT_VAL                      ,"out_EVENT_VAL                      ",Tcontrol_t   ,_param->_nb_context   );
     
    8997  ALLOC1_SC_SIGNAL(out_EVENT_IS_DS_TAKE               ,"out_EVENT_IS_DS_TAKE               ",Tcontrol_t   ,_param->_nb_context   );
    9098                                                                                           
    91   ALLOC1_SC_SIGNAL(out_SPR_VAL                        ,"out_SPR_VAL                        ",Tcontrol_t   ,_param->_nb_context   );
    92   ALLOC1_SC_SIGNAL( in_SPR_ACK                        ," in_SPR_ACK                        ",Tcontrol_t   ,_param->_nb_context   );
    93   ALLOC1_SC_SIGNAL(out_SPR_EPCR                       ,"out_SPR_EPCR                       ",Taddress_t   ,_param->_nb_context   );
    94   ALLOC1_SC_SIGNAL(out_SPR_EEAR                       ,"out_SPR_EEAR                       ",Taddress_t   ,_param->_nb_context   );
    95   ALLOC1_SC_SIGNAL(out_SPR_EEAR_WEN                   ,"out_SPR_EEAR_WEN                   ",Tcontrol_t   ,_param->_nb_context   );
    96   ALLOC1_SC_SIGNAL(out_SPR_SR_DSX                     ,"out_SPR_SR_DSX                     ",Tcontrol_t   ,_param->_nb_context   );
    97   ALLOC1_SC_SIGNAL(out_SPR_SR_TO_ESR                  ,"out_SPR_SR_TO_ESR                  ",Tcontrol_t   ,_param->_nb_context   );
     99  ALLOC1_SC_SIGNAL(out_SPR_EVENT_VAL                  ,"out_SPR_EVENT_VAL                  ",Tcontrol_t   ,_param->_nb_context   );
     100  ALLOC1_SC_SIGNAL( in_SPR_EVENT_ACK                  ," in_SPR_EVENT_ACK                  ",Tcontrol_t   ,_param->_nb_context   );
     101  ALLOC1_SC_SIGNAL(out_SPR_EVENT_EPCR                 ,"out_SPR_EVENT_EPCR                 ",Taddress_t   ,_param->_nb_context   );
     102  ALLOC1_SC_SIGNAL(out_SPR_EVENT_EEAR                 ,"out_SPR_EVENT_EEAR                 ",Taddress_t   ,_param->_nb_context   );
     103  ALLOC1_SC_SIGNAL(out_SPR_EVENT_EEAR_WEN             ,"out_SPR_EVENT_EEAR_WEN             ",Tcontrol_t   ,_param->_nb_context   );
     104  ALLOC1_SC_SIGNAL(out_SPR_EVENT_SR_DSX               ,"out_SPR_EVENT_SR_DSX               ",Tcontrol_t   ,_param->_nb_context   );
     105  ALLOC1_SC_SIGNAL(out_SPR_EVENT_SR_TO_ESR            ,"out_SPR_EVENT_SR_TO_ESR            ",Tcontrol_t   ,_param->_nb_context   );
    98106                                                                                           
    99107  ALLOC1_SC_SIGNAL(out_CONTEXT_DECOD_ENABLE           ,"out_CONTEXT_DECOD_ENABLE           ",Tcontrol_t   ,_param->_nb_context   );
    100108                                                                                           
    101   ALLOC1_SC_SIGNAL( in_DEPTH_TAIL                     ," in_DEPTH_TAIL                     ",Tdepth_t     ,_param->_nb_context   );
     109  ALLOC1_SC_SIGNAL( in_DEPTH_MIN                      ," in_DEPTH_MIN                      ",Tdepth_t     ,_param->_nb_context   );
    102110 
     111  ALLOC1_SC_SIGNAL( in_SPR_SR_IEE                     ," in_SPR_SR_IEE                     ",Tcontrol_t   ,_param->_nb_context   );
     112  ALLOC1_SC_SIGNAL( in_SPR_SR_EPH                     ," in_SPR_SR_EPH                     ",Tcontrol_t   ,_param->_nb_context   );
     113
     114  ALLOC1_SC_SIGNAL( in_INTERRUPT_ENABLE               ," in_INTERRUPT_ENABLE               ",Tcontrol_t   ,_param->_nb_context   );
     115
    103116  /********************************************************
    104117   * Instanciation
     
    110123  (*(_Context_State->in_NRESET))       (*(in_NRESET));
    111124
     125  INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_EVENT_VAL               ,_param->_nb_context);
     126  INSTANCE1_SC_SIGNAL(_Context_State,out_BRANCH_EVENT_ACK               ,_param->_nb_context);
     127//INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_EVENT_CONTEXT_ID        ,_param->_nb_context);
     128//INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_EVENT_DEPTH             ,_param->_nb_context);
     129//INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_EVENT_MISS_PREDICTION   ,_param->_nb_context);
     130  INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_EVENT_ADDRESS_SRC       ,_param->_nb_context);
     131  INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_EVENT_ADDRESS_DEST      ,_param->_nb_context);
    112132  INSTANCE1_SC_SIGNAL(_Context_State, in_DECOD_EVENT_VAL                ,_param->_nb_decod_unit);
    113133  INSTANCE1_SC_SIGNAL(_Context_State,out_DECOD_EVENT_ACK                ,_param->_nb_decod_unit);
    114134  if (_param->_have_port_context_id)                                   
    115135  INSTANCE1_SC_SIGNAL(_Context_State, in_DECOD_EVENT_CONTEXT_ID         ,_param->_nb_decod_unit);
    116   if (_param->_have_port_max_depth)                                     
     136  if (_param->_have_port_depth)                                 
    117137  INSTANCE1_SC_SIGNAL(_Context_State, in_DECOD_EVENT_DEPTH              ,_param->_nb_decod_unit);
    118138  INSTANCE1_SC_SIGNAL(_Context_State, in_DECOD_EVENT_TYPE               ,_param->_nb_decod_unit);
     
    121141  INSTANCE1_SC_SIGNAL(_Context_State, in_DECOD_EVENT_ADDRESS_EPCR       ,_param->_nb_decod_unit);
    122142                                                                       
    123   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_VAL               ,_param->_nb_ooo_engine);
    124   INSTANCE1_SC_SIGNAL(_Context_State,out_COMMIT_EVENT_ACK               ,_param->_nb_ooo_engine);
     143  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_VAL               );
     144  INSTANCE_SC_SIGNAL (_Context_State,out_COMMIT_EVENT_ACK               );
    125145  if (_param->_have_port_context_id)                                   
    126   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_CONTEXT_ID        ,_param->_nb_ooo_engine);
    127   if (_param->_have_port_max_depth)                                     
    128   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_DEPTH             ,_param->_nb_ooo_engine);
    129   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_TYPE              ,_param->_nb_ooo_engine);
    130   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_IS_DELAY_SLOT     ,_param->_nb_ooo_engine);
    131   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_ADDRESS           ,_param->_nb_ooo_engine);
    132   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_ADDRESS_EPCR      ,_param->_nb_ooo_engine);
    133   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_ADDRESS_EEAR_VAL  ,_param->_nb_ooo_engine);
    134   INSTANCE1_SC_SIGNAL(_Context_State, in_COMMIT_EVENT_ADDRESS_EEAR      ,_param->_nb_ooo_engine);
     146  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_CONTEXT_ID        );
     147  if (_param->_have_port_depth)                                 
     148  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_DEPTH             );
     149  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_TYPE              );
     150  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_IS_DELAY_SLOT     );
     151  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_ADDRESS           );
     152  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_ADDRESS_EPCR      );
     153  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_ADDRESS_EEAR_VAL  );
     154  INSTANCE_SC_SIGNAL (_Context_State, in_COMMIT_EVENT_ADDRESS_EEAR      );
    135155
    136156  INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_COMPLETE_VAL            ,_param->_nb_inst_branch_complete);
     
    138158  if (_param->_have_port_context_id)                                   
    139159  INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_COMPLETE_CONTEXT_ID     ,_param->_nb_inst_branch_complete);
    140   if (_param->_have_port_max_depth)                                     
     160  if (_param->_have_port_depth)                                 
    141161  INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_COMPLETE_DEPTH          ,_param->_nb_inst_branch_complete);
    142162  INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_COMPLETE_MISS_PREDICTION,_param->_nb_inst_branch_complete);
     
    145165  INSTANCE1_SC_SIGNAL(_Context_State, in_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete);
    146166
    147   INSTANCE1_SC_SIGNAL(_Context_State, in_NB_INST_DECOD_ALL              ,_param->_nb_decod_unit);
    148   INSTANCE1_SC_SIGNAL(_Context_State, in_NB_INST_COMMIT_ALL             ,_param->_nb_ooo_engine);
    149   INSTANCE1_SC_SIGNAL(_Context_State, in_NB_INST_COMMIT_MEM             ,_param->_nb_ooo_engine);
     167  INSTANCE1_SC_SIGNAL(_Context_State, in_NB_INST_DECOD_ALL              ,_param->_nb_context   );
     168  INSTANCE1_SC_SIGNAL(_Context_State, in_NB_INST_COMMIT_ALL             ,_param->_nb_context   );
     169  INSTANCE1_SC_SIGNAL(_Context_State, in_NB_INST_COMMIT_MEM             ,_param->_nb_context   );
    150170                                                                       
    151171  INSTANCE1_SC_SIGNAL(_Context_State,out_EVENT_VAL                      ,_param->_nb_context   );
     
    156176  INSTANCE1_SC_SIGNAL(_Context_State,out_EVENT_IS_DS_TAKE               ,_param->_nb_context   );
    157177                                                                       
    158   INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_VAL                        ,_param->_nb_context   );
    159   INSTANCE1_SC_SIGNAL(_Context_State, in_SPR_ACK                        ,_param->_nb_context   );
    160   INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EPCR                       ,_param->_nb_context   );
    161   INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EEAR                       ,_param->_nb_context   );
    162   INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EEAR_WEN                   ,_param->_nb_context   );
    163   INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_SR_DSX                     ,_param->_nb_context   );
    164   INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_SR_TO_ESR                  ,_param->_nb_context   );
     178  INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EVENT_VAL                  ,_param->_nb_context   );
     179  INSTANCE1_SC_SIGNAL(_Context_State, in_SPR_EVENT_ACK                  ,_param->_nb_context   );
     180  INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EVENT_EPCR                 ,_param->_nb_context   );
     181  INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EVENT_EEAR                 ,_param->_nb_context   );
     182  INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EVENT_EEAR_WEN             ,_param->_nb_context   );
     183  INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EVENT_SR_DSX               ,_param->_nb_context   );
     184  INSTANCE1_SC_SIGNAL(_Context_State,out_SPR_EVENT_SR_TO_ESR            ,_param->_nb_context   );
    165185                                                                       
    166186  INSTANCE1_SC_SIGNAL(_Context_State,out_CONTEXT_DECOD_ENABLE           ,_param->_nb_context   );
    167187
    168188  for (uint32_t i=0; i<_param->_nb_context; i++)
    169     if (_param->_have_port_depth [i])
    170       INSTANCE_SC_SIGNAL(_Context_State, in_DEPTH_TAIL [i]);
     189    if (_param->_have_port_depth)
     190      INSTANCE_SC_SIGNAL(_Context_State, in_DEPTH_MIN [i]);
     191
     192  INSTANCE1_SC_SIGNAL(_Context_State, in_SPR_SR_IEE                     ,_param->_nb_context   );
     193  INSTANCE1_SC_SIGNAL(_Context_State, in_SPR_SR_EPH                     ,_param->_nb_context   );
     194
     195  INSTANCE1_SC_SIGNAL(_Context_State, in_INTERRUPT_ENABLE               ,_param->_nb_context   );
    171196
    172197  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
     
    206231      for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
    207232        in_DECOD_EVENT_VAL [i]->write(0);
    208       for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
    209         in_COMMIT_EVENT_VAL [i]->write(0);
     233      in_COMMIT_EVENT_VAL ->write(0);
    210234      for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
    211235        in_BRANCH_COMPLETE_VAL [i]->write(0);
     
    213237      for (uint32_t i=0; i<_param->_nb_context; i++)
    214238        {
    215           in_EVENT_ACK [i]->write(0);
    216           in_SPR_ACK   [i]->write(0);
     239          in_BRANCH_EVENT_VAL [i]->write(0);
     240          in_EVENT_ACK        [i]->write(0);
     241          in_SPR_EVENT_ACK    [i]->write(0);
     242          in_SPR_SR_IEE       [i]->write(0);
     243          in_SPR_SR_EPH       [i]->write(0);
     244          in_INTERRUPT_ENABLE [i]->write(0);
    217245
    218246          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[i]->read(), 1);
     
    220248
    221249      for (uint32_t i=0; i<_param->_nb_context; i++)
    222         if (_param->_have_port_depth [i])
    223           in_DEPTH_TAIL [i]->write(i%_param->_size_depth[i]);
     250        if (_param->_have_port_depth)
     251          in_DEPTH_MIN  [i]->write((_param->_array_size_depth[i]==0)?0:(i%_param->_array_size_depth[i]));
    224252     
    225253      uint32_t context    = rand()%_param->_nb_context;
    226       uint32_t decod_unit = _param->_link_context_to_decod_unit    [context];
    227       uint32_t ooo_engine = _param->_link_decod_unit_to_ooo_engine [decod_unit];
    228254
    229255      if (1)
     
    232258         
    233259          LABEL("msync (begin)");
    234           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    235           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    236           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
     260          in_NB_INST_DECOD_ALL  [context]->write(1);
     261          in_NB_INST_COMMIT_ALL [context]->write(1);
     262          in_NB_INST_COMMIT_MEM [context]->write(1);
    237263         
    238264          uint32_t port = rand()%_param->_nb_decod_unit;
     
    242268          in_DECOD_EVENT_ADDRESS       [port]->write(0x100);
    243269          in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdeadbeef);
    244           if (_param->_have_port_depth [context])
    245           in_DECOD_EVENT_DEPTH         [port]->write((context+1)%_param->_size_depth[context]);
     270          if (_param->_have_port_depth)
     271          in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
    246272          in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_MSYNC);
    247273         
     
    263289          SC_START(3);
    264290         
    265           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    266           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    267           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     291          in_NB_INST_DECOD_ALL  [context]->write(0);
     292          in_NB_INST_COMMIT_ALL [context]->write(1);
     293          in_NB_INST_COMMIT_MEM [context]->write(0);
    268294         
    269295          SC_START(1);
     
    274300          SC_START(3);
    275301         
    276           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
     302          in_NB_INST_DECOD_ALL  [context]->write(1);
    277303          SC_START(1);
    278304         
    279305          LABEL("msync (wait end)");
    280306          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
    281           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    282           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
    283          
    284           SC_START(3);
    285          
    286           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     307          in_NB_INST_DECOD_ALL  [context]->write(0);
     308          in_NB_INST_COMMIT_MEM [context]->write(1);
     309         
     310          SC_START(3);
     311         
     312          in_NB_INST_COMMIT_MEM [context]->write(0);
    287313          SC_START(1);
    288314          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     
    294320
    295321          LABEL("psync (begin)");
    296           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    297           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    298           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
     322          in_NB_INST_DECOD_ALL  [context]->write(1);
     323          in_NB_INST_COMMIT_ALL [context]->write(1);
     324          in_NB_INST_COMMIT_MEM [context]->write(1);
    299325         
    300326          uint32_t port = rand()%_param->_nb_decod_unit;
     
    304330          in_DECOD_EVENT_ADDRESS       [port]->write(0x200);
    305331          in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdeadbebe);
    306           if (_param->_have_port_depth [context])
    307           in_DECOD_EVENT_DEPTH         [port]->write((context+1)%_param->_size_depth[context]);
     332          if (_param->_have_port_depth)
     333          in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
    308334          in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_PSYNC);
    309335         
     
    325351          SC_START(3);
    326352         
    327           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    328           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    329           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     353          in_NB_INST_DECOD_ALL  [context]->write(0);
     354          in_NB_INST_COMMIT_ALL [context]->write(0);
     355          in_NB_INST_COMMIT_MEM [context]->write(0);
    330356         
    331357          SC_START(1);
     
    361387
    362388          LABEL("csync (begin)");
    363           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    364           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    365           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
     389          in_NB_INST_DECOD_ALL  [context]->write(1);
     390          in_NB_INST_COMMIT_ALL [context]->write(1);
     391          in_NB_INST_COMMIT_MEM [context]->write(1);
    366392         
    367393          uint32_t port = rand()%_param->_nb_decod_unit;
     
    371397          in_DECOD_EVENT_ADDRESS       [port]->write(0x200);
    372398          in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdeadbebe);
    373           if (_param->_have_port_depth [context])
    374           in_DECOD_EVENT_DEPTH         [port]->write((context+1)%_param->_size_depth[context]);
     399          if (_param->_have_port_depth)
     400          in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
    375401          in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_CSYNC);
    376402         
     
    392418          SC_START(3);
    393419         
    394           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    395           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    396           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     420          in_NB_INST_DECOD_ALL  [context]->write(0);
     421          in_NB_INST_COMMIT_ALL [context]->write(0);
     422          in_NB_INST_COMMIT_MEM [context]->write(0);
    397423         
    398424          SC_START(1);
     
    426452         
    427453          LABEL("spr (begin)");
    428           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    429           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    430           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
     454          in_NB_INST_DECOD_ALL  [context]->write(1);
     455          in_NB_INST_COMMIT_ALL [context]->write(1);
     456          in_NB_INST_COMMIT_MEM [context]->write(1);
    431457         
    432458          uint32_t port = rand()%_param->_nb_decod_unit;
     
    436462          in_DECOD_EVENT_ADDRESS       [port]->write(0x100);
    437463          in_DECOD_EVENT_ADDRESS_EPCR  [port]->write(0xdeadbeef);
    438           if (_param->_have_port_depth [context])
    439           in_DECOD_EVENT_DEPTH         [port]->write((context+1)%_param->_size_depth[context]);
     464          if (_param->_have_port_depth)
     465          in_DECOD_EVENT_DEPTH         [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
    440466          in_DECOD_EVENT_TYPE          [port]->write(EVENT_TYPE_SPR_ACCESS);
    441467         
     
    457483          SC_START(3);
    458484         
    459           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    460           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    461           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     485          in_NB_INST_DECOD_ALL  [context]->write(0);
     486          in_NB_INST_COMMIT_ALL [context]->write(0);
     487          in_NB_INST_COMMIT_MEM [context]->write(0);
    462488         
    463489          SC_START(1);
     
    468494          SC_START(3);
    469495         
    470           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
     496          in_NB_INST_DECOD_ALL  [context]->write(1);
    471497          SC_START(1);
    472498         
    473499          LABEL("spr (wait end)");
    474500          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 0);
    475           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    476           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    477          
    478           SC_START(3);
    479          
    480           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
     501          in_NB_INST_DECOD_ALL  [context]->write(0);
     502          in_NB_INST_COMMIT_ALL [context]->write(1);
     503         
     504          SC_START(3);
     505         
     506          in_NB_INST_COMMIT_ALL [context]->write(0);
    481507          SC_START(1);
    482508          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     
    488514         
    489515          LABEL("miss (begin)");
    490           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    491           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    492           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
     516          in_NB_INST_DECOD_ALL  [context]->write(1);
     517          in_NB_INST_COMMIT_ALL [context]->write(1);
     518          in_NB_INST_COMMIT_MEM [context]->write(1);
    493519         
    494520          uint32_t port = rand()%_param->_nb_inst_branch_complete;
    495521         
    496522          in_BRANCH_COMPLETE_CONTEXT_ID       [port]->write(context);
    497           if (_param->_have_port_depth [context])
    498           in_BRANCH_COMPLETE_DEPTH            [port]->write((context+1)%_param->_size_depth[context]);
     523          if (_param->_have_port_depth)
     524          in_BRANCH_COMPLETE_DEPTH            [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
    499525          in_BRANCH_COMPLETE_ADDRESS_SRC      [port]->write(0x400);
    500526          in_BRANCH_COMPLETE_ADDRESS_DEST     [port]->write(0x500);
     
    519545          SC_START(3);
    520546         
    521           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    522           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    523           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     547          in_NB_INST_DECOD_ALL  [context]->write(0);
     548          in_NB_INST_COMMIT_ALL [context]->write(0);
     549          in_NB_INST_COMMIT_MEM [context]->write(0);
    524550         
    525551          SC_START(1);
     
    558584         
    559585          LABEL("miss (begin)");
    560           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    561           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    562           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
     586          in_NB_INST_DECOD_ALL  [context]->write(1);
     587          in_NB_INST_COMMIT_ALL [context]->write(1);
     588          in_NB_INST_COMMIT_MEM [context]->write(1);
    563589         
    564590          uint32_t port = rand()%_param->_nb_inst_branch_complete;
    565591         
    566592          in_BRANCH_COMPLETE_CONTEXT_ID       [port]->write(context);
    567           if (_param->_have_port_depth [context])
    568           in_BRANCH_COMPLETE_DEPTH            [port]->write((context+1)%_param->_size_depth[context]);
     593          if (_param->_have_port_depth)
     594          in_BRANCH_COMPLETE_DEPTH            [port]->write((_param->_array_size_depth[context]==0)?0:((context+1)%_param->_array_size_depth[context]));
    569595          in_BRANCH_COMPLETE_ADDRESS_SRC      [port]->write(0x600);
    570596          in_BRANCH_COMPLETE_ADDRESS_DEST     [port]->write(0x700);
     
    589615          SC_START(3);
    590616         
    591           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    592           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    593           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     617          in_NB_INST_DECOD_ALL  [context]->write(0);
     618          in_NB_INST_COMMIT_ALL [context]->write(0);
     619          in_NB_INST_COMMIT_MEM [context]->write(0);
    594620         
    595621          SC_START(1);
     
    626652         
    627653          LABEL("exception (begin)");
    628           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    629           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    630           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
    631          
    632           uint32_t port = rand()%_param->_nb_ooo_engine;
     654          in_NB_INST_DECOD_ALL  [context]->write(1);
     655          in_NB_INST_COMMIT_ALL [context]->write(1);
     656          in_NB_INST_COMMIT_MEM [context]->write(1);
     657         
     658          uint32_t port = rand()%_param->_nb_decod_unit;
    633659         
    634660          in_DECOD_EVENT_CONTEXT_ID       [port]->write(context);
    635           if (_param->_have_port_depth [context])
    636           in_DECOD_EVENT_DEPTH            [port]->write((context)%_param->_size_depth[context]);
     661          if (_param->_have_port_depth)
     662          in_DECOD_EVENT_DEPTH            [port]->write((_param->_array_size_depth[context]==0)?0:((context)%_param->_array_size_depth[context]));
    637663          in_DECOD_EVENT_TYPE             [port]->write(EVENT_TYPE_EXCEPTION);
    638664          in_DECOD_EVENT_IS_DELAY_SLOT    [port]->write(0);
     
    657683          SC_START(3);
    658684         
    659           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    660           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    661           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     685          in_NB_INST_DECOD_ALL  [context]->write(0);
     686          in_NB_INST_COMMIT_ALL [context]->write(0);
     687          in_NB_INST_COMMIT_MEM [context]->write(0);
    662688         
    663689          SC_START(1);
     
    693719          do
    694720            {
    695               in_SPR_ACK [context]->write(rand()%percent_transaction_spr);
    696          
    697               SC_START(0);
    698          
    699               if (out_SPR_VAL [context]->read() and in_SPR_ACK [context]->read())
    700                 {
    701                   TEST(Taddress_t,out_SPR_EPCR      [context]->read(),0x900);
    702                 //TEST(Taddress_t,out_SPR_EEAR      [context]->read(),);
    703                   TEST(Tcontrol_t,out_SPR_EEAR_WEN  [context]->read(),0);
    704                   TEST(Tcontrol_t,out_SPR_SR_DSX    [context]->read(),0);
    705                   TEST(Tcontrol_t,out_SPR_SR_TO_ESR [context]->read(),1);
    706                  
    707                   find = true;
    708                 }
    709              
    710               SC_START(1);
    711             }
    712           while (not find);
    713 
    714           in_SPR_ACK [context]->write(0);
     721              in_SPR_EVENT_ACK [context]->write(rand()%percent_transaction_spr);
     722         
     723              SC_START(0);
     724         
     725              if (out_SPR_EVENT_VAL [context]->read() and in_SPR_EVENT_ACK [context]->read())
     726                {
     727                  TEST(Taddress_t,out_SPR_EVENT_EPCR      [context]->read(),0x900);
     728                //TEST(Taddress_t,out_SPR_EVENT_EEAR      [context]->read(),);
     729                  TEST(Tcontrol_t,out_SPR_EVENT_EEAR_WEN  [context]->read(),0);
     730                  TEST(Tcontrol_t,out_SPR_EVENT_SR_DSX    [context]->read(),0);
     731                  TEST(Tcontrol_t,out_SPR_EVENT_SR_TO_ESR [context]->read(),1);
     732                 
     733                  find = true;
     734                }
     735             
     736              SC_START(1);
     737            }
     738          while (not find);
     739
     740          in_SPR_EVENT_ACK [context]->write(0);
    715741        }
    716742
     
    720746         
    721747          LABEL("exception (begin)");
    722           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    723           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    724           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
    725          
    726           uint32_t port = rand()%_param->_nb_ooo_engine;
     748          in_NB_INST_DECOD_ALL  [context]->write(1);
     749          in_NB_INST_COMMIT_ALL [context]->write(1);
     750          in_NB_INST_COMMIT_MEM [context]->write(1);
     751         
     752          uint32_t port = rand()%_param->_nb_decod_unit;
    727753         
    728754          in_DECOD_EVENT_CONTEXT_ID       [port]->write(context);
    729           if (_param->_have_port_depth [context])
    730           in_DECOD_EVENT_DEPTH            [port]->write((context)%_param->_size_depth[context]);
     755          if (_param->_have_port_depth)
     756          in_DECOD_EVENT_DEPTH            [port]->write((_param->_array_size_depth[context]==0)?0:((context)%_param->_array_size_depth[context]));
    731757          in_DECOD_EVENT_TYPE             [port]->write(EVENT_TYPE_EXCEPTION);
    732758          in_DECOD_EVENT_IS_DELAY_SLOT    [port]->write(1);
     
    751777          SC_START(3);
    752778         
    753           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    754           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    755           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     779          in_NB_INST_DECOD_ALL  [context]->write(0);
     780          in_NB_INST_COMMIT_ALL [context]->write(0);
     781          in_NB_INST_COMMIT_MEM [context]->write(0);
    756782         
    757783          SC_START(1);
     
    787813          do
    788814            {
    789               in_SPR_ACK [context]->write(rand()%percent_transaction_spr);
    790          
    791               SC_START(0);
    792          
    793               if (out_SPR_VAL [context]->read() and in_SPR_ACK [context]->read())
    794                 {
    795                   TEST(Taddress_t,out_SPR_EPCR      [context]->read(),0x900);
    796                 //TEST(Taddress_t,out_SPR_EEAR      [context]->read(),);
    797                   TEST(Tcontrol_t,out_SPR_EEAR_WEN  [context]->read(),0);
    798                   TEST(Tcontrol_t,out_SPR_SR_DSX    [context]->read(),1);
    799                   TEST(Tcontrol_t,out_SPR_SR_TO_ESR [context]->read(),1);
    800                  
    801                   find = true;
    802                 }
    803              
    804               SC_START(1);
    805             }
    806           while (not find);
    807 
    808           in_SPR_ACK [context]->write(0);
     815              in_SPR_EVENT_ACK [context]->write(rand()%percent_transaction_spr);
     816         
     817              SC_START(0);
     818         
     819              if (out_SPR_EVENT_VAL [context]->read() and in_SPR_EVENT_ACK [context]->read())
     820                {
     821                  TEST(Taddress_t,out_SPR_EVENT_EPCR      [context]->read(),0x900);
     822                //TEST(Taddress_t,out_SPR_EVENT_EEAR      [context]->read(),);
     823                  TEST(Tcontrol_t,out_SPR_EVENT_EEAR_WEN  [context]->read(),0);
     824                  TEST(Tcontrol_t,out_SPR_EVENT_SR_DSX    [context]->read(),1);
     825                  TEST(Tcontrol_t,out_SPR_EVENT_SR_TO_ESR [context]->read(),1);
     826                 
     827                  find = true;
     828                }
     829             
     830              SC_START(1);
     831            }
     832          while (not find);
     833
     834          in_SPR_EVENT_ACK [context]->write(0);
    809835        }
    810836
     
    814840         
    815841          LABEL("exception (begin)");
    816           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    817           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    818           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
    819          
    820           uint32_t port = rand()%_param->_nb_ooo_engine;
    821          
    822           in_COMMIT_EVENT_CONTEXT_ID       [port]->write(context);
    823           if (_param->_have_port_depth [context])
    824           in_COMMIT_EVENT_DEPTH            [port]->write((context)%_param->_size_depth[context]);
    825           in_COMMIT_EVENT_TYPE             [port]->write(EVENT_TYPE_EXCEPTION);
    826           in_COMMIT_EVENT_IS_DELAY_SLOT    [port]->write(0);
    827           in_COMMIT_EVENT_ADDRESS          [port]->write(0xa00);
    828           in_COMMIT_EVENT_ADDRESS_EPCR     [port]->write(0xb00);
    829           in_COMMIT_EVENT_ADDRESS_EEAR     [port]->write(0xc00);
    830           in_COMMIT_EVENT_ADDRESS_EEAR_VAL [port]->write(0);
    831 
    832           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    833          
    834           do
    835             {
    836               in_COMMIT_EVENT_VAL [port]->write(rand()%percent_transaction_commit_event);
    837              
    838               SC_START(1);
    839             }
    840           while (not ( in_COMMIT_EVENT_VAL [port]->read() and
    841                        out_COMMIT_EVENT_ACK [port]->read()));
    842           in_COMMIT_EVENT_VAL [port]->write(0);
     842          in_NB_INST_DECOD_ALL  [context]->write(1);
     843          in_NB_INST_COMMIT_ALL [context]->write(1);
     844          in_NB_INST_COMMIT_MEM [context]->write(1);
     845         
     846          in_COMMIT_EVENT_CONTEXT_ID       ->write(context);
     847          if (_param->_have_port_depth)
     848          in_COMMIT_EVENT_DEPTH            ->write((_param->_array_size_depth[context]==0)?0:((context)%_param->_array_size_depth[context]));
     849          in_COMMIT_EVENT_TYPE             ->write(EVENT_TYPE_EXCEPTION);
     850          in_COMMIT_EVENT_IS_DELAY_SLOT    ->write(0);
     851          in_COMMIT_EVENT_ADDRESS          ->write(0xa00);
     852          in_COMMIT_EVENT_ADDRESS_EPCR     ->write(0xb00);
     853          in_COMMIT_EVENT_ADDRESS_EEAR     ->write(0xc00);
     854          in_COMMIT_EVENT_ADDRESS_EEAR_VAL ->write(0);
     855
     856          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     857         
     858          do
     859            {
     860              in_COMMIT_EVENT_VAL ->write(rand()%percent_transaction_commit_event);
     861             
     862              SC_START(1);
     863            }
     864          while (not ( in_COMMIT_EVENT_VAL ->read() and
     865                       out_COMMIT_EVENT_ACK ->read()));
     866          in_COMMIT_EVENT_VAL ->write(0);
    843867         
    844868          LABEL("exception (wait end)");
     
    847871          SC_START(3);
    848872         
    849           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    850           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    851           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     873          in_NB_INST_DECOD_ALL  [context]->write(0);
     874          in_NB_INST_COMMIT_ALL [context]->write(0);
     875          in_NB_INST_COMMIT_MEM [context]->write(0);
    852876         
    853877          SC_START(1);
     
    883907          do
    884908            {
    885               in_SPR_ACK [context]->write(rand()%percent_transaction_spr);
    886          
    887               SC_START(0);
    888          
    889               if (out_SPR_VAL [context]->read() and in_SPR_ACK [context]->read())
    890                 {
    891                   TEST(Taddress_t,out_SPR_EPCR      [context]->read(),0xb00);
    892                   TEST(Taddress_t,out_SPR_EEAR      [context]->read(),0xc00);
    893                   TEST(Tcontrol_t,out_SPR_EEAR_WEN  [context]->read(),0);
    894                   TEST(Tcontrol_t,out_SPR_SR_DSX    [context]->read(),0);
    895                   TEST(Tcontrol_t,out_SPR_SR_TO_ESR [context]->read(),1);
    896                  
    897                   find = true;
    898                 }
    899              
    900               SC_START(1);
    901             }
    902           while (not find);
    903 
    904           in_SPR_ACK [context]->write(0);
     909              in_SPR_EVENT_ACK [context]->write(rand()%percent_transaction_spr);
     910         
     911              SC_START(0);
     912         
     913              if (out_SPR_EVENT_VAL [context]->read() and in_SPR_EVENT_ACK [context]->read())
     914                {
     915                  TEST(Taddress_t,out_SPR_EVENT_EPCR      [context]->read(),0xb00);
     916                  TEST(Taddress_t,out_SPR_EVENT_EEAR      [context]->read(),0xc00);
     917                  TEST(Tcontrol_t,out_SPR_EVENT_EEAR_WEN  [context]->read(),0);
     918                  TEST(Tcontrol_t,out_SPR_EVENT_SR_DSX    [context]->read(),0);
     919                  TEST(Tcontrol_t,out_SPR_EVENT_SR_TO_ESR [context]->read(),1);
     920                 
     921                  find = true;
     922                }
     923             
     924              SC_START(1);
     925            }
     926          while (not find);
     927
     928          in_SPR_EVENT_ACK [context]->write(0);
    905929        }
    906930     
     
    910934         
    911935          LABEL("exception (begin)");
    912           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    913           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    914           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
    915          
    916           uint32_t port = rand()%_param->_nb_ooo_engine;
    917          
    918           in_COMMIT_EVENT_CONTEXT_ID       [port]->write(context);
    919           if (_param->_have_port_depth [context])
    920           in_COMMIT_EVENT_DEPTH            [port]->write((context)%_param->_size_depth[context]);
    921           in_COMMIT_EVENT_TYPE             [port]->write(EVENT_TYPE_EXCEPTION);
    922           in_COMMIT_EVENT_IS_DELAY_SLOT    [port]->write(1);
    923           in_COMMIT_EVENT_ADDRESS          [port]->write(0xd00);
    924           in_COMMIT_EVENT_ADDRESS_EPCR     [port]->write(0xe00);
    925           in_COMMIT_EVENT_ADDRESS_EEAR     [port]->write(0xf00);
    926           in_COMMIT_EVENT_ADDRESS_EEAR_VAL [port]->write(0);
    927 
    928           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    929          
    930           do
    931             {
    932               in_COMMIT_EVENT_VAL [port]->write(rand()%percent_transaction_commit_event);
    933              
    934               SC_START(1);
    935             }
    936           while (not ( in_COMMIT_EVENT_VAL [port]->read() and
    937                        out_COMMIT_EVENT_ACK [port]->read()));
    938           in_COMMIT_EVENT_VAL [port]->write(0);
     936          in_NB_INST_DECOD_ALL  [context]->write(1);
     937          in_NB_INST_COMMIT_ALL [context]->write(1);
     938          in_NB_INST_COMMIT_MEM [context]->write(1);
     939         
     940          in_COMMIT_EVENT_CONTEXT_ID       ->write(context);
     941          if (_param->_have_port_depth)
     942          in_COMMIT_EVENT_DEPTH            ->write((_param->_array_size_depth[context]==0)?0:((context)%_param->_array_size_depth[context]));
     943          in_COMMIT_EVENT_TYPE             ->write(EVENT_TYPE_EXCEPTION);
     944          in_COMMIT_EVENT_IS_DELAY_SLOT    ->write(1);
     945          in_COMMIT_EVENT_ADDRESS          ->write(0xd00);
     946          in_COMMIT_EVENT_ADDRESS_EPCR     ->write(0xe00);
     947          in_COMMIT_EVENT_ADDRESS_EEAR     ->write(0xf00);
     948          in_COMMIT_EVENT_ADDRESS_EEAR_VAL ->write(0);
     949
     950          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     951         
     952          do
     953            {
     954              in_COMMIT_EVENT_VAL ->write(rand()%percent_transaction_commit_event);
     955             
     956              SC_START(1);
     957            }
     958          while (not ( in_COMMIT_EVENT_VAL ->read() and
     959                       out_COMMIT_EVENT_ACK ->read()));
     960          in_COMMIT_EVENT_VAL ->write(0);
    939961         
    940962          LABEL("exception (wait end)");
     
    943965          SC_START(3);
    944966         
    945           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    946           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    947           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     967          in_NB_INST_DECOD_ALL  [context]->write(0);
     968          in_NB_INST_COMMIT_ALL [context]->write(0);
     969          in_NB_INST_COMMIT_MEM [context]->write(0);
    948970         
    949971          SC_START(1);
     
    9791001          do
    9801002            {
    981               in_SPR_ACK [context]->write(rand()%percent_transaction_spr);
    982          
    983               SC_START(0);
    984          
    985               if (out_SPR_VAL [context]->read() and in_SPR_ACK [context]->read())
    986                 {
    987                   TEST(Taddress_t,out_SPR_EPCR      [context]->read(),0xe00);
    988                   TEST(Taddress_t,out_SPR_EEAR      [context]->read(),0xf00);
    989                   TEST(Tcontrol_t,out_SPR_EEAR_WEN  [context]->read(),0);
    990                   TEST(Tcontrol_t,out_SPR_SR_DSX    [context]->read(),1);
    991                   TEST(Tcontrol_t,out_SPR_SR_TO_ESR [context]->read(),1);
    992                  
    993                   find = true;
    994                 }
    995              
    996               SC_START(1);
    997             }
    998           while (not find);
    999 
    1000           in_SPR_ACK [context]->write(0);
     1003              in_SPR_EVENT_ACK [context]->write(rand()%percent_transaction_spr);
     1004         
     1005              SC_START(0);
     1006         
     1007              if (out_SPR_EVENT_VAL [context]->read() and in_SPR_EVENT_ACK [context]->read())
     1008                {
     1009                  TEST(Taddress_t,out_SPR_EVENT_EPCR      [context]->read(),0xe00);
     1010                  TEST(Taddress_t,out_SPR_EVENT_EEAR      [context]->read(),0xf00);
     1011                  TEST(Tcontrol_t,out_SPR_EVENT_EEAR_WEN  [context]->read(),0);
     1012                  TEST(Tcontrol_t,out_SPR_EVENT_SR_DSX    [context]->read(),1);
     1013                  TEST(Tcontrol_t,out_SPR_EVENT_SR_TO_ESR [context]->read(),1);
     1014                 
     1015                  find = true;
     1016                }
     1017             
     1018              SC_START(1);
     1019            }
     1020          while (not find);
     1021
     1022          in_SPR_EVENT_ACK [context]->write(0);
    10011023        }
    10021024
     
    10061028         
    10071029          LABEL("exception (begin)");
    1008           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    1009           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    1010           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
    1011          
    1012           uint32_t port = rand()%_param->_nb_ooo_engine;
    1013          
    1014           in_COMMIT_EVENT_CONTEXT_ID       [port]->write(context);
    1015           if (_param->_have_port_depth [context])
    1016           in_COMMIT_EVENT_DEPTH            [port]->write((context)%_param->_size_depth[context]);
    1017           in_COMMIT_EVENT_TYPE             [port]->write(EVENT_TYPE_EXCEPTION);
    1018           in_COMMIT_EVENT_IS_DELAY_SLOT    [port]->write(0);
    1019           in_COMMIT_EVENT_ADDRESS          [port]->write(0xa00);
    1020           in_COMMIT_EVENT_ADDRESS_EPCR     [port]->write(0xb00);
    1021           in_COMMIT_EVENT_ADDRESS_EEAR     [port]->write(0xc00);
    1022           in_COMMIT_EVENT_ADDRESS_EEAR_VAL [port]->write(1);
    1023 
    1024           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    1025          
    1026           do
    1027             {
    1028               in_COMMIT_EVENT_VAL [port]->write(rand()%percent_transaction_commit_event);
    1029              
    1030               SC_START(1);
    1031             }
    1032           while (not ( in_COMMIT_EVENT_VAL [port]->read() and
    1033                        out_COMMIT_EVENT_ACK [port]->read()));
    1034           in_COMMIT_EVENT_VAL [port]->write(0);
     1030          in_NB_INST_DECOD_ALL  [context]->write(1);
     1031          in_NB_INST_COMMIT_ALL [context]->write(1);
     1032          in_NB_INST_COMMIT_MEM [context]->write(1);
     1033         
     1034          in_COMMIT_EVENT_CONTEXT_ID       ->write(context);
     1035          if (_param->_have_port_depth)
     1036          in_COMMIT_EVENT_DEPTH            ->write((_param->_array_size_depth[context]==0)?0:((context)%_param->_array_size_depth[context]));
     1037          in_COMMIT_EVENT_TYPE             ->write(EVENT_TYPE_EXCEPTION);
     1038          in_COMMIT_EVENT_IS_DELAY_SLOT    ->write(0);
     1039          in_COMMIT_EVENT_ADDRESS          ->write(0xa00);
     1040          in_COMMIT_EVENT_ADDRESS_EPCR     ->write(0xb00);
     1041          in_COMMIT_EVENT_ADDRESS_EEAR     ->write(0xc00);
     1042          in_COMMIT_EVENT_ADDRESS_EEAR_VAL ->write(1);
     1043
     1044          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     1045         
     1046          do
     1047            {
     1048              in_COMMIT_EVENT_VAL ->write(rand()%percent_transaction_commit_event);
     1049             
     1050              SC_START(1);
     1051            }
     1052          while (not ( in_COMMIT_EVENT_VAL ->read() and
     1053                       out_COMMIT_EVENT_ACK ->read()));
     1054          in_COMMIT_EVENT_VAL ->write(0);
    10351055         
    10361056          LABEL("exception (wait end)");
     
    10391059          SC_START(3);
    10401060         
    1041           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    1042           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    1043           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     1061          in_NB_INST_DECOD_ALL  [context]->write(0);
     1062          in_NB_INST_COMMIT_ALL [context]->write(0);
     1063          in_NB_INST_COMMIT_MEM [context]->write(0);
    10441064         
    10451065          SC_START(1);
     
    10751095          do
    10761096            {
    1077               in_SPR_ACK [context]->write(rand()%percent_transaction_spr);
    1078          
    1079               SC_START(0);
    1080          
    1081               if (out_SPR_VAL [context]->read() and in_SPR_ACK [context]->read())
    1082                 {
    1083                   TEST(Taddress_t,out_SPR_EPCR      [context]->read(),0xb00);
    1084                   TEST(Taddress_t,out_SPR_EEAR      [context]->read(),0xc00);
    1085                   TEST(Tcontrol_t,out_SPR_EEAR_WEN  [context]->read(),1);
    1086                   TEST(Tcontrol_t,out_SPR_SR_DSX    [context]->read(),0);
    1087                   TEST(Tcontrol_t,out_SPR_SR_TO_ESR [context]->read(),1);
    1088                  
    1089                   find = true;
    1090                 }
    1091              
    1092               SC_START(1);
    1093             }
    1094           while (not find);
    1095 
    1096           in_SPR_ACK [context]->write(0);
     1097              in_SPR_EVENT_ACK [context]->write(rand()%percent_transaction_spr);
     1098         
     1099              SC_START(0);
     1100         
     1101              if (out_SPR_EVENT_VAL [context]->read() and in_SPR_EVENT_ACK [context]->read())
     1102                {
     1103                  TEST(Taddress_t,out_SPR_EVENT_EPCR      [context]->read(),0xb00);
     1104                  TEST(Taddress_t,out_SPR_EVENT_EEAR      [context]->read(),0xc00);
     1105                  TEST(Tcontrol_t,out_SPR_EVENT_EEAR_WEN  [context]->read(),1);
     1106                  TEST(Tcontrol_t,out_SPR_EVENT_SR_DSX    [context]->read(),0);
     1107                  TEST(Tcontrol_t,out_SPR_EVENT_SR_TO_ESR [context]->read(),1);
     1108                 
     1109                  find = true;
     1110                }
     1111             
     1112              SC_START(1);
     1113            }
     1114          while (not find);
     1115
     1116          in_SPR_EVENT_ACK [context]->write(0);
    10971117        }
    10981118     
     
    11021122         
    11031123          LABEL("exception (begin)");
    1104           in_NB_INST_DECOD_ALL  [decod_unit]->write(1);
    1105           in_NB_INST_COMMIT_ALL [ooo_engine]->write(1);
    1106           in_NB_INST_COMMIT_MEM [ooo_engine]->write(1);
    1107          
    1108           uint32_t port = rand()%_param->_nb_ooo_engine;
    1109          
    1110           in_COMMIT_EVENT_CONTEXT_ID       [port]->write(context);
    1111           if (_param->_have_port_depth [context])
    1112           in_COMMIT_EVENT_DEPTH            [port]->write((context)%_param->_size_depth[context]);
    1113           in_COMMIT_EVENT_TYPE             [port]->write(EVENT_TYPE_EXCEPTION);
    1114           in_COMMIT_EVENT_IS_DELAY_SLOT    [port]->write(1);
    1115           in_COMMIT_EVENT_ADDRESS          [port]->write(0xd00);
    1116           in_COMMIT_EVENT_ADDRESS_EPCR     [port]->write(0xe00);
    1117           in_COMMIT_EVENT_ADDRESS_EEAR     [port]->write(0xf00);
    1118           in_COMMIT_EVENT_ADDRESS_EEAR_VAL [port]->write(1);
    1119 
    1120           TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
    1121          
    1122           do
    1123             {
    1124               in_COMMIT_EVENT_VAL [port]->write(rand()%percent_transaction_commit_event);
    1125              
    1126               SC_START(1);
    1127             }
    1128           while (not ( in_COMMIT_EVENT_VAL [port]->read() and
    1129                        out_COMMIT_EVENT_ACK [port]->read()));
    1130           in_COMMIT_EVENT_VAL [port]->write(0);
     1124          in_NB_INST_DECOD_ALL  [context]->write(1);
     1125          in_NB_INST_COMMIT_ALL [context]->write(1);
     1126          in_NB_INST_COMMIT_MEM [context]->write(1);
     1127         
     1128          in_COMMIT_EVENT_CONTEXT_ID       ->write(context);
     1129          if (_param->_have_port_depth)
     1130          in_COMMIT_EVENT_DEPTH            ->write((_param->_array_size_depth[context]==0)?0:((context)%_param->_array_size_depth[context]));
     1131          in_COMMIT_EVENT_TYPE             ->write(EVENT_TYPE_EXCEPTION);
     1132          in_COMMIT_EVENT_IS_DELAY_SLOT    ->write(1);
     1133          in_COMMIT_EVENT_ADDRESS          ->write(0xd00);
     1134          in_COMMIT_EVENT_ADDRESS_EPCR     ->write(0xe00);
     1135          in_COMMIT_EVENT_ADDRESS_EEAR     ->write(0xf00);
     1136          in_COMMIT_EVENT_ADDRESS_EEAR_VAL ->write(1);
     1137
     1138          TEST(Tcontrol_t, out_CONTEXT_DECOD_ENABLE[context]->read(), 1);
     1139         
     1140          do
     1141            {
     1142              in_COMMIT_EVENT_VAL ->write(rand()%percent_transaction_commit_event);
     1143             
     1144              SC_START(1);
     1145            }
     1146          while (not ( in_COMMIT_EVENT_VAL ->read() and
     1147                       out_COMMIT_EVENT_ACK ->read()));
     1148          in_COMMIT_EVENT_VAL ->write(0);
    11311149         
    11321150          LABEL("exception (wait end)");
     
    11351153          SC_START(3);
    11361154         
    1137           in_NB_INST_DECOD_ALL  [decod_unit]->write(0);
    1138           in_NB_INST_COMMIT_ALL [ooo_engine]->write(0);
    1139           in_NB_INST_COMMIT_MEM [ooo_engine]->write(0);
     1155          in_NB_INST_DECOD_ALL  [context]->write(0);
     1156          in_NB_INST_COMMIT_ALL [context]->write(0);
     1157          in_NB_INST_COMMIT_MEM [context]->write(0);
    11401158         
    11411159          SC_START(1);
     
    11711189          do
    11721190            {
    1173               in_SPR_ACK [context]->write(rand()%percent_transaction_spr);
    1174          
    1175               SC_START(0);
    1176          
    1177               if (out_SPR_VAL [context]->read() and in_SPR_ACK [context]->read())
    1178                 {
    1179                   TEST(Taddress_t,out_SPR_EPCR      [context]->read(),0xe00);
    1180                   TEST(Taddress_t,out_SPR_EEAR      [context]->read(),0xf00);
    1181                   TEST(Tcontrol_t,out_SPR_EEAR_WEN  [context]->read(),1);
    1182                   TEST(Tcontrol_t,out_SPR_SR_DSX    [context]->read(),1);
    1183                   TEST(Tcontrol_t,out_SPR_SR_TO_ESR [context]->read(),1);
    1184                  
    1185                   find = true;
    1186                 }
    1187              
    1188               SC_START(1);
    1189             }
    1190           while (not find);
    1191 
    1192           in_SPR_ACK [context]->write(0);
     1191              in_SPR_EVENT_ACK [context]->write(rand()%percent_transaction_spr);
     1192         
     1193              SC_START(0);
     1194         
     1195              if (out_SPR_EVENT_VAL [context]->read() and in_SPR_EVENT_ACK [context]->read())
     1196                {
     1197                  TEST(Taddress_t,out_SPR_EVENT_EPCR      [context]->read(),0xe00);
     1198                  TEST(Taddress_t,out_SPR_EVENT_EEAR      [context]->read(),0xf00);
     1199                  TEST(Tcontrol_t,out_SPR_EVENT_EEAR_WEN  [context]->read(),1);
     1200                  TEST(Tcontrol_t,out_SPR_EVENT_SR_DSX    [context]->read(),1);
     1201                  TEST(Tcontrol_t,out_SPR_EVENT_SR_TO_ESR [context]->read(),1);
     1202                 
     1203                  find = true;
     1204                }
     1205             
     1206              SC_START(1);
     1207            }
     1208          while (not find);
     1209
     1210          in_SPR_EVENT_ACK [context]->write(0);
    11931211        }
    11941212
     
    12101228  delete in_NRESET;
    12111229
     1230  DELETE1_SC_SIGNAL( in_BRANCH_EVENT_VAL               ,_param->_nb_context);
     1231  DELETE1_SC_SIGNAL(out_BRANCH_EVENT_ACK               ,_param->_nb_context);
     1232//DELETE1_SC_SIGNAL( in_BRANCH_EVENT_CONTEXT_ID        ,_param->_nb_context);
     1233//DELETE1_SC_SIGNAL( in_BRANCH_EVENT_DEPTH             ,_param->_nb_context);
     1234//DELETE1_SC_SIGNAL( in_BRANCH_EVENT_MISS_PREDICTION   ,_param->_nb_context);
     1235  DELETE1_SC_SIGNAL( in_BRANCH_EVENT_ADDRESS_SRC       ,_param->_nb_context);
     1236  DELETE1_SC_SIGNAL( in_BRANCH_EVENT_ADDRESS_DEST      ,_param->_nb_context);
    12121237  DELETE1_SC_SIGNAL( in_DECOD_EVENT_VAL                ,_param->_nb_decod_unit);
    12131238  DELETE1_SC_SIGNAL(out_DECOD_EVENT_ACK                ,_param->_nb_decod_unit);
     
    12181243  DELETE1_SC_SIGNAL( in_DECOD_EVENT_ADDRESS            ,_param->_nb_decod_unit);
    12191244  DELETE1_SC_SIGNAL( in_DECOD_EVENT_ADDRESS_EPCR       ,_param->_nb_decod_unit);
    1220   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_VAL               ,_param->_nb_ooo_engine);
    1221   DELETE1_SC_SIGNAL(out_COMMIT_EVENT_ACK               ,_param->_nb_ooo_engine);
    1222   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_CONTEXT_ID        ,_param->_nb_ooo_engine);
    1223   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_DEPTH             ,_param->_nb_ooo_engine);
    1224   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_TYPE              ,_param->_nb_ooo_engine);
    1225   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_IS_DELAY_SLOT     ,_param->_nb_ooo_engine);
    1226   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_ADDRESS           ,_param->_nb_ooo_engine);
    1227   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_ADDRESS_EPCR      ,_param->_nb_ooo_engine);
    1228   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_ADDRESS_EEAR_VAL  ,_param->_nb_ooo_engine);
    1229   DELETE1_SC_SIGNAL( in_COMMIT_EVENT_ADDRESS_EEAR      ,_param->_nb_ooo_engine);
     1245  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_VAL               );
     1246  DELETE_SC_SIGNAL (out_COMMIT_EVENT_ACK               );
     1247  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_CONTEXT_ID        );
     1248  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_DEPTH             );
     1249  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_TYPE              );
     1250  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_IS_DELAY_SLOT     );
     1251  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_ADDRESS           );
     1252  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EPCR      );
     1253  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EEAR_VAL  );
     1254  DELETE_SC_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EEAR      );
    12301255  DELETE1_SC_SIGNAL( in_BRANCH_COMPLETE_VAL            ,_param->_nb_inst_branch_complete);
    12311256  DELETE1_SC_SIGNAL(out_BRANCH_COMPLETE_ACK            ,_param->_nb_inst_branch_complete);
     
    12361261  DELETE1_SC_SIGNAL( in_BRANCH_COMPLETE_ADDRESS_SRC    ,_param->_nb_inst_branch_complete);
    12371262  DELETE1_SC_SIGNAL( in_BRANCH_COMPLETE_ADDRESS_DEST   ,_param->_nb_inst_branch_complete);
    1238   DELETE1_SC_SIGNAL( in_NB_INST_DECOD_ALL              ,_param->_nb_decod_unit);
    1239   DELETE1_SC_SIGNAL( in_NB_INST_COMMIT_ALL             ,_param->_nb_ooo_engine);
    1240   DELETE1_SC_SIGNAL( in_NB_INST_COMMIT_MEM             ,_param->_nb_ooo_engine);
     1263  DELETE1_SC_SIGNAL( in_NB_INST_DECOD_ALL              ,_param->_nb_context   );
     1264  DELETE1_SC_SIGNAL( in_NB_INST_COMMIT_ALL             ,_param->_nb_context   );
     1265  DELETE1_SC_SIGNAL( in_NB_INST_COMMIT_MEM             ,_param->_nb_context   );
    12411266  DELETE1_SC_SIGNAL(out_EVENT_VAL                      ,_param->_nb_context   );
    12421267  DELETE1_SC_SIGNAL( in_EVENT_ACK                      ,_param->_nb_context   );
     
    12451270  DELETE1_SC_SIGNAL(out_EVENT_ADDRESS_NEXT_VAL         ,_param->_nb_context   );
    12461271  DELETE1_SC_SIGNAL(out_EVENT_IS_DS_TAKE               ,_param->_nb_context   );
    1247   DELETE1_SC_SIGNAL(out_SPR_VAL                        ,_param->_nb_context   );
    1248   DELETE1_SC_SIGNAL( in_SPR_ACK                        ,_param->_nb_context   );
    1249   DELETE1_SC_SIGNAL(out_SPR_EPCR                       ,_param->_nb_context   );
    1250   DELETE1_SC_SIGNAL(out_SPR_EEAR                       ,_param->_nb_context   );
    1251   DELETE1_SC_SIGNAL(out_SPR_EEAR_WEN                   ,_param->_nb_context   );
    1252   DELETE1_SC_SIGNAL(out_SPR_SR_DSX                     ,_param->_nb_context   );
    1253   DELETE1_SC_SIGNAL(out_SPR_SR_TO_ESR                  ,_param->_nb_context   );
     1272  DELETE1_SC_SIGNAL(out_SPR_EVENT_VAL                  ,_param->_nb_context   );
     1273  DELETE1_SC_SIGNAL( in_SPR_EVENT_ACK                  ,_param->_nb_context   );
     1274  DELETE1_SC_SIGNAL(out_SPR_EVENT_EPCR                 ,_param->_nb_context   );
     1275  DELETE1_SC_SIGNAL(out_SPR_EVENT_EEAR                 ,_param->_nb_context   );
     1276  DELETE1_SC_SIGNAL(out_SPR_EVENT_EEAR_WEN             ,_param->_nb_context   );
     1277  DELETE1_SC_SIGNAL(out_SPR_EVENT_SR_DSX               ,_param->_nb_context   );
     1278  DELETE1_SC_SIGNAL(out_SPR_EVENT_SR_TO_ESR            ,_param->_nb_context   );
    12541279  DELETE1_SC_SIGNAL(out_CONTEXT_DECOD_ENABLE           ,_param->_nb_context   );
    1255   DELETE1_SC_SIGNAL( in_DEPTH_TAIL                     ,_param->_nb_context   );
     1280  DELETE1_SC_SIGNAL( in_DEPTH_MIN                      ,_param->_nb_context   );
     1281  DELETE1_SC_SIGNAL( in_SPR_SR_IEE                     ,_param->_nb_context   );
     1282  DELETE1_SC_SIGNAL( in_SPR_SR_EPH                     ,_param->_nb_context   );
     1283
     1284  DELETE1_SC_SIGNAL( in_INTERRUPT_ENABLE               ,_param->_nb_context   );
    12561285    }
    12571286#endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Context_State.h

    r83 r88  
    6262  public    : SC_CLOCK                      *  in_CLOCK        ;
    6363  public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
     64
     65    // ~~~~~[ Interface : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     66  public    : SC_IN (Tcontrol_t         )  **  in_BRANCH_EVENT_VAL                   ;//[nb_context]
     67  public    : SC_OUT(Tcontrol_t         )  ** out_BRANCH_EVENT_ACK                   ;//[nb_context]
     68//public    : SC_IN (Tcontext_t         )  **  in_BRANCH_EVENT_CONTEXT_ID            ;//[nb_context]
     69//public    : SC_IN (Tdepth_t           )  **  in_BRANCH_EVENT_DEPTH                 ;//[nb_context]
     70//public    : SC_IN (Tcontrol_t         )  **  in_BRANCH_EVENT_MISS_PREDICTION       ;//[nb_context]
     71  public    : SC_IN (Taddress_t         )  **  in_BRANCH_EVENT_ADDRESS_SRC           ;//[nb_context]
     72  public    : SC_IN (Taddress_t         )  **  in_BRANCH_EVENT_ADDRESS_DEST          ;//[nb_context]
    6473
    6574    // ~~~~~[ Interface : "decod_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    7483
    7584    // ~~~~~[ Interface : "commit_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    76   public    : SC_IN (Tcontrol_t         )  **  in_COMMIT_EVENT_VAL                   ;//[nb_ooo_engine]
    77   public    : SC_OUT(Tcontrol_t         )  ** out_COMMIT_EVENT_ACK                   ;//[nb_ooo_engine]
    78   public    : SC_IN (Tcontext_t         )  **  in_COMMIT_EVENT_CONTEXT_ID            ;//[nb_ooo_engine]
    79   public    : SC_IN (Tdepth_t           )  **  in_COMMIT_EVENT_DEPTH                 ;//[nb_ooo_engine]
    80   public    : SC_IN (Tevent_type_t      )  **  in_COMMIT_EVENT_TYPE                  ;//[nb_ooo_engine]
    81   public    : SC_IN (Tcontrol_t         )  **  in_COMMIT_EVENT_IS_DELAY_SLOT         ;//[nb_ooo_engine]
    82   public    : SC_IN (Taddress_t         )  **  in_COMMIT_EVENT_ADDRESS               ;//[nb_ooo_engine]
    83   public    : SC_IN (Taddress_t         )  **  in_COMMIT_EVENT_ADDRESS_EPCR          ;//[nb_ooo_engine]
    84   public    : SC_IN (Tcontrol_t         )  **  in_COMMIT_EVENT_ADDRESS_EEAR_VAL      ;//[nb_ooo_engine]
    85   public    : SC_IN (Taddress_t         )  **  in_COMMIT_EVENT_ADDRESS_EEAR          ;//[nb_ooo_engine]
     85  public    : SC_IN (Tcontrol_t         )   *  in_COMMIT_EVENT_VAL                   ;
     86  public    : SC_OUT(Tcontrol_t         )   * out_COMMIT_EVENT_ACK                   ;
     87  public    : SC_IN (Tcontext_t         )   *  in_COMMIT_EVENT_CONTEXT_ID            ;
     88  public    : SC_IN (Tdepth_t           )   *  in_COMMIT_EVENT_DEPTH                 ;
     89  public    : SC_IN (Tevent_type_t      )   *  in_COMMIT_EVENT_TYPE                  ;
     90  public    : SC_IN (Tcontrol_t         )   *  in_COMMIT_EVENT_IS_DELAY_SLOT         ;
     91  public    : SC_IN (Taddress_t         )   *  in_COMMIT_EVENT_ADDRESS               ;
     92  public    : SC_IN (Taddress_t         )   *  in_COMMIT_EVENT_ADDRESS_EPCR          ;
     93  public    : SC_IN (Tcontrol_t         )   *  in_COMMIT_EVENT_ADDRESS_EEAR_VAL      ;
     94  public    : SC_IN (Taddress_t         )   *  in_COMMIT_EVENT_ADDRESS_EEAR          ;
    8695
    8796    // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    96105
    97106    // ~~~~~[ Interface : "nb_inst" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    98   public    : SC_IN (Tcounter_t         )  **  in_NB_INST_DECOD_ALL                  ;//[nb_decod_unit]
    99   public    : SC_IN (Tcounter_t         )  **  in_NB_INST_COMMIT_ALL                 ;//[nb_ooo_engine]
    100   public    : SC_IN (Tcounter_t         )  **  in_NB_INST_COMMIT_MEM                 ;//[nb_ooo_engine]
     107  public    : SC_IN (Tcounter_t         )  **  in_NB_INST_DECOD_ALL                  ;//[nb_context]
     108  public    : SC_IN (Tcounter_t         )  **  in_NB_INST_COMMIT_ALL                 ;//[nb_context]
     109  public    : SC_IN (Tcounter_t         )  **  in_NB_INST_COMMIT_MEM                 ;//[nb_context]
    101110
    102111    // ~~~~~[ Interface "event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    108117  public    : SC_OUT(Tcontrol_t         )  ** out_EVENT_IS_DS_TAKE                   ;//[nb_context]
    109118
    110     // ~~~~~[ Interface "spr" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    111   public    : SC_OUT(Tcontrol_t         )  ** out_SPR_VAL                            ;//[nb_context]
    112   public    : SC_IN (Tcontrol_t         )  **  in_SPR_ACK                            ;//[nb_context]
    113   public    : SC_OUT(Taddress_t         )  ** out_SPR_EPCR                           ;//[nb_context]
    114   public    : SC_OUT(Taddress_t         )  ** out_SPR_EEAR                           ;//[nb_context]
    115   public    : SC_OUT(Tcontrol_t         )  ** out_SPR_EEAR_WEN                       ;//[nb_context]
    116   public    : SC_OUT(Tcontrol_t         )  ** out_SPR_SR_DSX                         ;//[nb_context]
    117   public    : SC_OUT(Tcontrol_t         )  ** out_SPR_SR_TO_ESR                      ;//[nb_context]
     119    // ~~~~~[ Interface "spr_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     120  public    : SC_OUT(Tcontrol_t         )  ** out_SPR_EVENT_VAL                      ;//[nb_context]
     121  public    : SC_IN (Tcontrol_t         )  **  in_SPR_EVENT_ACK                      ;//[nb_context]
     122  public    : SC_OUT(Taddress_t         )  ** out_SPR_EVENT_EPCR                     ;//[nb_context]
     123  public    : SC_OUT(Taddress_t         )  ** out_SPR_EVENT_EEAR                     ;//[nb_context]
     124  public    : SC_OUT(Tcontrol_t         )  ** out_SPR_EVENT_EEAR_WEN                 ;//[nb_context]
     125  public    : SC_OUT(Tcontrol_t         )  ** out_SPR_EVENT_SR_DSX                   ;//[nb_context]
     126  public    : SC_OUT(Tcontrol_t         )  ** out_SPR_EVENT_SR_TO_ESR                ;//[nb_context]
    118127
    119128    // ~~~~~[ Interface : "context" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    121130
    122131    // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    123   public    : SC_IN (Tdepth_t           )  **  in_DEPTH_TAIL                         ;//[nb_context]
     132  public    : SC_IN (Tdepth_t           )  **  in_DEPTH_MIN                          ;//[nb_context]
     133
     134    // ~~~~~[ Interface : "spr" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~         
     135  public    : SC_IN (Tcontrol_t         )  **  in_SPR_SR_IEE                         ;//[nb_context] - Interrupt Exception Enabled
     136  public    : SC_IN (Tcontrol_t         )  **  in_SPR_SR_EPH                         ;//[nb_context] - Exception Prefix High
     137
     138    // ~~~~~[ Interface : "interrupt" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     139  public    : SC_IN (Tcontrol_t         )  **  in_INTERRUPT_ENABLE                   ;//[nb_context] - Interrupt Exception
    124140                                                                                     
    125141    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     
    135151  private   : Tcontrol_t                    * reg_EVENT_IS_DS_TAKE                   ;//[nb_context]
    136152  private   : Tdepth_t                      * reg_EVENT_DEPTH                        ;//[nb_context]
     153  private   : Tcontrol_t                    * reg_INTERRUPT_ENABLE                   ;//[nb_context]
    137154
    138155    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     156  private   : Tcontrol_t                    * internal_BRANCH_EVENT_ACK              ;//[nb_context]
    139157  private   : Tcontrol_t                    * internal_DECOD_EVENT_ACK               ;//[nb_decod_unit]
    140   private   : Tcontrol_t                    * internal_COMMIT_EVENT_ACK              ;//[nb_ooo_engine]
     158  private   : Tcontrol_t                      internal_COMMIT_EVENT_ACK              ;
    141159  private   : Tcontrol_t                    * internal_BRANCH_COMPLETE_ACK           ;//[nb_inst_branch_complete]
    142160  private   : Tcontrol_t                    * internal_EVENT_VAL                     ;//[nb_context]
    143   private   : Tcontrol_t                    * internal_SPR_VAL                       ;//[nb_context]
     161  private   : Tcontrol_t                    * internal_SPR_EVENT_VAL                 ;//[nb_context]
    144162#endif
    145163
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Parameters.h

    r83 r88  
    2626  public : uint32_t   _nb_context                   ;
    2727  public : uint32_t   _nb_decod_unit                ;
    28   public : uint32_t   _nb_ooo_engine                ;
    2928  public : uint32_t   _nb_inst_branch_complete      ;
    30   public : uint32_t * _size_depth                   ; //[nb_context]
    31   public : uint32_t   _size_address                 ;
    32   public : uint32_t * _size_inst_decod              ; //[nb_decod_unit]
    33   public : uint32_t * _size_inst_commit             ; //[nb_ooo_engine]
     29  public : uint32_t * _array_size_depth             ; //[nb_context]
     30//public : uint32_t * _size_depth                   ; //[nb_context]
     31//public : uint32_t   _size_address                 ;
     32//public : uint32_t * _size_nb_inst_decod           ; //[nb_decod_unit]
     33//public : uint32_t   _size_nb_inst_commit          ;
    3434  public : uint32_t * _link_context_to_decod_unit   ; //[nb_context]
    35   public : uint32_t * _link_decod_unit_to_ooo_engine; //[nb_decod_unit]
    36 
    37   public : uint32_t   _size_context_id;
    38   public : uint32_t   _size_max_depth ;
    39 
    40   public : bool       _have_port_context_id;
    41   public : bool     * _have_port_depth     ;
    42   public : bool       _have_port_max_depth ;
    4335
    4436    //-----[ methods ]-----------------------------------------------------------
    4537  public : Parameters  (uint32_t   nb_context,
    4638                        uint32_t   nb_decod_unit,
    47                         uint32_t   nb_ooo_engine,
    4839                        uint32_t   nb_inst_branch_complete,
    4940                        uint32_t * size_depth,               
    5041                        uint32_t   size_address,
    51                         uint32_t * size_inst_decod,           
    52                         uint32_t * size_inst_commit,         
     42                        uint32_t * size_nb_inst_decod,           
     43                        uint32_t   size_nb_inst_commit,         
    5344                        uint32_t * link_context_to_decod_unit,
    54                         uint32_t * link_decod_unit_to_ooo_engine);
     45                        bool       is_toplevel=false);
    5546//   public : Parameters  (Parameters & param) ;
    5647  public : ~Parameters () ;
     48
     49  public :        void            copy       (void);
    5750
    5851  public :        Parameters_test msg_error  (void);
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State.cpp

    r83 r88  
    3939    usage_environment(_usage);
    4040
     41#if DEBUG_Context_State == true
     42    log_printf(INFO,Context_State,FUNCTION,_("<%s> Parameters"),_name.c_str());
     43
     44    std::cout << *param << std::endl;
     45#endif   
     46
    4147    log_printf(INFO,Context_State,FUNCTION,_("Allocation"));
    4248
     
    6975    if (usage_is_set(_usage,USE_SYSTEMC))
    7076      {
    71         // Constant
     77        // Constant
     78        for (uint32_t i=0; i<_param->_nb_context; i++)
     79          {
     80            internal_BRANCH_EVENT_ACK [i] = 1;
     81            PORT_WRITE(out_BRANCH_EVENT_ACK [i], internal_BRANCH_EVENT_ACK [i]);
     82          }
     83
    7284        for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
    7385          {
     
    7688          }
    7789
    78         for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
    79           {
    80             internal_COMMIT_EVENT_ACK [i] = 1;
    81             PORT_WRITE(out_COMMIT_EVENT_ACK [i], internal_COMMIT_EVENT_ACK [i]);
    82           }
     90        internal_COMMIT_EVENT_ACK = 1;
     91        PORT_WRITE(out_COMMIT_EVENT_ACK, internal_COMMIT_EVENT_ACK);
    8392
    8493        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_allocation.cpp

    r83 r88  
    5656    }
    5757
     58    // ~~~~~[ Interface : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     59    {
     60      ALLOC1_INTERFACE("branch_event", IN,SOUTH, "branch_event", _param->_nb_context);
     61     
     62      ALLOC1_VALACK_IN ( in_BRANCH_EVENT_VAL                   ,VAL);
     63      ALLOC1_VALACK_OUT(out_BRANCH_EVENT_ACK                   ,ACK);
     64//    ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_CONTEXT_ID            ,"context_id"             ,Tcontext_t         ,_param->_size_context_id);
     65//    ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_DEPTH                 ,"depth"                  ,Tdepth_t           ,_param->_size_depth);
     66//    ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_MISS_PREDICTION       ,"miss_prediction"        ,Tcontrol_t         ,1);
     67      ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_ADDRESS_SRC           ,"address_src"            ,Taddress_t         ,_param->_size_instruction_address);
     68      ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_ADDRESS_DEST          ,"address_dest"           ,Taddress_t         ,_param->_size_instruction_address);
     69    }
     70
    5871    // ~~~~~[ Interface : "decod_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    5972    {
     
    6376      ALLOC1_VALACK_OUT(out_DECOD_EVENT_ACK                    ,ACK);
    6477      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_CONTEXT_ID             ,"context_id"             ,Tcontext_t         ,_param->_size_context_id);
    65       ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_DEPTH                  ,"depth"                  ,Tdepth_t           ,_param->_size_max_depth);
     78      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_DEPTH                  ,"depth"                  ,Tdepth_t           ,_param->_size_depth);
    6679      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_TYPE                   ,"type"                   ,Tevent_type_t      ,_param->_size_event_type);
    6780      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_IS_DELAY_SLOT          ,"is_delay_slot"          ,Tcontrol_t         ,1);
    68       ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_ADDRESS                ,"address"                ,Taddress_t         ,_param->_size_address);
    69       ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_ADDRESS_EPCR           ,"address_epcr"           ,Taddress_t         ,_param->_size_address);
     81      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_ADDRESS                ,"address"                ,Taddress_t         ,_param->_size_instruction_address);
     82      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_ADDRESS_EPCR           ,"address_epcr"           ,Taddress_t         ,_param->_size_instruction_address);
    7083    }
    7184
    7285    // ~~~~~[ Interface : "commit_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    7386    {
    74       ALLOC1_INTERFACE("commit_event",IN ,EAST, _("Interface with the Re Order Buffer"), _param->_nb_ooo_engine);
    75 
    76       ALLOC1_VALACK_IN ( in_COMMIT_EVENT_VAL                   ,VAL);
    77       ALLOC1_VALACK_OUT(out_COMMIT_EVENT_ACK                   ,ACK);
    78       ALLOC1_SIGNAL_IN ( in_COMMIT_EVENT_CONTEXT_ID            ,"context_id"      ,Tcontext_t         ,_param->_size_context_id);
    79       ALLOC1_SIGNAL_IN ( in_COMMIT_EVENT_DEPTH                 ,"depth"           ,Tdepth_t           ,_param->_size_max_depth);
    80       ALLOC1_SIGNAL_IN ( in_COMMIT_EVENT_TYPE                  ,"type"            ,Tevent_type_t      ,_param->_size_event_type);
    81       ALLOC1_SIGNAL_IN ( in_COMMIT_EVENT_IS_DELAY_SLOT         ,"is_delay_slot"   ,Tcontrol_t         ,1);
    82       ALLOC1_SIGNAL_IN ( in_COMMIT_EVENT_ADDRESS               ,"address"         ,Taddress_t         ,_param->_size_address);
    83       ALLOC1_SIGNAL_IN ( in_COMMIT_EVENT_ADDRESS_EPCR          ,"address_epcr"    ,Taddress_t         ,_param->_size_address);
    84       ALLOC1_SIGNAL_IN ( in_COMMIT_EVENT_ADDRESS_EEAR_VAL      ,"address_eear_val",Tcontrol_t         ,1);
    85       ALLOC1_SIGNAL_IN ( in_COMMIT_EVENT_ADDRESS_EEAR          ,"address_eear"    ,Taddress_t         ,_param->_size_address);
     87      ALLOC_INTERFACE("commit_event",IN ,EAST, _("Interface with the Re Order Buffer"));
     88
     89      ALLOC_VALACK_IN ( in_COMMIT_EVENT_VAL                   ,VAL);
     90      ALLOC_VALACK_OUT (out_COMMIT_EVENT_ACK                   ,ACK);
     91      ALLOC_SIGNAL_IN ( in_COMMIT_EVENT_CONTEXT_ID            ,"context_id"      ,Tcontext_t         ,_param->_size_context_id);
     92      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_DEPTH                 ,"depth"           ,Tdepth_t           ,_param->_size_depth);
     93      ALLOC_SIGNAL_IN ( in_COMMIT_EVENT_TYPE                  ,"type"            ,Tevent_type_t      ,_param->_size_event_type);
     94      ALLOC_SIGNAL_IN ( in_COMMIT_EVENT_IS_DELAY_SLOT         ,"is_delay_slot"   ,Tcontrol_t         ,1);
     95      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_ADDRESS               ,"address"         ,Taddress_t         ,_param->_size_instruction_address);
     96      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_ADDRESS_EPCR          ,"address_epcr"    ,Taddress_t         ,_param->_size_instruction_address);
     97      ALLOC_SIGNAL_IN ( in_COMMIT_EVENT_ADDRESS_EEAR_VAL      ,"address_eear_val",Tcontrol_t         ,1);
     98      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_ADDRESS_EEAR          ,"address_eear"    ,Taddress_t         ,_param->_size_instruction_address);
    8699    }
    87100
     
    93106      ALLOC1_VALACK_OUT(out_BRANCH_COMPLETE_ACK                ,ACK);
    94107      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_CONTEXT_ID         ,"context_id"     ,Tcontext_t         ,_param->_size_context_id);
    95       ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_DEPTH              ,"depth"          ,Tdepth_t           ,_param->_size_max_depth);
     108      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_DEPTH              ,"depth"          ,Tdepth_t           ,_param->_size_depth);
    96109      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_MISS_PREDICTION    ,"miss_prediction",Tcontrol_t         ,1);
    97110      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_TAKE               ,"take"           ,Tcontrol_t         ,1);
    98       ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_ADDRESS_SRC        ,"address_src"    ,Taddress_t         ,_param->_size_address);
    99       ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_ADDRESS_DEST       ,"address_dest"   ,Taddress_t         ,_param->_size_address);
     111      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_ADDRESS_SRC        ,"address_src"    ,Taddress_t         ,_param->_size_instruction_address);
     112      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_ADDRESS_DEST       ,"address_dest"   ,Taddress_t         ,_param->_size_instruction_address);
    100113    }
    101114
    102115    // ~~~~~[ Interface : "nb_inst" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    103116    {
    104       ALLOC1_INTERFACE("nb_inst",IN ,EAST, _("Interface to count in fligt present instruction."), _param->_nb_decod_unit);
    105 
    106       ALLOC1_SIGNAL_IN ( in_NB_INST_DECOD_ALL                  ,"decod_all" ,Tcounter_t         ,_param->_size_inst_decod  [alloc_signal_it1]);
    107 //    ALLOC1_SIGNAL_IN ( in_NB_INST_COMMIT_ALL                 ,"commit_all",Tcounter_t         ,_param->_size_inst_commit [alloc_signal_it1]);
    108 //    ALLOC1_SIGNAL_IN ( in_NB_INST_COMMIT_MEM                 ,"commit_mem",Tcounter_t         ,_param->_size_inst_commit [alloc_signal_it1]);
    109     }
    110     {
    111       ALLOC1_INTERFACE("nb_inst",IN ,EAST, _("Interface to count in fligt present instruction."), _param->_nb_ooo_engine);
    112 
    113 //    ALLOC1_SIGNAL_IN ( in_NB_INST_DECOD_ALL                  ,"decod_all" ,Tcounter_t         ,_param->_size_inst_decod  [alloc_signal_it1]);
    114       ALLOC1_SIGNAL_IN ( in_NB_INST_COMMIT_ALL                 ,"commit_all",Tcounter_t         ,_param->_size_inst_commit [alloc_signal_it1]);
    115       ALLOC1_SIGNAL_IN ( in_NB_INST_COMMIT_MEM                 ,"commit_mem",Tcounter_t         ,_param->_size_inst_commit [alloc_signal_it1]);
     117      ALLOC1_INTERFACE("nb_inst",IN ,EAST, _("Interface to count in fligt present instruction."),_param->_nb_context);
     118
     119      ALLOC1_SIGNAL_IN ( in_NB_INST_DECOD_ALL                  ,"decod_all" ,Tcounter_t         ,_param->_size_nb_inst_decod);
     120      ALLOC1_SIGNAL_IN ( in_NB_INST_COMMIT_ALL                 ,"commit_all",Tcounter_t         ,_param->_size_nb_inst_commit);
     121      ALLOC1_SIGNAL_IN ( in_NB_INST_COMMIT_MEM                 ,"commit_mem",Tcounter_t         ,_param->_size_nb_inst_commit);
    116122    }
    117123
     
    122128      ALLOC1_VALACK_OUT(out_EVENT_VAL                          ,VAL);
    123129      ALLOC1_VALACK_IN ( in_EVENT_ACK                          ,ACK);
    124       ALLOC1_SIGNAL_OUT(out_EVENT_ADDRESS                      ,"address"         ,Taddress_t        ,_param->_size_address);
    125       ALLOC1_SIGNAL_OUT(out_EVENT_ADDRESS_NEXT                 ,"address_next"    ,Taddress_t        ,_param->_size_address);
     130      ALLOC1_SIGNAL_OUT(out_EVENT_ADDRESS                      ,"address"         ,Taddress_t        ,_param->_size_instruction_address);
     131      ALLOC1_SIGNAL_OUT(out_EVENT_ADDRESS_NEXT                 ,"address_next"    ,Taddress_t        ,_param->_size_instruction_address);
    126132      ALLOC1_SIGNAL_OUT(out_EVENT_ADDRESS_NEXT_VAL             ,"address_next_val",Tcontrol_t        ,1);
    127133      ALLOC1_SIGNAL_OUT(out_EVENT_IS_DS_TAKE                   ,"is_ds_take"      ,Tcontrol_t        ,1);
    128134    }
    129135
    130     // ~~~~~[ Interface "spr" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    131     {
    132       ALLOC1_INTERFACE("spr",OUT,WEST, _("An exception occure : write \"exception PC\"."), _param->_nb_context);
    133 
    134       ALLOC1_VALACK_OUT(out_SPR_VAL                            ,VAL);
    135       ALLOC1_VALACK_IN ( in_SPR_ACK                            ,ACK);
    136       ALLOC1_SIGNAL_OUT(out_SPR_EPCR                           ,"epcr"     ,Taddress_t, _param->_size_address);
    137       ALLOC1_SIGNAL_OUT(out_SPR_EEAR                           ,"eear"     ,Taddress_t, _param->_size_address);
    138       ALLOC1_SIGNAL_OUT(out_SPR_EEAR_WEN                       ,"eear_wen" ,Tcontrol_t,1);
    139       ALLOC1_SIGNAL_OUT(out_SPR_SR_DSX                         ,"sr_dsx"   ,Tcontrol_t,1);
    140       ALLOC1_SIGNAL_OUT(out_SPR_SR_TO_ESR                      ,"sr_to_esr",Tcontrol_t,1);
     136    // ~~~~~[ Interface "spr_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     137    {
     138      ALLOC1_INTERFACE("spr_event",OUT,WEST, _("An exception occure : write \"exception PC\"."), _param->_nb_context);
     139
     140      ALLOC1_VALACK_OUT(out_SPR_EVENT_VAL                      ,VAL);
     141      ALLOC1_VALACK_IN ( in_SPR_EVENT_ACK                      ,ACK);
     142      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_EPCR                     ,"epcr"     ,Taddress_t, _param->_size_instruction_address);
     143      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_EEAR                     ,"eear"     ,Taddress_t, _param->_size_instruction_address);
     144      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_EEAR_WEN                 ,"eear_wen" ,Tcontrol_t,1);
     145      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_SR_DSX                   ,"sr_dsx"   ,Tcontrol_t,1);
     146      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_SR_TO_ESR                ,"sr_to_esr",Tcontrol_t,1);
    141147    }
    142148
     
    152158      ALLOC1_INTERFACE("depth",IN ,NORTH, _("From prediction_unit."), _param->_nb_context);
    153159     
    154       ALLOC1_SIGNAL_IN ( in_DEPTH_TAIL                         ,"tail",Tdepth_t,_param->_size_depth [alloc_signal_it1]);
    155     }
    156 
    157     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    158    
    159     reg_STATE                  = new context_state_t [_param->_nb_context];
    160     reg_EVENT_ADDRESS          = new Taddress_t      [_param->_nb_context];
    161     reg_EVENT_ADDRESS_EPCR     = new Taddress_t      [_param->_nb_context];
    162     reg_EVENT_ADDRESS_EPCR_VAL = new Tcontrol_t      [_param->_nb_context];
    163     reg_EVENT_ADDRESS_EEAR     = new Taddress_t      [_param->_nb_context];
    164     reg_EVENT_ADDRESS_EEAR_VAL = new Tcontrol_t      [_param->_nb_context];
    165     reg_EVENT_IS_DELAY_SLOT    = new Tcontrol_t      [_param->_nb_context];
    166     reg_EVENT_IS_DS_TAKE       = new Tcontrol_t      [_param->_nb_context];
    167     reg_EVENT_DEPTH            = new Tdepth_t        [_param->_nb_context];
    168 
    169     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    170     internal_DECOD_EVENT_ACK     = new Tcontrol_t [_param->_nb_decod_unit];
    171     internal_COMMIT_EVENT_ACK    = new Tcontrol_t [_param->_nb_ooo_engine];
    172     internal_BRANCH_COMPLETE_ACK = new Tcontrol_t [_param->_nb_inst_branch_complete];
    173     internal_EVENT_VAL           = new Tcontrol_t [_param->_nb_context];
    174     internal_SPR_VAL             = new Tcontrol_t [_param->_nb_context];
    175    
     160      ALLOC1_SIGNAL_IN ( in_DEPTH_MIN                          ,"min" ,Tdepth_t,_param->_size_depth);
     161    }
     162
     163
     164    // ~~~~~[ Interface : "spr" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~         
     165    {
     166      ALLOC1_INTERFACE("spr",IN,EAST,_("Interface with the special registerFile"),_param->_nb_context);
     167     
     168      ALLOC1_SIGNAL_IN ( in_SPR_SR_IEE                         ,"SR_IEE",Tcontrol_t,1);
     169      ALLOC1_SIGNAL_IN ( in_SPR_SR_EPH                         ,"SR_EPH",Tcontrol_t,1);
     170    }
     171
     172    // ~~~~~[ Interface : "interrupt" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     173    {
     174      ALLOC1_INTERFACE("interrupt",IN,NORTH,_("Interrupt Exception"),_param->_nb_context);
     175
     176      ALLOC1_SIGNAL_IN ( in_INTERRUPT_ENABLE                   ,"ENABLE",Tcontrol_t,1);
     177    }
     178
     179    if (usage_is_set(_usage,USE_SYSTEMC))
     180      {
     181     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     182       
     183     reg_STATE                  = new context_state_t [_param->_nb_context];
     184     reg_EVENT_ADDRESS          = new Taddress_t      [_param->_nb_context];
     185     reg_EVENT_ADDRESS_EPCR     = new Taddress_t      [_param->_nb_context];
     186     reg_EVENT_ADDRESS_EPCR_VAL = new Tcontrol_t      [_param->_nb_context];
     187     reg_EVENT_ADDRESS_EEAR     = new Taddress_t      [_param->_nb_context];
     188     reg_EVENT_ADDRESS_EEAR_VAL = new Tcontrol_t      [_param->_nb_context];
     189     reg_EVENT_IS_DELAY_SLOT    = new Tcontrol_t      [_param->_nb_context];
     190     reg_EVENT_IS_DS_TAKE       = new Tcontrol_t      [_param->_nb_context];
     191     reg_EVENT_DEPTH            = new Tdepth_t        [_param->_nb_context];
     192     reg_INTERRUPT_ENABLE       = new Tcontrol_t      [_param->_nb_context];
     193       
     194     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     195     internal_BRANCH_EVENT_ACK    = new Tcontrol_t [_param->_nb_context];
     196     internal_DECOD_EVENT_ACK     = new Tcontrol_t [_param->_nb_decod_unit];
     197     internal_BRANCH_COMPLETE_ACK = new Tcontrol_t [_param->_nb_inst_branch_complete];
     198     internal_EVENT_VAL           = new Tcontrol_t [_param->_nb_context];
     199     internal_SPR_EVENT_VAL       = new Tcontrol_t [_param->_nb_context];
     200      }
     201
    176202    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    177203
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_deallocation.cpp

    r83 r88  
    2828        delete    in_NRESET;
    2929
     30        DELETE1_SIGNAL( in_BRANCH_EVENT_VAL                   ,_param->_nb_context,1);
     31        DELETE1_SIGNAL(out_BRANCH_EVENT_ACK                   ,_param->_nb_context,1);
     32//      DELETE1_SIGNAL( in_BRANCH_EVENT_CONTEXT_ID            ,_param->_nb_context,_param->_size_context_id);
     33//      DELETE1_SIGNAL( in_BRANCH_EVENT_DEPTH                 ,_param->_nb_context,_param->_size_depth);
     34//      DELETE1_SIGNAL( in_BRANCH_EVENT_MISS_PREDICTION       ,_param->_nb_context,1);
     35        DELETE1_SIGNAL( in_BRANCH_EVENT_ADDRESS_SRC           ,_param->_nb_context,_param->_size_instruction_address);
     36        DELETE1_SIGNAL( in_BRANCH_EVENT_ADDRESS_DEST          ,_param->_nb_context,_param->_size_instruction_address);
     37
    3038        DELETE1_SIGNAL( in_DECOD_EVENT_VAL                    ,_param->_nb_decod_unit,1);
    3139        DELETE1_SIGNAL(out_DECOD_EVENT_ACK                    ,_param->_nb_decod_unit,1);
    3240        DELETE1_SIGNAL( in_DECOD_EVENT_CONTEXT_ID             ,_param->_nb_decod_unit,_param->_size_context_id);
    33         DELETE1_SIGNAL( in_DECOD_EVENT_DEPTH                  ,_param->_nb_decod_unit,_param->_size_max_depth);
     41        DELETE1_SIGNAL( in_DECOD_EVENT_DEPTH                  ,_param->_nb_decod_unit,_param->_size_depth);
    3442        DELETE1_SIGNAL( in_DECOD_EVENT_TYPE                   ,_param->_nb_decod_unit,_param->_size_event_type);
    3543        DELETE1_SIGNAL( in_DECOD_EVENT_IS_DELAY_SLOT          ,_param->_nb_decod_unit,1);
    36         DELETE1_SIGNAL( in_DECOD_EVENT_ADDRESS                ,_param->_nb_decod_unit,_param->_size_address);
    37         DELETE1_SIGNAL( in_DECOD_EVENT_ADDRESS_EPCR           ,_param->_nb_decod_unit,_param->_size_address);
     44        DELETE1_SIGNAL( in_DECOD_EVENT_ADDRESS                ,_param->_nb_decod_unit,_param->_size_instruction_address);
     45        DELETE1_SIGNAL( in_DECOD_EVENT_ADDRESS_EPCR           ,_param->_nb_decod_unit,_param->_size_instruction_address);
    3846       
    39         DELETE1_SIGNAL( in_COMMIT_EVENT_VAL                   ,_param->_nb_ooo_engine,1);
    40         DELETE1_SIGNAL(out_COMMIT_EVENT_ACK                   ,_param->_nb_ooo_engine,1);
    41         DELETE1_SIGNAL( in_COMMIT_EVENT_CONTEXT_ID            ,_param->_nb_ooo_engine,_param->_size_context_id);
    42         DELETE1_SIGNAL( in_COMMIT_EVENT_DEPTH                 ,_param->_nb_ooo_engine,_param->_size_max_depth);
    43         DELETE1_SIGNAL( in_COMMIT_EVENT_TYPE                  ,_param->_nb_ooo_engine,_param->_size_event_type);
    44         DELETE1_SIGNAL( in_COMMIT_EVENT_IS_DELAY_SLOT         ,_param->_nb_ooo_engine,1);
    45         DELETE1_SIGNAL( in_COMMIT_EVENT_ADDRESS               ,_param->_nb_ooo_engine,_param->_size_address);
    46         DELETE1_SIGNAL( in_COMMIT_EVENT_ADDRESS_EPCR          ,_param->_nb_ooo_engine,_param->_size_address);
    47         DELETE1_SIGNAL( in_COMMIT_EVENT_ADDRESS_EEAR_VAL      ,_param->_nb_ooo_engine,_param->_size_address);
    48         DELETE1_SIGNAL( in_COMMIT_EVENT_ADDRESS_EEAR          ,_param->_nb_ooo_engine,1);
     47        DELETE_SIGNAL ( in_COMMIT_EVENT_VAL                   ,1);
     48        DELETE_SIGNAL (out_COMMIT_EVENT_ACK                   ,1);
     49        DELETE_SIGNAL ( in_COMMIT_EVENT_CONTEXT_ID            ,_param->_size_context_id);
     50        DELETE_SIGNAL ( in_COMMIT_EVENT_DEPTH                 ,_param->_size_depth);
     51        DELETE_SIGNAL ( in_COMMIT_EVENT_TYPE                  ,_param->_size_event_type);
     52        DELETE_SIGNAL ( in_COMMIT_EVENT_IS_DELAY_SLOT         ,1);
     53        DELETE_SIGNAL ( in_COMMIT_EVENT_ADDRESS               ,_param->_size_instruction_address);
     54        DELETE_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EPCR          ,_param->_size_instruction_address);
     55        DELETE_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EEAR_VAL      ,_param->_size_instruction_address);
     56        DELETE_SIGNAL ( in_COMMIT_EVENT_ADDRESS_EEAR          ,1);
    4957
    5058        DELETE1_SIGNAL( in_BRANCH_COMPLETE_VAL                ,_param->_nb_inst_branch_complete,1);
    5159        DELETE1_SIGNAL(out_BRANCH_COMPLETE_ACK                ,_param->_nb_inst_branch_complete,1);
    5260        DELETE1_SIGNAL( in_BRANCH_COMPLETE_CONTEXT_ID         ,_param->_nb_inst_branch_complete,_param->_size_context_id);
    53         DELETE1_SIGNAL( in_BRANCH_COMPLETE_DEPTH              ,_param->_nb_inst_branch_complete,_param->_size_max_depth);
     61        DELETE1_SIGNAL( in_BRANCH_COMPLETE_DEPTH              ,_param->_nb_inst_branch_complete,_param->_size_depth);
    5462        DELETE1_SIGNAL( in_BRANCH_COMPLETE_MISS_PREDICTION    ,_param->_nb_inst_branch_complete,1);
    5563        DELETE1_SIGNAL( in_BRANCH_COMPLETE_TAKE               ,_param->_nb_inst_branch_complete,1);
    56         DELETE1_SIGNAL( in_BRANCH_COMPLETE_ADDRESS_SRC        ,_param->_nb_inst_branch_complete,_param->_size_address);
    57         DELETE1_SIGNAL( in_BRANCH_COMPLETE_ADDRESS_DEST       ,_param->_nb_inst_branch_complete,_param->_size_address);
     64        DELETE1_SIGNAL( in_BRANCH_COMPLETE_ADDRESS_SRC        ,_param->_nb_inst_branch_complete,_param->_size_instruction_address);
     65        DELETE1_SIGNAL( in_BRANCH_COMPLETE_ADDRESS_DEST       ,_param->_nb_inst_branch_complete,_param->_size_instruction_address);
    5866       
    59         DELETE1_SIGNAL( in_NB_INST_DECOD_ALL                  ,_param->_nb_decod_unit,_param->_size_inst_decod  [alloc_signal_it1]);
    60 //      DELETE1_SIGNAL( in_NB_INST_COMMIT_ALL                 ,_param->_nb_decod_unit,_param->_size_inst_commit [alloc_signal_it1]);
    61 //      DELETE1_SIGNAL( in_NB_INST_COMMIT_MEM                 ,_param->_nb_decod_unit,_param->_size_inst_commit [alloc_signal_it1]);
    62 //      DELETE1_SIGNAL( in_NB_INST_DECOD_ALL                  ,_param->_nb_ooo_engine,_param->_size_inst_decod  [alloc_signal_it1]);
    63         DELETE1_SIGNAL( in_NB_INST_COMMIT_ALL                 ,_param->_nb_ooo_engine,_param->_size_inst_commit [alloc_signal_it1]);
    64         DELETE1_SIGNAL( in_NB_INST_COMMIT_MEM                 ,_param->_nb_ooo_engine,_param->_size_inst_commit [alloc_signal_it1]);
     67        DELETE1_SIGNAL( in_NB_INST_DECOD_ALL                  ,_param->_nb_context,_param->_size_nb_inst_decod);
     68        DELETE1_SIGNAL( in_NB_INST_COMMIT_ALL                 ,_param->_nb_context,_param->_size_nb_inst_commit);
     69        DELETE1_SIGNAL( in_NB_INST_COMMIT_MEM                 ,_param->_nb_context,_param->_size_nb_inst_commit);
    6570       
    6671        DELETE1_SIGNAL(out_EVENT_VAL                          ,_param->_nb_context,1);
    6772        DELETE1_SIGNAL( in_EVENT_ACK                          ,_param->_nb_context,1);
    68         DELETE1_SIGNAL(out_EVENT_ADDRESS                      ,_param->_nb_context,_param->_size_address);
    69         DELETE1_SIGNAL(out_EVENT_ADDRESS_NEXT                 ,_param->_nb_context,_param->_size_address);
     73        DELETE1_SIGNAL(out_EVENT_ADDRESS                      ,_param->_nb_context,_param->_size_instruction_address);
     74        DELETE1_SIGNAL(out_EVENT_ADDRESS_NEXT                 ,_param->_nb_context,_param->_size_instruction_address);
    7075        DELETE1_SIGNAL(out_EVENT_ADDRESS_NEXT_VAL             ,_param->_nb_context,1);
    7176        DELETE1_SIGNAL(out_EVENT_IS_DS_TAKE                   ,_param->_nb_context,1);
    7277       
    73         DELETE1_SIGNAL(out_SPR_VAL                            ,_param->_nb_context,1);
    74         DELETE1_SIGNAL( in_SPR_ACK                            ,_param->_nb_context,1);
    75         DELETE1_SIGNAL(out_SPR_EPCR                           ,_param->_nb_context,_param->_size_address);
    76         DELETE1_SIGNAL(out_SPR_EEAR                           ,_param->_nb_context,_param->_size_address);
    77         DELETE1_SIGNAL(out_SPR_EEAR_WEN                       ,_param->_nb_context,1);
    78         DELETE1_SIGNAL(out_SPR_SR_DSX                         ,_param->_nb_context,1);
    79         DELETE1_SIGNAL(out_SPR_SR_TO_ESR                      ,_param->_nb_context,1);
     78        DELETE1_SIGNAL(out_SPR_EVENT_VAL                      ,_param->_nb_context,1);
     79        DELETE1_SIGNAL( in_SPR_EVENT_ACK                      ,_param->_nb_context,1);
     80        DELETE1_SIGNAL(out_SPR_EVENT_EPCR                     ,_param->_nb_context,_param->_size_instruction_address);
     81        DELETE1_SIGNAL(out_SPR_EVENT_EEAR                     ,_param->_nb_context,_param->_size_instruction_address);
     82        DELETE1_SIGNAL(out_SPR_EVENT_EEAR_WEN                 ,_param->_nb_context,1);
     83        DELETE1_SIGNAL(out_SPR_EVENT_SR_DSX                   ,_param->_nb_context,1);
     84        DELETE1_SIGNAL(out_SPR_EVENT_SR_TO_ESR                ,_param->_nb_context,1);
    8085       
    8186        DELETE1_SIGNAL(out_CONTEXT_DECOD_ENABLE               ,_param->_nb_context,1);
    8287
    83         DELETE1_SIGNAL( in_DEPTH_TAIL                         ,_param->_nb_context,_param->_size_depth [alloc_signal_it1]);
     88        DELETE1_SIGNAL( in_DEPTH_MIN                          ,_param->_nb_context,_param->_size_depth);
     89
     90        DELETE1_SIGNAL( in_SPR_SR_IEE                         ,_param->_nb_context,1);
     91        DELETE1_SIGNAL( in_SPR_SR_EPH                         ,_param->_nb_context,1);
     92
     93        DELETE1_SIGNAL( in_INTERRUPT_ENABLE                   ,_param->_nb_context,1);
     94
     95        // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     96        delete [] reg_STATE                 ;
     97        delete [] reg_EVENT_ADDRESS         ;
     98        delete [] reg_EVENT_ADDRESS_EPCR    ;
     99        delete [] reg_EVENT_ADDRESS_EPCR_VAL;
     100        delete [] reg_EVENT_ADDRESS_EEAR    ;
     101        delete [] reg_EVENT_ADDRESS_EEAR_VAL;
     102        delete [] reg_EVENT_IS_DELAY_SLOT   ;
     103        delete [] reg_EVENT_IS_DS_TAKE      ;
     104        delete [] reg_EVENT_DEPTH           ;
     105        delete [] reg_INTERRUPT_ENABLE      ;
     106       
     107        // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     108        delete [] internal_BRANCH_EVENT_ACK ;
     109        delete [] internal_DECOD_EVENT_ACK  ;
     110        delete [] internal_EVENT_VAL        ;
     111        delete [] internal_SPR_EVENT_VAL    ;
    84112      }
    85 
    86     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    87     delete [] reg_STATE                 ;
    88     delete [] reg_EVENT_ADDRESS         ;
    89     delete [] reg_EVENT_ADDRESS_EPCR    ;
    90     delete [] reg_EVENT_ADDRESS_EPCR_VAL;
    91     delete [] reg_EVENT_ADDRESS_EEAR    ;
    92     delete [] reg_EVENT_ADDRESS_EEAR_VAL;
    93     delete [] reg_EVENT_IS_DELAY_SLOT   ;
    94     delete [] reg_EVENT_IS_DS_TAKE      ;
    95     delete [] reg_EVENT_DEPTH           ;
    96 
    97     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    98     delete [] internal_DECOD_EVENT_ACK  ;
    99     delete [] internal_COMMIT_EVENT_ACK ;
    100     delete [] internal_EVENT_VAL        ;
    101     delete [] internal_SPR_VAL          ;
    102    
     113       
    103114    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    104115
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_genMoore.cpp

    r83 r88  
    2222  {
    2323    log_begin(Context_State,FUNCTION);
     24    log_function(Context_State,FUNCTION,_name.c_str());
    2425
    2526    // -------------------------------------------------------------------
     
    3031        context_state_t state = reg_STATE [i];
    3132
    32         internal_EVENT_VAL [i] = ((state == CONTEXT_STATE_KO_EXCEP_ADDR) or
    33                                   (state == CONTEXT_STATE_KO_MISS_ADDR ) or
    34                                   (state == CONTEXT_STATE_KO_PSYNC_ADDR) or
    35                                   (state == CONTEXT_STATE_KO_CSYNC_ADDR));
    36 
     33        Tcontrol_t val              = ((state == CONTEXT_STATE_KO_EXCEP_ADDR) or
     34                                       (state == CONTEXT_STATE_KO_MISS_ADDR ) or
     35                                       (state == CONTEXT_STATE_KO_PSYNC_ADDR) or
     36                                       (state == CONTEXT_STATE_KO_CSYNC_ADDR));
     37       
     38        // SR can't change in this cycle
     39        // Exception Prefix High
     40        Taddress_t address          = reg_EVENT_ADDRESS [i] | (((state == CONTEXT_STATE_KO_EXCEP_ADDR) and PORT_READ(in_SPR_SR_EPH [i]))?(0xF000000>>2):0);
     41        Taddress_t address_next     = reg_EVENT_ADDRESS_EPCR [i];
     42        Tcontrol_t address_next_val = (state == CONTEXT_STATE_KO_MISS_ADDR) and (reg_EVENT_ADDRESS_EPCR_VAL [i]);
     43        Tcontrol_t is_ds_take       = (state == CONTEXT_STATE_KO_MISS_ADDR) and (reg_EVENT_IS_DS_TAKE       [i]);
    3744        // excep : address exception
    3845        // miss  : address delay_slot, and address dest
    3946        // psync : address next
    4047        // csync : address next
    41         PORT_WRITE(out_EVENT_VAL              [i], internal_EVENT_VAL     [i]);
    42         PORT_WRITE(out_EVENT_ADDRESS          [i], reg_EVENT_ADDRESS      [i]);
    43         PORT_WRITE(out_EVENT_ADDRESS_NEXT     [i], reg_EVENT_ADDRESS_EPCR [i]);
    44         PORT_WRITE(out_EVENT_ADDRESS_NEXT_VAL [i], (state == CONTEXT_STATE_KO_MISS_ADDR) and (reg_EVENT_ADDRESS_EPCR_VAL [i]));
    45         PORT_WRITE(out_EVENT_IS_DS_TAKE       [i], (state == CONTEXT_STATE_KO_MISS_ADDR) and (reg_EVENT_IS_DS_TAKE       [i]));
     48        internal_EVENT_VAL [i] = val;
     49        PORT_WRITE(out_EVENT_VAL              [i], val);
     50        PORT_WRITE(out_EVENT_ADDRESS          [i], address);
     51        PORT_WRITE(out_EVENT_ADDRESS_NEXT     [i], address_next);
     52        PORT_WRITE(out_EVENT_ADDRESS_NEXT_VAL [i], address_next_val);
     53        PORT_WRITE(out_EVENT_IS_DS_TAKE       [i], is_ds_take);
     54
     55        log_printf(TRACE,Context_State,FUNCTION,"  * EVENT Context      : %d", i);
     56        log_printf(TRACE,Context_State,FUNCTION,"    * VAL              : %d", val);
     57        log_printf(TRACE,Context_State,FUNCTION,"    * ADDRESS          : %.8x (%.8x)", address     , address     <<2);
     58        log_printf(TRACE,Context_State,FUNCTION,"    * ADDRESS_NEXT     : %.8x (%.8x)", address_next, address_next<<2);
     59        log_printf(TRACE,Context_State,FUNCTION,"    * ADDRESS_NEXT_VAL : %d", address_next_val);
     60        log_printf(TRACE,Context_State,FUNCTION,"    * IS_DS_TAKE       : %d", is_ds_take);
    4661      }
    4762
    4863    // -------------------------------------------------------------------
    49     // -----[ SPR ]-------------------------------------------------------
     64    // -----[ SPR_EVENT ]-------------------------------------------------
    5065    // -------------------------------------------------------------------
    5166    for (uint32_t i=0; i<_param->_nb_context; i++)
     
    5368        context_state_t state = reg_STATE [i];
    5469
    55         internal_SPR_VAL [i] = (state == CONTEXT_STATE_KO_EXCEP_SPR  );
     70        internal_SPR_EVENT_VAL [i] = (state == CONTEXT_STATE_KO_EXCEP_SPR  );
    5671
    57         PORT_WRITE(out_SPR_VAL       [i], internal_SPR_VAL           [i]);
    58         PORT_WRITE(out_SPR_EPCR      [i], reg_EVENT_ADDRESS_EPCR     [i]);
    59         PORT_WRITE(out_SPR_EEAR      [i], reg_EVENT_ADDRESS_EEAR     [i]);
    60         PORT_WRITE(out_SPR_EEAR_WEN  [i], reg_EVENT_ADDRESS_EEAR_VAL [i]);
    61         PORT_WRITE(out_SPR_SR_DSX    [i], reg_EVENT_IS_DELAY_SLOT    [i]);
    62         PORT_WRITE(out_SPR_SR_TO_ESR [i], 1);
     72        PORT_WRITE(out_SPR_EVENT_VAL       [i], internal_SPR_EVENT_VAL     [i]);
     73        PORT_WRITE(out_SPR_EVENT_EPCR      [i], reg_EVENT_ADDRESS_EPCR     [i]);
     74        PORT_WRITE(out_SPR_EVENT_EEAR      [i], reg_EVENT_ADDRESS_EEAR     [i]);
     75        PORT_WRITE(out_SPR_EVENT_EEAR_WEN  [i], reg_EVENT_ADDRESS_EEAR_VAL [i]);
     76        PORT_WRITE(out_SPR_EVENT_SR_DSX    [i], reg_EVENT_IS_DELAY_SLOT    [i]);
     77        PORT_WRITE(out_SPR_EVENT_SR_TO_ESR [i], 1);
    6378      }
    6479
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_transition.cpp

    r83 r88  
    2222  {
    2323    log_begin(Context_State,FUNCTION);
     24    log_function(Context_State,FUNCTION,_name.c_str());
    2425
    2526    if (PORT_READ(in_NRESET) == 0)
    2627      {
    27         for (uint32_t i=0; i<_param->_nb_context; i++)
    28           reg_STATE [i] = CONTEXT_STATE_OK;
     28        for (uint32_t i=0; i<_param->_nb_context; i++)
     29          {
     30            reg_STATE            [i] = CONTEXT_STATE_OK;
     31            reg_INTERRUPT_ENABLE [i] = 0;
     32          }
    2933      }
    3034    else
    3135      {
    32         // -------------------------------------------------------------------
    33         // -----[ DECOD_EVENT ]-----------------------------------------------
    34         // -------------------------------------------------------------------
    35 
    36         for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
    37           if (PORT_READ(in_DECOD_EVENT_VAL [i]) and internal_DECOD_EVENT_ACK [i])
    38             {
    39               Tcontext_t context    = (_param->_have_port_context_id     )?PORT_READ(in_DECOD_EVENT_CONTEXT_ID [i]):0;
    40               Tdepth_t   depth      = (_param->_have_port_max_depth      )?PORT_READ(in_DECOD_EVENT_DEPTH      [i]):0;
    41               Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
    42               Tdepth_t   depth_base = (_param->_have_port_depth [context])?PORT_READ(in_DEPTH_TAIL       [context]):0;
    43               Tdepth_t   depth_max  = _param->_size_depth [context];
    44              
    45               Tdepth_t   depth0     = (depth_cur>=depth_base)?(depth_cur-depth_base):((depth_cur+depth_max-depth_base));
    46               Tdepth_t   depth1     = (depth    >=depth_base)?(depth    -depth_base):((depth    +depth_max-depth_base));
    47 
    48               context_state_t state = reg_STATE [context];
    49               Tevent_type_t   type  = PORT_READ(in_DECOD_EVENT_TYPE [i]);
    50              
    51               // miss > excep > spr/sync
    52               uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    53               uint8_t    priority1  = (state == EVENT_TYPE_EXCEPTION)?1:0;
    54 
    55               // is_valid = can modify local information
    56               //  if context_state_ok : yes
    57               //  if context_state_ko : test the depth, and the priority of envent
    58 
    59               bool       is_valid   = ((state == CONTEXT_STATE_OK) or
    60                                        (depth1< depth0) or
    61                                        ((depth1==depth0) and (priority1>priority0)));
    62 
    63               if (is_valid)
    64                 {
    65                   // decod :
    66                   // type : csync, psync, msync, spr_access (l.mac, l.maci, l.macrc, l.msb, l.mfspr, l.mtspr), exception (l.sys)
    67                   context_state_t state_next    = state;
    68                   Taddress_t      address       = PORT_READ(in_DECOD_EVENT_ADDRESS       [i]);
    69                   Tcontrol_t      is_delay_slot = PORT_READ(in_DECOD_EVENT_IS_DELAY_SLOT [i]);
    70 
    71                   switch (type)
    72                     {
    73                     case EVENT_TYPE_EXCEPTION          :
    74                       {
    75                         state_next = CONTEXT_STATE_KO_EXCEP;
    76                         break;
    77                       }
    78                     case EVENT_TYPE_SPR_ACCESS         :
    79                       {
    80                         state_next = CONTEXT_STATE_KO_SPR  ;
    81                         address++; // take next address
    82                         if (is_delay_slot)
    83                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
    84                         break;
    85                       }
    86                     case EVENT_TYPE_MSYNC              :
    87                       {
    88                         state_next = CONTEXT_STATE_KO_MSYNC;
    89                         address++;  // take next address
    90                         if (is_delay_slot)
    91                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
    92                         break;
    93                       }
    94                     case EVENT_TYPE_PSYNC              :
    95                       {
    96                         state_next = CONTEXT_STATE_KO_PSYNC;
    97                         address++;  // take next address
    98                         if (is_delay_slot)
    99                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
    100                         break;
    101                       }
    102                     case EVENT_TYPE_CSYNC              :
    103                       {
    104                         state_next = CONTEXT_STATE_KO_CSYNC;
    105                         address++;  // take next address
    106                         if (is_delay_slot)
    107                           throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
    108                         break;
    109                       }               
    110                     case EVENT_TYPE_NONE               :
    111                     case EVENT_TYPE_MISS_SPECULATION   :
    112                     case EVENT_TYPE_BRANCH_NO_ACCURATE :
    113                     default :
    114                       {
    115                         throw ERRORMORPHEO(FUNCTION,toString(_("DECOD_EVENT [%d] : invalid event_type : %s.\n"),i,toString(type).c_str()));
    116                       }
    117                     }
    118 
    119                   reg_STATE                  [context] = state_next;
    120                   reg_EVENT_ADDRESS          [context] = address;
    121                   reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_DECOD_EVENT_ADDRESS_EPCR  [i]);
    122                   reg_EVENT_ADDRESS_EPCR_VAL [context] = 1;
    123                 //reg_EVENT_ADDRESS_EEAR     [context]
    124                   reg_EVENT_ADDRESS_EEAR_VAL [context] = 0;
    125                   reg_EVENT_IS_DELAY_SLOT    [context] = is_delay_slot;
    126                 //reg_EVENT_IS_DS_TAKE       [context] = 0;
    127                   reg_EVENT_DEPTH            [context] = depth;
    128                 }
    129             }
    130 
    131         // -------------------------------------------------------------------
    132         // -----[ COMMIT_EVENT ]----------------------------------------------
    133         // -------------------------------------------------------------------
    134 
    135         for (uint32_t i=0; i<_param->_nb_ooo_engine; i++)
    136           if (PORT_READ(in_COMMIT_EVENT_VAL [i]) and internal_COMMIT_EVENT_ACK [i])
    137             {
    138               Tcontext_t context    = (_param->_have_port_context_id     )?PORT_READ(in_COMMIT_EVENT_CONTEXT_ID [i]):0;
    139               Tdepth_t   depth      = (_param->_have_port_max_depth      )?PORT_READ(in_COMMIT_EVENT_DEPTH      [i]):0;
    140               Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
    141               Tdepth_t   depth_base = (_param->_have_port_depth [context])?PORT_READ(in_DEPTH_TAIL        [context]):0;
    142               Tdepth_t   depth_max  = _param->_size_depth [context];
    143              
    144               Tdepth_t   depth0     = (depth_cur>=depth_base)?(depth_cur-depth_base):((depth_cur+depth_max-depth_base));
    145               Tdepth_t   depth1     = (depth    >=depth_base)?(depth    -depth_base):((depth    +depth_max-depth_base));
    146 
    147               context_state_t state = reg_STATE [context];
    148               Tevent_type_t   type  = PORT_READ(in_COMMIT_EVENT_TYPE [i]);
    149              
    150               // miss > excep > spr/sync
    151               uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    152               uint8_t    priority1  = 1;
    153 
    154               // is_valid = can modify local information
    155               //  if context_state_ok : yes
    156               //  if context_state_ko : test the depth, and the priority of envent
    157 
    158               bool       is_valid   = ((state == CONTEXT_STATE_OK) or
    159                                        (depth1< depth0) or
    160                                        ((depth1==depth0) and (priority1>priority0)));
    161 
    162               if (is_valid)
    163                 {
    164                   // commit
    165                   // type : exception
    166                   context_state_t state_next = state;
    167                   switch (type)
    168                     {
    169                     case EVENT_TYPE_EXCEPTION          : {state_next = CONTEXT_STATE_KO_EXCEP; break;}
    170                     case EVENT_TYPE_SPR_ACCESS         :
    171                     case EVENT_TYPE_MSYNC              :
    172                     case EVENT_TYPE_PSYNC              :
    173                     case EVENT_TYPE_CSYNC              :
    174                     case EVENT_TYPE_NONE               :
    175                     case EVENT_TYPE_MISS_SPECULATION   :
    176                     case EVENT_TYPE_BRANCH_NO_ACCURATE :
    177                     default :
    178                       {
    179                         throw ERRORMORPHEO(FUNCTION,toString(_("COMMIT_EVENT [%d] : invalid event_type : %s.\n"),i,toString(type).c_str()));
    180                       }
    181                     }
    182                   reg_STATE                  [context] = state_next;
    183                   reg_EVENT_ADDRESS          [context] = PORT_READ(in_COMMIT_EVENT_ADDRESS          [i]);
    184                   reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_COMMIT_EVENT_ADDRESS_EPCR     [i]);
    185                   reg_EVENT_ADDRESS_EPCR_VAL [context] = 1;
    186                   reg_EVENT_ADDRESS_EEAR     [context] = PORT_READ(in_COMMIT_EVENT_ADDRESS_EEAR     [i]);
    187                   reg_EVENT_ADDRESS_EEAR_VAL [context] = PORT_READ(in_COMMIT_EVENT_ADDRESS_EEAR_VAL [i]);
    188                   reg_EVENT_IS_DELAY_SLOT    [context] = PORT_READ(in_COMMIT_EVENT_IS_DELAY_SLOT    [i]);
    189                 //reg_EVENT_IS_DS_TAKE       [context] = 0;
    190                   reg_EVENT_DEPTH            [context] = depth;
    191                 }
    192             }
    193 
    194         // -------------------------------------------------------------------
    195         // -----[ BRANCH_COMPLETE ]-------------------------------------------
    196         // -------------------------------------------------------------------
    197 
    198         for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
    199           if (PORT_READ(in_BRANCH_COMPLETE_VAL [i]) and internal_BRANCH_COMPLETE_ACK [i])
    200             {
    201               if (PORT_READ(in_BRANCH_COMPLETE_MISS_PREDICTION [i]))
    202                 {
    203                   Tcontext_t context    = (_param->_have_port_context_id     )?PORT_READ(in_BRANCH_COMPLETE_CONTEXT_ID [i]):0;
    204                   Tdepth_t   depth      = (_param->_have_port_max_depth      )?PORT_READ(in_BRANCH_COMPLETE_DEPTH      [i]):0;
    205                   Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
    206                   Tdepth_t   depth_base = (_param->_have_port_depth [context])?PORT_READ(in_DEPTH_TAIL        [context]):0;
    207                   Tdepth_t   depth_max  = _param->_size_depth [context];
    208                  
    209                   Tdepth_t   depth0     = (depth_cur>=depth_base)?(depth_cur-depth_base):((depth_cur+depth_max-depth_base));
    210                   Tdepth_t   depth1     = (depth    >=depth_base)?(depth    -depth_base):((depth    +depth_max-depth_base));
    211                  
    212                   context_state_t state = reg_STATE [context];
    213                  
    214                   // miss > excep > spr/sync
    215                   uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
    216                   uint8_t    priority1  = 2;
    217                  
    218                   // is_valid = can modify local information
    219                   //  if context_state_ok : yes
    220                   //  if context_state_ko : test the depth, and the priority of envent
    221                  
    222                   bool       is_valid   = ((state == CONTEXT_STATE_OK) or
    223                                            (depth1< depth0) or
    224                                            ((depth1==depth0) and (priority1>priority0)));
    225                  
    226                   if (is_valid)
    227                     {
    228                       // commit
    229                       Tcontrol_t take = PORT_READ(in_BRANCH_COMPLETE_TAKE [i]);
    230                       reg_STATE                  [context] = CONTEXT_STATE_KO_MISS;
    231                       reg_EVENT_ADDRESS          [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_SRC  [i])+1; //DELAY_SLOT
    232                       reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_DEST [i]);
    233                       reg_EVENT_ADDRESS_EPCR_VAL [context] = take; // if not take : in sequence
    234                     //reg_EVENT_ADDRESS_EEAR     [context];
    235                     //reg_EVENT_ADDRESS_EEAR_VAL [context];
    236                       reg_EVENT_IS_DELAY_SLOT    [context] = take;
    237                       reg_EVENT_IS_DS_TAKE       [context] = take;
    238                       reg_EVENT_DEPTH            [context] = depth;
    239                     }
    240                 }
    241             }
    242 
    243         // -------------------------------------------------------------------
    244         // -----[ EVENT ]-----------------------------------------------------
    245         // -------------------------------------------------------------------
    246         for (uint32_t i=0; i<_param->_nb_context; i++)
    247           if (internal_EVENT_VAL [i] and PORT_READ(in_EVENT_ACK [i]))
    248             {
    249               // Write pc
    250               context_state_t state = reg_STATE [i];
    251 
    252               switch (state)
    253                 {
    254                 case CONTEXT_STATE_KO_EXCEP_ADDR :
    255                   {
    256                     reg_STATE [i] = CONTEXT_STATE_KO_EXCEP_SPR;
    257                     break;
    258                   }
    259                 case CONTEXT_STATE_KO_MISS_ADDR  :
    260                 case CONTEXT_STATE_KO_PSYNC_ADDR :
    261                 case CONTEXT_STATE_KO_CSYNC_ADDR :
    262                   {
    263                     reg_STATE [i] = CONTEXT_STATE_OK;
    264                     break;
    265                   }
    266                 default :
    267                   {
     36        // -------------------------------------------------------------------
     37        // -----[ BRANCH_EVENT ]----------------------------------------------
     38        // -------------------------------------------------------------------
     39        for (uint32_t i=0; i<_param->_nb_context; ++i)
     40          if (PORT_READ(in_BRANCH_EVENT_VAL [i]) and internal_BRANCH_EVENT_ACK [i])
     41            {
     42//               throw ERRORMORPHEO(FUNCTION,_("Not yet implemented (Comming Soon).\n"));
     43
     44              context_state_t state = reg_STATE [i];
     45
     46              Tdepth_t   depth      = // (_param->_have_port_depth)?PORT_READ(in_BRANCH_EVENT_DEPTH [i]):
     47                0;
     48              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [i];
     49              Tdepth_t   depth_min  = (_param->_have_port_depth)?PORT_READ(in_DEPTH_MIN [i]):0;
     50              Tdepth_t   depth_max  = _param->_array_size_depth [i];
     51             
     52//               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
     53//               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
     54              Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
     55              Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
     56
     57              // priority : miss > excep > spr/sync
     58              uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == EVENT_TYPE_EXCEPTION)?1:0);
     59              uint8_t    priority1  = 2; // miss
     60
     61              // is_valid = can modify local information
     62              //   if context_state_ok : yes
     63              //   if context_state_ko : test the depth, and the priority of envent
     64
     65              bool       is_valid   = ((state == CONTEXT_STATE_OK) or
     66                                       (depth1< depth0) or
     67                                       ((depth1==depth0) and (priority1>priority0)));
     68
     69              if (is_valid)
     70                {
     71                  reg_STATE                  [i] =  CONTEXT_STATE_KO_MISS;
     72                  reg_EVENT_ADDRESS          [i] =  PORT_READ(in_BRANCH_EVENT_ADDRESS_SRC [i])+1; // address delay slot
     73                  reg_EVENT_ADDRESS_EPCR     [i] =  PORT_READ(in_BRANCH_EVENT_ADDRESS_DEST[i]);   // address_next
     74                  reg_EVENT_ADDRESS_EPCR_VAL [i] =  1; // address_dest is valid
     75                //reg_EVENT_ADDRESS_EEAR     [i] =  0;
     76                  reg_EVENT_ADDRESS_EEAR_VAL [i] =  0;
     77                  reg_EVENT_IS_DELAY_SLOT    [i] =  1;
     78                  reg_EVENT_IS_DS_TAKE       [i] =  0;// ??
     79                  reg_EVENT_DEPTH            [i] =  depth;
     80                }
     81            }
     82       
     83        // -------------------------------------------------------------------
     84        // -----[ DECOD_EVENT ]-----------------------------------------------
     85        // -------------------------------------------------------------------
     86
     87        for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
     88          if (PORT_READ(in_DECOD_EVENT_VAL [i]) and internal_DECOD_EVENT_ACK [i])
     89            {
     90              Tcontext_t context    = (_param->_have_port_context_id )?PORT_READ(in_DECOD_EVENT_CONTEXT_ID [i]):0;
     91              Tdepth_t   depth      = (_param->_have_port_depth      )?PORT_READ(in_DECOD_EVENT_DEPTH      [i]):0;
     92              Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
     93              Tdepth_t   depth_min = (_param->_have_port_depth      )?PORT_READ(in_DEPTH_MIN [context]):0;
     94              Tdepth_t   depth_max  = _param->_array_size_depth [context];
     95             
     96//               Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
     97//               Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
     98              Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
     99              Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
     100
     101              context_state_t state = reg_STATE [context];
     102              Tevent_type_t   type  = PORT_READ(in_DECOD_EVENT_TYPE [i]);
     103             
     104              // miss > excep > spr/sync
     105              uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     106              uint8_t    priority1  = (state == EVENT_TYPE_EXCEPTION)?1:0;
     107
     108              // is_valid = can modify local information
     109              //  if context_state_ok : yes
     110              //  if context_state_ko : test the depth, and the priority of envent
     111
     112              bool       is_valid   = ((state == CONTEXT_STATE_OK) or
     113                                       (depth1< depth0) or
     114                                       ((depth1==depth0) and (priority1>priority0)));
     115
     116              if (is_valid)
     117                {
     118                  // decod :
     119                  // type : csync, psync, msync, spr_access (l.mac, l.maci, l.macrc, l.msb, l.mfspr, l.mtspr), exception (l.sys)
     120                  context_state_t state_next    = state;
     121                  Taddress_t      address       = PORT_READ(in_DECOD_EVENT_ADDRESS       [i]);
     122                  Tcontrol_t      is_delay_slot = PORT_READ(in_DECOD_EVENT_IS_DELAY_SLOT [i]);
     123
     124                  switch (type)
     125                    {
     126                    case EVENT_TYPE_EXCEPTION          :
     127                      {
     128                        state_next = CONTEXT_STATE_KO_EXCEP;
     129
     130                        break;
     131                      }
     132                    case EVENT_TYPE_SPR_ACCESS         :
     133                      {
     134                        state_next = CONTEXT_STATE_KO_SPR  ;
     135                        address++; // take next address
     136                        if (is_delay_slot)
     137                          throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
     138                        break;
     139                      }
     140                    case EVENT_TYPE_MSYNC              :
     141                      {
     142                        state_next = CONTEXT_STATE_KO_MSYNC;
     143                        address++;  // take next address
     144                        if (is_delay_slot)
     145                          throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
     146                        break;
     147                      }
     148                    case EVENT_TYPE_PSYNC              :
     149                      {
     150                        state_next = CONTEXT_STATE_KO_PSYNC;
     151                        address++;  // take next address
     152                        if (is_delay_slot)
     153                          throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
     154                        break;
     155                      }
     156                    case EVENT_TYPE_CSYNC              :
     157                      {
     158                        state_next = CONTEXT_STATE_KO_CSYNC;
     159                        address++;  // take next address
     160                        if (is_delay_slot)
     161                          throw ERRORMORPHEO(FUNCTION,"SPR access in delay slot, not supported.\n");
     162                        break;
     163                      }               
     164                    case EVENT_TYPE_NONE               :
     165                    case EVENT_TYPE_MISS_SPECULATION   :
     166                    case EVENT_TYPE_BRANCH_NO_ACCURATE :
     167                    default :
     168                      {
     169                        throw ERRORMORPHEO(FUNCTION,toString(_("DECOD_EVENT [%d] : invalid event_type : %s.\n"),i,toString(type).c_str()));
     170                      }
     171                    }
     172
     173                  reg_STATE                  [context] = state_next;
     174                  reg_EVENT_ADDRESS          [context] = address;
     175                  reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_DECOD_EVENT_ADDRESS_EPCR  [i]);
     176                  reg_EVENT_ADDRESS_EPCR_VAL [context] = 1;
     177                //reg_EVENT_ADDRESS_EEAR     [context]
     178                  reg_EVENT_ADDRESS_EEAR_VAL [context] = 0;
     179                  reg_EVENT_IS_DELAY_SLOT    [context] = is_delay_slot;
     180                //reg_EVENT_IS_DS_TAKE       [context] = 0;
     181                  reg_EVENT_DEPTH            [context] = depth;
     182                }
     183            }
     184
     185        // -------------------------------------------------------------------
     186        // -----[ COMMIT_EVENT ]----------------------------------------------
     187        // -------------------------------------------------------------------
     188
     189        if (PORT_READ(in_COMMIT_EVENT_VAL ) and internal_COMMIT_EVENT_ACK )
     190          {
     191            Tcontext_t context    = (_param->_have_port_context_id)?PORT_READ(in_COMMIT_EVENT_CONTEXT_ID ):0;
     192            Tdepth_t   depth      = (_param->_have_port_depth     )?PORT_READ(in_COMMIT_EVENT_DEPTH      ):0;
     193            Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
     194            Tdepth_t   depth_min = (_param->_have_port_depth     )?PORT_READ(in_DEPTH_MIN [context]):0;
     195            Tdepth_t   depth_max  = _param->_array_size_depth [context];
     196           
     197//             Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
     198//             Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
     199            Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
     200            Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
     201
     202            context_state_t state = reg_STATE [context];
     203            Tevent_type_t   type  = PORT_READ(in_COMMIT_EVENT_TYPE );
     204           
     205            // miss > excep > spr/sync
     206            uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     207            uint8_t    priority1  = 1; // exception
     208
     209            // is_valid = can modify local information
     210            //  if context_state_ok : yes
     211            //  if context_state_ko : test the depth, and the priority of envent
     212
     213            bool       is_valid   = ((state == CONTEXT_STATE_OK) or
     214                                     (depth1< depth0) or
     215                                     ((depth1==depth0) and (priority1>priority0)));
     216
     217            if (is_valid)
     218              {
     219                // commit
     220                // type : exception
     221                context_state_t state_next = state;
     222                switch (type)
     223                  {
     224                  case EVENT_TYPE_EXCEPTION          : {state_next = CONTEXT_STATE_KO_EXCEP; break;}
     225                  case EVENT_TYPE_SPR_ACCESS         :
     226                  case EVENT_TYPE_MSYNC              :
     227                  case EVENT_TYPE_PSYNC              :
     228                  case EVENT_TYPE_CSYNC              :
     229                  case EVENT_TYPE_NONE               :
     230                  case EVENT_TYPE_MISS_SPECULATION   :
     231                  case EVENT_TYPE_BRANCH_NO_ACCURATE :
     232                  default :
     233                    {
     234                      throw ERRORMORPHEO(FUNCTION,toString(_("COMMIT_EVENT : invalid event_type : %s.\n"),toString(type).c_str()));
     235                    }
     236                  }
     237                reg_STATE                  [context] = state_next;
     238                reg_EVENT_ADDRESS          [context] = PORT_READ(in_COMMIT_EVENT_ADDRESS          );
     239                reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_COMMIT_EVENT_ADDRESS_EPCR     );
     240                reg_EVENT_ADDRESS_EPCR_VAL [context] = 1;
     241                reg_EVENT_ADDRESS_EEAR     [context] = PORT_READ(in_COMMIT_EVENT_ADDRESS_EEAR     );
     242                reg_EVENT_ADDRESS_EEAR_VAL [context] = PORT_READ(in_COMMIT_EVENT_ADDRESS_EEAR_VAL );
     243                reg_EVENT_IS_DELAY_SLOT    [context] = PORT_READ(in_COMMIT_EVENT_IS_DELAY_SLOT    );
     244              //reg_EVENT_IS_DS_TAKE       [context] = 0;
     245                reg_EVENT_DEPTH            [context] = depth;
     246              }
     247          }
     248
     249        // -------------------------------------------------------------------
     250        // -----[ BRANCH_COMPLETE ]-------------------------------------------
     251        // -------------------------------------------------------------------
     252
     253        for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
     254          if (PORT_READ(in_BRANCH_COMPLETE_VAL [i]) and internal_BRANCH_COMPLETE_ACK [i])
     255            {
     256              if (PORT_READ(in_BRANCH_COMPLETE_MISS_PREDICTION [i]))
     257                {
     258                  Tcontext_t context    = (_param->_have_port_context_id)?PORT_READ(in_BRANCH_COMPLETE_CONTEXT_ID [i]):0;
     259                  Tdepth_t   depth      = (_param->_have_port_depth     )?PORT_READ(in_BRANCH_COMPLETE_DEPTH      [i]):0;
     260                  Tdepth_t   depth_cur  = reg_EVENT_DEPTH [context];
     261                  Tdepth_t   depth_min = (_param->_have_port_depth     )?PORT_READ(in_DEPTH_MIN [context]):0;
     262                  Tdepth_t   depth_max  = _param->_array_size_depth [context];
     263                 
     264//                   Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur-depth_min):((depth_cur+depth_max-depth_min));
     265//                   Tdepth_t   depth1     = (depth    >=depth_min)?(depth    -depth_min):((depth    +depth_max-depth_min));
     266                  Tdepth_t   depth0     = (depth_cur>=depth_min)?(depth_cur):((depth_cur+depth_max));
     267                  Tdepth_t   depth1     = (depth    >=depth_min)?(depth    ):((depth    +depth_max));
     268                 
     269                  context_state_t state = reg_STATE [context];
     270                 
     271                  // miss > excep > spr/sync
     272                  uint8_t    priority0  = (state == CONTEXT_STATE_KO_MISS)?2:((state == CONTEXT_STATE_KO_EXCEP)?1:0);
     273                  uint8_t    priority1  = 2; // miss
     274                 
     275                  // is_valid = can modify local information
     276                  //  if context_state_ok : yes
     277                  //  if context_state_ko : test the depth, and the priority of envent
     278                 
     279                  bool       is_valid   = ((state == CONTEXT_STATE_OK) or
     280                                           (depth1< depth0) or
     281                                           ((depth1==depth0) and (priority1>priority0)));
     282                 
     283                  if (is_valid)
     284                    {
     285                      // commit
     286                      Tcontrol_t take = PORT_READ(in_BRANCH_COMPLETE_TAKE [i]);
     287                      reg_STATE                  [context] = CONTEXT_STATE_KO_MISS;
     288                      reg_EVENT_ADDRESS          [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_SRC  [i])+1; //DELAY_SLOT
     289                      reg_EVENT_ADDRESS_EPCR     [context] = PORT_READ(in_BRANCH_COMPLETE_ADDRESS_DEST [i]);
     290                      reg_EVENT_ADDRESS_EPCR_VAL [context] = take; // if not take : in sequence
     291                    //reg_EVENT_ADDRESS_EEAR     [context];
     292                      reg_EVENT_ADDRESS_EEAR_VAL [context] = 0;
     293                      reg_EVENT_IS_DELAY_SLOT    [context] = take;
     294                      reg_EVENT_IS_DS_TAKE       [context] = take;
     295                      reg_EVENT_DEPTH            [context] = depth;
     296                    }
     297                }
     298            }
     299
     300        // -------------------------------------------------------------------
     301        // -----[ EVENT ]-----------------------------------------------------
     302        // -------------------------------------------------------------------
     303        for (uint32_t i=0; i<_param->_nb_context; i++)
     304          if (internal_EVENT_VAL [i] and PORT_READ(in_EVENT_ACK [i]))
     305            {
     306              // Write pc
     307              context_state_t state = reg_STATE [i];
     308
     309              switch (state)
     310                {
     311                case CONTEXT_STATE_KO_EXCEP_ADDR :
     312                  {
     313                    reg_STATE [i] = CONTEXT_STATE_KO_EXCEP_SPR;
     314                    break;
     315                  }
     316                case CONTEXT_STATE_KO_MISS_ADDR  :
     317                case CONTEXT_STATE_KO_PSYNC_ADDR :
     318                case CONTEXT_STATE_KO_CSYNC_ADDR :
     319                  {
     320                    reg_STATE [i] = CONTEXT_STATE_OK;
     321                    break;
     322                  }
     323                default :
     324                  {
    268325#ifdef DEBUG_TEST
    269                     throw ERRORMORPHEO(FUNCTION,toString(_("SPR[%d], Invalid state : %s.\n"),i,toString(state).c_str()));
     326                    throw ERRORMORPHEO(FUNCTION,toString(_("SPR[%d], Invalid state : %s.\n"),i,toString(state).c_str()));
    270327#endif
    271                     break;
    272                   }
    273                 }
    274             }
    275 
    276         // -------------------------------------------------------------------
    277         // -----[ SPR ]-------------------------------------------------------
    278         // -------------------------------------------------------------------
    279         for (uint32_t i=0; i<_param->_nb_context; i++)
    280           if (internal_SPR_VAL [i] and PORT_READ(in_SPR_ACK [i]))
    281             {
    282               // Write spr
     328                    break;
     329                  }
     330                }
     331            }
     332
     333        // -------------------------------------------------------------------
     334        // -----[ SPR_EVENT ]-------------------------------------------------
     335        // -------------------------------------------------------------------
     336        for (uint32_t i=0; i<_param->_nb_context; i++)
     337          if (internal_SPR_EVENT_VAL [i] and PORT_READ(in_SPR_EVENT_ACK [i]))
     338            {
     339              // Write spr
    283340#ifdef DEBUG_TEST
    284               context_state_t state = reg_STATE [i];
    285            
    286               if (state != CONTEXT_STATE_KO_EXCEP_SPR)
    287                 throw ERRORMORPHEO(FUNCTION,toString(_("SPR[%d], Invalid state : %s.\n"),i,toString(state).c_str()));
     341              context_state_t state = reg_STATE [i];
     342           
     343              if (state != CONTEXT_STATE_KO_EXCEP_SPR)
     344                throw ERRORMORPHEO(FUNCTION,toString(_("SPR_EVENT[%d], Invalid state : %s.\n"),i,toString(state).c_str()));
    288345#endif
    289              
    290               reg_STATE [i] = CONTEXT_STATE_OK;
    291             }
    292 
    293         // -------------------------------------------------------------------
    294         // -----[ next state ]------------------------------------------------
    295         // -------------------------------------------------------------------
    296         for (uint32_t i=0; i<_param->_nb_context; i++)
    297           {
    298             uint32_t x = _param->_link_context_to_decod_unit    [i];
    299             uint32_t y = _param->_link_decod_unit_to_ooo_engine [x];
    300 
    301             Tcounter_t inst_all = PORT_READ(in_NB_INST_COMMIT_ALL [y]) + PORT_READ(in_NB_INST_DECOD_ALL [x]);
    302             Tcounter_t inst_mem = PORT_READ(in_NB_INST_COMMIT_MEM [y]) + PORT_READ(in_NB_INST_DECOD_ALL [x]);
    303 
    304             context_state_t state = reg_STATE [i];
    305 
    306             switch (state)
    307               {
    308               case CONTEXT_STATE_OK              :
    309                 {
    310                   // nothing, wait an event
    311                   break;
    312                 }
    313               case CONTEXT_STATE_KO_EXCEP        :
    314                 {
    315                   // Wait end of all instruction
    316                   if (inst_all == 0)
    317                     state = CONTEXT_STATE_KO_EXCEP_ADDR;
    318                   break;
    319                 }
    320               case CONTEXT_STATE_KO_MISS         :
    321                 {
    322                   // Wait end of all instruction
    323                   if (inst_all == 0)
    324                     state = CONTEXT_STATE_KO_MISS_ADDR;
    325                   break;
    326                 }
    327               case CONTEXT_STATE_KO_EXCEP_ADDR   :
    328                 {
    329                   // nothing, wait the update of internal register (pc)
    330                   break;
    331                 }
    332               case CONTEXT_STATE_KO_EXCEP_SPR    :
    333                 {
    334                   // nothing, wait the update of internal register (epcr, eear, sr, esr)
    335                   break;
    336                 }
    337               case CONTEXT_STATE_KO_MISS_ADDR    :
    338                 {
    339                   // nothing, wait the update of internal register (pc)
    340                   break;
    341                 }
    342               case CONTEXT_STATE_KO_PSYNC        :
    343                 {
    344                   // Wait end of all instruction
    345                   if (inst_all == 0)
    346 //                  state = CONTEXT_STATE_KO_PSYNC_FLUSH;
    347                     state = CONTEXT_STATE_KO_PSYNC_ADDR ;
    348                   break;
    349                 }
    350 //            case CONTEXT_STATE_KO_PSYNC_FLUSH  :
    351 //              {
    352 //                // nothing, wait end of flush (ifetch)
    353 //                break;
    354 //              }
    355               case CONTEXT_STATE_KO_PSYNC_ADDR   :
    356                 {
    357                   // nothing, wait the pc write
    358                   break;
    359                 }
    360               case CONTEXT_STATE_KO_CSYNC        :
    361                 {
    362                   // Wait end of all instruction
    363                   if (inst_all == 0)
    364                     state = CONTEXT_STATE_KO_CSYNC_ADDR ;
    365 //                  state = CONTEXT_STATE_KO_CSYNC_FLUSH;
    366                   break;
    367                 }
    368 //            case CONTEXT_STATE_KO_CSYNC_FLUSH  :
    369 //              {
    370 //                // nothing, wait end of flush (all internal structure)
    371 //                break;
    372 //              }
    373               case CONTEXT_STATE_KO_CSYNC_ADDR   :
    374                 {
    375                   // nothing, wait the pc write
    376                   break;
    377                 }
    378               case CONTEXT_STATE_KO_MSYNC        :
    379                 {
    380                   // Wait end of memory instruction
    381                   if (inst_mem == 0)
    382                     state = CONTEXT_STATE_KO_MSYNC_ISSUE;
    383                   break;
    384                 }
    385               case CONTEXT_STATE_KO_MSYNC_ISSUE  :
    386                 {
    387                   // Wait the msync issue
    388                   if (inst_mem != 0)
    389                     state = CONTEXT_STATE_KO_MSYNC_EXEC;
    390                   break;
    391                 }
    392               case CONTEXT_STATE_KO_MSYNC_EXEC   :
    393                 {
    394                   // Wait the end of msync
    395                   if (inst_mem == 0)
    396                     state = CONTEXT_STATE_OK;
    397                   break;
    398                 }
    399               case CONTEXT_STATE_KO_SPR          :
    400                 {
    401                   // Wait end of all instruction
    402                   if (inst_all == 0)
    403                     state = CONTEXT_STATE_KO_SPR_ISSUE;
    404                   break;
    405                 }
    406               case CONTEXT_STATE_KO_SPR_ISSUE    :
    407                 {
    408                   // Wait the spr_access issue
    409                   if (inst_all != 0)
    410                     state = CONTEXT_STATE_KO_SPR_EXEC;
    411                   break;
    412                 }
    413               case CONTEXT_STATE_KO_SPR_EXEC     :
    414                 {
    415                   // Wait the spr_access execution
    416                   if (inst_all == 0)
    417                     state = CONTEXT_STATE_OK;
    418                   break;
    419                 }
    420 
    421               default :
    422                 {
    423                   throw ERRORMORPHEO(FUNCTION,toString(_("Context[%d], Unknow state : %s.\n"),i,toString(state).c_str()));
    424                 }
    425               }
    426             reg_STATE [i] = state;
    427           }
     346             
     347              reg_STATE [i] = CONTEXT_STATE_OK;
     348            }
     349
     350        // -------------------------------------------------------------------
     351        // -----[ next state ]------------------------------------------------
     352        // -------------------------------------------------------------------
     353        for (uint32_t i=0; i<_param->_nb_context; i++)
     354          {
     355//             uint32_t x = _param->_link_context_to_decod_unit    [i];
     356
     357            Tcounter_t inst_all = PORT_READ(in_NB_INST_COMMIT_ALL[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
     358            Tcounter_t inst_mem = PORT_READ(in_NB_INST_COMMIT_MEM[i]) + PORT_READ(in_NB_INST_DECOD_ALL [i]);
     359
     360            context_state_t state = reg_STATE [i];
     361
     362            switch (state)
     363              {
     364              case CONTEXT_STATE_OK              :
     365                {
     366                  // nothing, wait an event
     367                  break;
     368                }
     369              case CONTEXT_STATE_KO_EXCEP        :
     370                {
     371                  // Wait end of all instruction
     372                  if (inst_all == 0)
     373                    state = CONTEXT_STATE_KO_EXCEP_ADDR;
     374                  break;
     375                }
     376              case CONTEXT_STATE_KO_MISS         :
     377                {
     378                  // Wait end of all instruction
     379                  if (inst_all == 0)
     380                    state = CONTEXT_STATE_KO_MISS_ADDR;
     381                  break;
     382                }
     383              case CONTEXT_STATE_KO_EXCEP_ADDR   :
     384                {
     385                  // nothing, wait the update of internal register (pc)
     386                  break;
     387                }
     388              case CONTEXT_STATE_KO_EXCEP_SPR    :
     389                {
     390                  // nothing, wait the update of internal register (epcr, eear, sr, esr)
     391                  break;
     392                }
     393              case CONTEXT_STATE_KO_MISS_ADDR    :
     394                {
     395                  // nothing, wait the update of internal register (pc)
     396                  break;
     397                }
     398              case CONTEXT_STATE_KO_PSYNC        :
     399                {
     400                  // Wait end of all instruction
     401                  if (inst_all == 0)
     402//                  state = CONTEXT_STATE_KO_PSYNC_FLUSH;
     403                    state = CONTEXT_STATE_KO_PSYNC_ADDR ;
     404                  break;
     405                }
     406//            case CONTEXT_STATE_KO_PSYNC_FLUSH  :
     407//              {
     408//                // nothing, wait end of flush (ifetch)
     409//                break;
     410//              }
     411              case CONTEXT_STATE_KO_PSYNC_ADDR   :
     412                {
     413                  // nothing, wait the pc write
     414                  break;
     415                }
     416              case CONTEXT_STATE_KO_CSYNC        :
     417                {
     418                  // Wait end of all instruction
     419                  if (inst_all == 0)
     420                    state = CONTEXT_STATE_KO_CSYNC_ADDR ;
     421//                  state = CONTEXT_STATE_KO_CSYNC_FLUSH;
     422                  break;
     423                }
     424//            case CONTEXT_STATE_KO_CSYNC_FLUSH  :
     425//              {
     426//                // nothing, wait end of flush (all internal structure)
     427//                break;
     428//              }
     429              case CONTEXT_STATE_KO_CSYNC_ADDR   :
     430                {
     431                  // nothing, wait the pc write
     432                  break;
     433                }
     434              case CONTEXT_STATE_KO_MSYNC        :
     435                {
     436                  // Wait end of memory instruction
     437                  if (inst_mem == 0)
     438                    state = CONTEXT_STATE_KO_MSYNC_ISSUE;
     439                  break;
     440                }
     441              case CONTEXT_STATE_KO_MSYNC_ISSUE  :
     442                {
     443                  // Wait the msync issue
     444                  if (inst_mem != 0)
     445                    state = CONTEXT_STATE_KO_MSYNC_EXEC;
     446                  break;
     447                }
     448              case CONTEXT_STATE_KO_MSYNC_EXEC   :
     449                {
     450                  // Wait the end of msync
     451                  if (inst_mem == 0)
     452                    state = CONTEXT_STATE_OK;
     453                  break;
     454                }
     455              case CONTEXT_STATE_KO_SPR          :
     456                {
     457                  // Wait end of all instruction
     458                  if (inst_all == 0)
     459                    state = CONTEXT_STATE_KO_SPR_ISSUE;
     460                  break;
     461                }
     462              case CONTEXT_STATE_KO_SPR_ISSUE    :
     463                {
     464                  // Wait the spr_access issue
     465                  if (inst_all != 0)
     466                    state = CONTEXT_STATE_KO_SPR_EXEC;
     467                  break;
     468                }
     469              case CONTEXT_STATE_KO_SPR_EXEC     :
     470                {
     471                  // Wait the spr_access execution
     472                  if (inst_all == 0)
     473                    state = CONTEXT_STATE_OK;
     474                  break;
     475                }
     476
     477              default :
     478                {
     479                  throw ERRORMORPHEO(FUNCTION,toString(_("Context[%d], Unknow state : %s.\n"),i,toString(state).c_str()));
     480                }
     481              }
     482            reg_STATE [i] = state;
     483          }
     484
     485        for (uint32_t i=0; i<_param->_nb_context; ++i)
     486          {
     487            reg_INTERRUPT_ENABLE [i] = PORT_READ(in_INTERRUPT_ENABLE [i]) and PORT_READ(in_SPR_SR_IEE [i]);
     488
     489            if (reg_INTERRUPT_ENABLE [i])
     490              throw ERRORMORPHEO(FUNCTION,toString(_("Context[%d], Have an interruption, Not yet supported (Comming Soon).\n"),i));
     491          }
    428492      }
    429493
     
    431495    for (uint32_t i=0; i<_param->_nb_context; i++)
    432496      {
    433         log_printf(TRACE,Context_State,FUNCTION,"Context State [%d]",i);
    434         log_printf(TRACE,Context_State,FUNCTION," * reg_STATE                  : %s"  ,toString(reg_STATE [i]).c_str());
    435         log_printf(TRACE,Context_State,FUNCTION," * reg_EVENT_ADDRESS          : 0x%x",reg_EVENT_ADDRESS          [i]);
    436         log_printf(TRACE,Context_State,FUNCTION," * reg_EVENT_ADDRESS_EPCR     : 0x%x",reg_EVENT_ADDRESS_EPCR     [i]);
    437         log_printf(TRACE,Context_State,FUNCTION," * reg_EVENT_ADDRESS_EPCR_VAL : %d"  ,reg_EVENT_ADDRESS_EPCR_VAL [i]);
    438         log_printf(TRACE,Context_State,FUNCTION," * reg_EVENT_ADDRESS_EEAR     : 0x%x",reg_EVENT_ADDRESS_EEAR     [i]);
    439         log_printf(TRACE,Context_State,FUNCTION," * reg_EVENT_ADDRESS_EEAR_VAL : %d"  ,reg_EVENT_ADDRESS_EEAR_VAL [i]);
    440         log_printf(TRACE,Context_State,FUNCTION," * reg_EVENT_IS_DELAY_SLOT    : %d"  ,reg_EVENT_IS_DELAY_SLOT    [i]);
    441         log_printf(TRACE,Context_State,FUNCTION," * reg_EVENT_IS_DS_TAKE       : %d"  ,reg_EVENT_IS_DS_TAKE       [i]);
    442         log_printf(TRACE,Context_State,FUNCTION," * reg_EVENT_DEPTH            : %d"  ,reg_EVENT_DEPTH            [i]);
     497        log_printf(TRACE,Context_State,FUNCTION,"  * Dump Context State [%d]",i);
     498        log_printf(TRACE,Context_State,FUNCTION,"    * reg_STATE                  : %s"         ,toString(reg_STATE [i]).c_str());
     499        log_printf(TRACE,Context_State,FUNCTION,"    * reg_EVENT_ADDRESS          : 0x%x (0x%x)",reg_EVENT_ADDRESS          [i],reg_EVENT_ADDRESS      [i]<<2);
     500        log_printf(TRACE,Context_State,FUNCTION,"    * reg_EVENT_ADDRESS_EPCR     : 0x%x (0x%x)",reg_EVENT_ADDRESS_EPCR     [i],reg_EVENT_ADDRESS_EPCR [i]<<2);
     501        log_printf(TRACE,Context_State,FUNCTION,"    * reg_EVENT_ADDRESS_EPCR_VAL : %d"         ,reg_EVENT_ADDRESS_EPCR_VAL [i]);
     502        log_printf(TRACE,Context_State,FUNCTION,"    * reg_EVENT_ADDRESS_EEAR     : 0x%x (0x%x)",reg_EVENT_ADDRESS_EEAR     [i],reg_EVENT_ADDRESS_EEAR [i]<<2);
     503        log_printf(TRACE,Context_State,FUNCTION,"    * reg_EVENT_ADDRESS_EEAR_VAL : %d"         ,reg_EVENT_ADDRESS_EEAR_VAL [i]);
     504        log_printf(TRACE,Context_State,FUNCTION,"    * reg_EVENT_IS_DELAY_SLOT    : %d"         ,reg_EVENT_IS_DELAY_SLOT    [i]);
     505        log_printf(TRACE,Context_State,FUNCTION,"    * reg_EVENT_IS_DS_TAKE       : %d"         ,reg_EVENT_IS_DS_TAKE       [i]);
     506        log_printf(TRACE,Context_State,FUNCTION,"    * reg_EVENT_DEPTH            : %d"         ,reg_EVENT_DEPTH            [i]);
    443507      }
    444508#endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Parameters.cpp

    r83 r88  
    2121  Parameters::Parameters (uint32_t   nb_context,
    2222                          uint32_t   nb_decod_unit,
    23                           uint32_t   nb_ooo_engine,
    2423                          uint32_t   nb_inst_branch_complete,
    2524                          uint32_t * size_depth,               
    2625                          uint32_t   size_address,
    27                           uint32_t * size_inst_decod,           
    28                           uint32_t * size_inst_commit,         
     26                          uint32_t * size_nb_inst_decod,           
     27                          uint32_t   size_nb_inst_commit,         
    2928                          uint32_t * link_context_to_decod_unit,
    30                           uint32_t * link_decod_unit_to_ooo_engine)
     29                          bool       is_toplevel)
    3130  {
    3231    log_begin(Context_State,FUNCTION);
     
    3433    _nb_context                    = nb_context                   ;
    3534    _nb_decod_unit                 = nb_decod_unit                ;
    36     _nb_ooo_engine                 = nb_ooo_engine                ;
    3735    _nb_inst_branch_complete       = nb_inst_branch_complete      ;
    38     _size_depth                    = size_depth                   ;
    39     _size_address                  = size_address                 ;
    40     _size_inst_decod               = size_inst_decod              ;
    41     _size_inst_commit              = size_inst_commit             ;
     36    _array_size_depth              = size_depth                   ;
     37//  _size_address                  = size_address                 ;
     38//  _size_nb_inst_decod            = size_nb_inst_decod           ;
     39//  _size_nb_inst_commit           = size_nb_inst_commit          ;
    4240    _link_context_to_decod_unit    = link_context_to_decod_unit   ;
    43     _link_decod_unit_to_ooo_engine = link_decod_unit_to_ooo_engine;
     41
     42    test();
     43
     44    if (is_toplevel)
     45      {
     46        _size_context_id               = log2(_nb_context);
     47        _size_depth                    = log2(max<uint32_t>(size_depth,_nb_context));
     48        _size_instruction_address      = size_address;
     49        _size_nb_inst_decod            = max<uint32_t>(size_nb_inst_decod,_nb_decod_unit);
     50        _size_nb_inst_commit           = size_nb_inst_commit;
     51
     52        _have_port_context_id          = (_size_context_id>0);
     53        _have_port_depth               = (_size_depth > 0);
     54
     55        copy ();
     56      }
    4457   
    45     _size_context_id               = log2(_nb_context);
    46     _size_max_depth                = max<uint32_t>(_size_depth,_nb_context);
    47 
    48     _have_port_context_id          = (_size_context_id>0);
    49     _have_port_max_depth           = (_size_max_depth >0);
    50     _have_port_depth               = new bool [_nb_context];
    51     for (uint32_t i=0; i<_nb_context; i++)
    52       _have_port_depth [i] = (_size_depth [i] >0);
    53    
    54     test();
    5558    log_end(Context_State,FUNCTION);
    5659  };
     
    7073  {
    7174    log_begin(Context_State,FUNCTION);
    72     delete [] _have_port_depth;
     75    log_end(Context_State,FUNCTION);
     76  };
     77
     78#undef  FUNCTION
     79#define FUNCTION "Context_State::copy"
     80  void Parameters::copy (void)
     81  {
     82    log_begin(Context_State,FUNCTION);
    7383    log_end(Context_State,FUNCTION);
    7484  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Parameters_msg_error.cpp

    r83 r88  
    4141        test.error(toString(_("The decod_unit [%d] have none context as source."),i));
    4242
    43     bool _is_link_ooo_engine_from_decod_unit [_nb_ooo_engine];
    44     for (uint32_t i=0; i<_nb_ooo_engine; i++)
    45       _is_link_ooo_engine_from_decod_unit [i] = false;
    46 
    47     for (uint32_t i=0; i<_nb_decod_unit; i++)
    48       {
    49         if (_link_decod_unit_to_ooo_engine [i] < _nb_ooo_engine)
    50           _is_link_ooo_engine_from_decod_unit [_link_decod_unit_to_ooo_engine[i]] = true;
    51         else
    52           test.error(toString(_("The decod_unit [%d] is linked with invalid ooo_engine."),i));
    53       }
    54 
    55     for (uint32_t i=0; i<_nb_ooo_engine; i++)
    56       if (_is_link_ooo_engine_from_decod_unit [i] == false)
    57         test.error(toString(_("The ooo_engine [%d] have none decod_unit as source."),i));
    58 
    5943    log_end(Context_State,FUNCTION);
    6044
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Parameters_print.cpp

    r83 r88  
    2727    xml.balise_open("context_state");
    2828    xml.singleton_begin("nb_context                   "); xml.attribut("value",toString(_nb_context                   )); xml.singleton_end();
    29     xml.singleton_begin("nb_decod_unit                "); xml.attribut("value",toString(_nb_decod_unit                )); xml.singleton_end();
    30     xml.singleton_begin("nb_ooo_engine                "); xml.attribut("value",toString(_nb_ooo_engine                )); xml.singleton_end();
     29//  xml.singleton_begin("nb_decod_unit                "); xml.attribut("value",toString(_nb_decod_unit                )); xml.singleton_end();
    3130    xml.singleton_begin("nb_inst_branch_complete      "); xml.attribut("value",toString(_nb_inst_branch_complete      )); xml.singleton_end();
    32     xml.singleton_begin("size_address                 "); xml.attribut("value",toString(_size_address                 )); xml.singleton_end();
     31//  xml.singleton_begin("size_address                 "); xml.attribut("value",toString(_size_address                 )); xml.singleton_end();
     32//  xml.singleton_begin("size_inst_commit             "); xml.attribut("value",toString(_size_inst_commit             )); xml.singleton_end();
    3333
    3434    for (uint32_t i=0;i<_nb_context; i++)
     
    3838        xml.  attribut("id"  ,toString(i));
    3939        xml. balise_open_end();
    40         xml.  singleton_begin("size_depth                   "); xml.attribut("value",toString(_size_depth                    [i])); xml.singleton_end();
     40//         xml.  singleton_begin("size_depth                   "); xml.attribut("value",toString(_size_depth                    [i])); xml.singleton_end();
    4141        xml.  singleton_begin("link_context_to_decod_unit   "); xml.attribut("value",toString(_link_context_to_decod_unit    [i])); xml.singleton_end();
    4242        xml. balise_close();
     
    4949        xml.  attribut("id"  ,toString(i));
    5050        xml. balise_open_end();
    51         xml.  singleton_begin("size_inst_decod              "); xml.attribut("value",toString(_size_inst_decod              [i])); xml.singleton_end();
    52         xml.  singleton_begin("link_decod_unit_to_ooo_engine"); xml.attribut("value",toString(_link_decod_unit_to_ooo_engine[i])); xml.singleton_end();
    53         xml. balise_close();
    54       }
    55 
    56     for (uint32_t i=0;i<_nb_ooo_engine; i++)
    57       {
    58         xml. balise_open_begin("component");
    59         xml.  attribut("type","ooo_engine");
    60         xml.  attribut("id"  ,toString(i));
    61         xml. balise_open_end();
    62         xml.  singleton_begin("size_inst_commit             "); xml.attribut("value",toString(_size_inst_commit             [i])); xml.singleton_end();
     51//      xml.  singleton_begin("size_inst_decod              "); xml.attribut("value",toString(_size_inst_decod              [i])); xml.singleton_end();
    6352        xml. balise_close();
    6453      }
Note: See TracChangeset for help on using the changeset viewer.