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

Almost complete design
with Test and test platform

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/src/Decod_genMealy.cpp

    r87 r88  
    2222  void Decod::genMealy (void)
    2323  {
    24     log_printf(TRACE,Decod,FUNCTION,"Begin");
     24    log_begin(Decod,FUNCTION);
     25    log_function(Decod,FUNCTION,_name.c_str());
    2526
    2627    //-----------------------------------
     
    3839      {
    3940        decod_val   [i] = false;
     41        predict_val [i] = false;
    4042      }
    4143
     
    5759    //-----------------------------------
    5860    // scan all decod "slot_out"
    59     log_printf(TRACE,Decod,FUNCTION,"KANE LIVE");   
    60     std::list<select_t>::iterator it=select.begin();
     61    std::list<generic::priority::select_t> * select = _priority->select();
     62    std::list<generic::priority::select_t>::iterator it=select->begin();
    6163    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
    6264      {
    63         while ((it != select.end())     and  // have a no scanned "slot_in" ?
     65        while ((it != select->end())    and  // have a no scanned "slot_in" ?
    6466               (decod_val [i] == false) and  // have not a previous selected entry?
    6567               (context_event_val == false)) // Have not a context_event (spr_access, exception, ...)
    6668          {
    67             log_printf(TRACE,Decod,FUNCTION,"loop");   
    68 
    6969            predict_val [i] = false;
    7070
    71             Tcontext_t x = it->_context ;
    72             uint32_t   y = it->_inst_fetch;
     71            Tcontext_t x = it->grp;
     72            uint32_t   y = it->elt;
    7373
    7474            // Test if this instruction is valid
     
    7676                (can_continue [x]                == 1))    // context can decod instruction (have not a previous event)
    7777              {
    78                 can_continue      [x] = can_continue_next [x];
     78                log_printf(TRACE,Decod,FUNCTION,"  * IFETCH [%d][%d]",x,y);   
     79
     80                can_continue [x] = can_continue_next [x];
    7981
    8082                decod_val  [i]    = true;                        // fetch_val and decod_enable
     
    9092                _decod_instruction->_is_delay_slot    = internal_CONTEXT_IS_DELAY_SLOT [x];
    9193
    92                 // Decod !
    93                 log_printf(TRACE,Decod,FUNCTION,"DECOD [%d]",i);
    94                 log_printf(TRACE,Decod,FUNCTION,"  * context       : %d",x);
    95                 log_printf(TRACE,Decod,FUNCTION,"  * fetch         : %d",y);
    96                 log_printf(TRACE,Decod,FUNCTION,"  * address       : %.8x",addr);
    97                 log_printf(TRACE,Decod,FUNCTION,"  * is_delay_slot : %d",internal_CONTEXT_IS_DELAY_SLOT [x]);
    98 
    99                 instruction_decod (_decod_instruction, _decod_param[x]);
    100 
    101                 Ttype_t type = _decod_instruction->_type;
     94                // Test IFetch exception
     95                Texception_t ifetch_exception = PORT_READ(in_IFETCH_EXCEPTION [x]);
     96
     97                if (ifetch_exception == EXCEPTION_IFETCH_NONE)
     98                  {
     99                    // Decod !
     100                    log_printf(TRACE,Decod,FUNCTION,"  * DECOD [%d]",i);
     101                    log_printf(TRACE,Decod,FUNCTION,"    * context       : %d",x);
     102                    log_printf(TRACE,Decod,FUNCTION,"    * fetch         : %d",y);
     103                    log_printf(TRACE,Decod,FUNCTION,"    * address       : %.8x (%.8x)",addr,(addr<<2));
     104                    log_printf(TRACE,Decod,FUNCTION,"    * is_delay_slot : %d",internal_CONTEXT_IS_DELAY_SLOT [x]);
     105                   
     106                    instruction_decod (_decod_instruction, _decod_param[x]);
     107                  }
     108                else
     109                  {
     110                    // No decod : nop
     111                    instruction_l_nop (_decod_instruction, _decod_param[x]);
     112
     113                    _decod_instruction->_exception_use = EXCEPTION_USE_NONE;
     114                    _decod_instruction->_exception     = exception_ifetch_to_exception_decod(ifetch_exception);
     115                   
     116                    // INSTRUCTION_TLB 
     117                    // INSTRUCTION_PAGE
     118                    // BUS_ERROR       
     119                    if (_decod_instruction->_is_delay_slot)
     120                      _decod_instruction->_address_next       = _decod_instruction->_address_previous;
     121                    else
     122                      _decod_instruction->_address_next       = _decod_instruction->_address;
     123                   
     124                    _decod_instruction->_event_type         = EVENT_TYPE_EXCEPTION;
     125                  }
     126
     127                Ttype_t  type  = _decod_instruction->_type;
     128                Tdepth_t depth = (_param->_have_port_depth)?PORT_READ(in_CONTEXT_DEPTH [x]):0; // DEPTH_CURRENT
    102129
    103130                if (_param->_have_port_context_id)
    104131                PORT_WRITE(out_DECOD_CONTEXT_ID    [i], x);
    105132                if (_param->_have_port_depth)
    106                 PORT_WRITE(out_DECOD_DEPTH         [i], PORT_READ(in_CONTEXT_DEPTH [x]));
     133                PORT_WRITE(out_DECOD_DEPTH         [i], depth);
    107134                PORT_WRITE(out_DECOD_TYPE          [i], type);
    108135                PORT_WRITE(out_DECOD_OPERATION     [i], _decod_instruction->_operation     );
     136                PORT_WRITE(out_DECOD_NO_EXECUTE    [i], _decod_instruction->_no_execute    );
    109137                PORT_WRITE(out_DECOD_IS_DELAY_SLOT [i], _decod_instruction->_is_delay_slot );
    110138                PORT_WRITE(out_DECOD_ADDRESS       [i], addr);
     
    122150                PORT_WRITE(out_DECOD_NUM_REG_RE    [i], _decod_instruction->_num_reg_re    );
    123151                PORT_WRITE(out_DECOD_EXCEPTION_USE [i], _decod_instruction->_exception_use );
     152//              PORT_WRITE(out_DECOD_EXCEPTION     [i], _decod_instruction->_exception     );
    124153
    125154                if (type == TYPE_BRANCH)
    126155                  {
    127                     log_printf(TRACE,Decod,FUNCTION,"  * type is branch");
     156                    log_printf(TRACE,Decod,FUNCTION,"    * type is branch");
     157                    log_printf(TRACE,Decod,FUNCTION,"      * address src  : %.8x (%.8x)",_decod_instruction->_address     ,_decod_instruction->_address     <<2);
     158                    log_printf(TRACE,Decod,FUNCTION,"      * address dest : %.8x (%.8x)",_decod_instruction->_address_next,_decod_instruction->_address_next<<2);
    128159
    129160                    predict_val [i]     = ifetch_ack  [x][y] // and decod_val [i]
     
    136167                    PORT_WRITE(out_PREDICT_MATCH_INST_IFETCH_PTR       [i],y == ((_param->_have_port_inst_ifetch_ptr)?PORT_READ(in_IFETCH_INST_IFETCH_PTR [x]):0));
    137168                    PORT_WRITE(out_PREDICT_BRANCH_STATE                [i],PORT_READ(in_IFETCH_BRANCH_STATE                [x]));
    138                     if (_param->_have_port_branch_update_prediction_id)
    139                     PORT_WRITE(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID [i],PORT_READ(in_IFETCH_BRANCH_UPDATE_PREDICTION_ID [x]));
     169                    if (_param->_have_port_depth)
     170                    PORT_WRITE(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID [i],PORT_READ(in_IFETCH_BRANCH_UPDATE_PREDICTION_ID [x]));
    140171                    PORT_WRITE(out_PREDICT_BRANCH_CONDITION            [i],_decod_instruction->_branch_condition  );
    141172//                  PORT_WRITE(out_PREDICT_BRANCH_STACK_WRITE          [i],_decod_instruction->_branch_stack_write);
     
    145176               
    146177                    //can_continue_next [x] = PORT_READ(in_PREDICT_CAN_CONTINUE [i]); // can continue is set if direction is "not take" (also, continue is sequential order)
    147                     can_continue_next [x] = false; // one branch per context
     178                    can_continue_next [x] = false; // one branch per context, the DS don't execute
    148179                  }
    149180
     
    160191                    if (_param->_have_port_context_id)
    161192                    PORT_WRITE(out_CONTEXT_EVENT_CONTEXT_ID   , x);
     193                    if (_param->_have_port_depth)
     194                    PORT_WRITE(out_CONTEXT_EVENT_DEPTH        , depth);
    162195                    PORT_WRITE(out_CONTEXT_EVENT_TYPE         , _decod_instruction->_event_type    );
    163196                    PORT_WRITE(out_CONTEXT_EVENT_IS_DELAY_SLOT, _decod_instruction->_is_delay_slot );
     
    184217              }
    185218
    186             log_printf(TRACE,Decod,FUNCTION,"  - num_(decod, context, fetch) : %d %d %d",i, x, y);
    187             log_printf(TRACE,Decod,FUNCTION,"    - ifetch_ack        : %d",ifetch_ack  [x][y]);
    188             log_printf(TRACE,Decod,FUNCTION,"    - context_event_val : %d",context_event_val );
    189             log_printf(TRACE,Decod,FUNCTION,"    - predict_val       : %d",predict_val [i]   );
    190             log_printf(TRACE,Decod,FUNCTION,"    - decod_val         : %d",decod_val   [i]   );
     219            log_printf(TRACE,Decod,FUNCTION,"    - num_(decod, context, fetch) : %d %d %d",i, x, y);
     220            log_printf(TRACE,Decod,FUNCTION,"      - ifetch_ack        : %d",ifetch_ack  [x][y]);
     221            log_printf(TRACE,Decod,FUNCTION,"      - context_event_val : %d",context_event_val );
     222            log_printf(TRACE,Decod,FUNCTION,"      - predict_val       : %d",predict_val [i]   );
     223            log_printf(TRACE,Decod,FUNCTION,"      - decod_val         : %d",decod_val   [i]   );
    191224           
    192225            it ++;
     
    207240        PORT_WRITE(out_PREDICT_VAL [i], predict_val [i]);
    208241        PORT_WRITE(out_DECOD_VAL   [i], decod_val   [i]);
    209       }
    210 
    211     log_printf(FUNC,Decod,FUNCTION,"End");
     242       
     243#ifdef STATISTICS
     244        internal_DECOD_VAL [i] = decod_val [i];
     245#endif
     246      }
     247
     248    log_end(Decod,FUNCTION);
    212249  };
    213250
Note: See TracChangeset for help on using the changeset viewer.