Ignore:
Timestamp:
May 14, 2008, 7:08:56 PM (16 years ago)
Author:
rosiere
Message:

Decod :

  • Correct selftest
  • Set Instruction address on (32/64)-2 bits,
  • Decod Custom Instruction : valid and tested. (add an test to verify the decod information)
File:
1 edited

Legend:

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

    r81 r86  
    1313
    1414#include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/Instruction/include/Instruction.h"
     15#include "Behavioural/include/Constants.h"
    1516
    1617namespace morpheo {
     
    130131
    131132    inst->_event_type         = EVENT_TYPE_EXCEPTION;
     133  }
     134
     135  void instruction_l_custom            (decod_instruction_t * inst, decod_param_t * param)
     136  {
     137    log_printf(TRACE,Decod,"instruction_l_custom","  * instruction   : custom");
     138
     139    uint32_t opcod = range<uint32_t>(inst->_instruction,31,26);
     140
     141    inst->_type = TYPE_CUSTOM;
     142    switch (opcod)
     143      {
     144      case OPCOD_L_CUST1 : {inst->_operation = OPERATION_CUSTOM_L_1; break;}
     145      case OPCOD_L_CUST2 : {inst->_operation = OPERATION_CUSTOM_L_2; break;}
     146      case OPCOD_L_CUST3 : {inst->_operation = OPERATION_CUSTOM_L_3; break;}
     147      case OPCOD_L_CUST4 : {inst->_operation = OPERATION_CUSTOM_L_4; break;}
     148      case OPCOD_L_CUST5 : {inst->_operation = OPERATION_CUSTOM_L_5; break;}
     149      case OPCOD_L_CUST6 : {inst->_operation = OPERATION_CUSTOM_L_6; break;}
     150      case OPCOD_L_CUST7 : {inst->_operation = OPERATION_CUSTOM_L_7; break;}
     151      case OPCOD_L_CUST8 : {inst->_operation = OPERATION_CUSTOM_L_8; break;}
     152      default            : {throw ERRORMORPHEO("instruction_l_custom",_("Invalid Custom Opcod."));}
     153      }
     154   
     155    (* param->_function_custom[ 0][opcod]) (inst,param);
     156
     157    instruction_custom(inst,param);
     158  }
     159
     160  void instruction_lf_custom           (decod_instruction_t * inst, decod_param_t * param)
     161  {
     162    log_printf(TRACE,Decod,"instruction_lf_custom","  * instruction   : custom");
     163
     164    uint32_t opcod = range<uint32_t>(inst->_instruction, 7, 0);
     165
     166    inst->_type = TYPE_CUSTOM;
     167    switch (opcod)
     168      {
     169//       case OPCOD_LF_CUST1_D : {inst->_operation = OPERATION_CUSTOM_LF_1_D; break;}
     170//       case OPCOD_LF_CUST1_S : {inst->_operation = OPERATION_CUSTOM_LF_1_S; break;}
     171      default               : {throw ERRORMORPHEO("instruction_lf_custom",_("Invalid Custom Opcod."));}
     172      }
     173   
     174    (* param->_function_custom[ 1][opcod]) (inst,param);
     175
     176    instruction_custom(inst,param);
     177  }
     178
     179  void instruction_lv_custom           (decod_instruction_t * inst, decod_param_t * param)
     180  {
     181    log_printf(TRACE,Decod,"instruction_lv_custom","  * instruction   : custom");
     182
     183    uint32_t opcod = range<uint32_t>(inst->_instruction, 7, 0);
     184
     185    inst->_type = TYPE_CUSTOM;
     186    switch (opcod)
     187      {
     188//       case OPCOD_LV_CUST1 : {inst->_operation = OPERATION_CUSTOM_LV_1; break;}
     189//       case OPCOD_LV_CUST2 : {inst->_operation = OPERATION_CUSTOM_LV_2; break;}
     190//       case OPCOD_LV_CUST3 : {inst->_operation = OPERATION_CUSTOM_LV_3; break;}
     191//       case OPCOD_LV_CUST4 : {inst->_operation = OPERATION_CUSTOM_LV_4; break;}
     192      default             : {throw ERRORMORPHEO("instruction_lv_custom",_("Invalid Custom Opcod."));}
     193      }
     194   
     195    (* param->_function_custom[ 2][opcod]) (inst,param);
     196
     197    instruction_custom(inst,param);
     198  }
     199
     200  void instruction_custom              (decod_instruction_t * inst, decod_param_t * param)
     201  {
     202    // Test custom operation
     203   
     204    std::string msg = "";
     205
     206    if (inst->_exception_use !=  EXCEPTION_USE_ILLEGAL_INSTRUCTION)
     207      {
     208        if (inst->_type != TYPE_CUSTOM)
     209          msg += _("Invalid Type.\n");
     210       
     211        if ((inst->_operation != OPERATION_CUSTOM_L_1   ) and
     212            (inst->_operation != OPERATION_CUSTOM_L_2   ) and
     213            (inst->_operation != OPERATION_CUSTOM_L_3   ) and
     214            (inst->_operation != OPERATION_CUSTOM_L_4   ) and
     215            (inst->_operation != OPERATION_CUSTOM_L_5   ) and
     216            (inst->_operation != OPERATION_CUSTOM_L_6   ) and
     217            (inst->_operation != OPERATION_CUSTOM_L_7   ) and
     218            (inst->_operation != OPERATION_CUSTOM_L_8   ) and
     219            (inst->_operation != OPERATION_CUSTOM_LF_1_D) and
     220            (inst->_operation != OPERATION_CUSTOM_LF_1_S) and
     221            (inst->_operation != OPERATION_CUSTOM_LV_1  ) and
     222            (inst->_operation != OPERATION_CUSTOM_LV_2  ) and
     223            (inst->_operation != OPERATION_CUSTOM_LV_3  ) and
     224            (inst->_operation != OPERATION_CUSTOM_LV_4  ))
     225          msg += _("Invalid Operation.\n");
     226       
     227        if ((inst->_exception_use !=  EXCEPTION_USE_NONE               ) and
     228            (inst->_exception_use !=  EXCEPTION_USE_RANGE              ) and
     229            (inst->_exception_use !=  EXCEPTION_USE_CUSTOM_0           ) and
     230            (inst->_exception_use !=  EXCEPTION_USE_CUSTOM_1           ) and
     231            (inst->_exception_use !=  EXCEPTION_USE_CUSTOM_2           ) and
     232            (inst->_exception_use !=  EXCEPTION_USE_CUSTOM_3           ) and
     233            (inst->_exception_use !=  EXCEPTION_USE_CUSTOM_4           ) and
     234            (inst->_exception_use !=  EXCEPTION_USE_CUSTOM_5           ) and
     235            (inst->_exception_use !=  EXCEPTION_USE_CUSTOM_6           ))
     236          msg += _("Invalid Exception.\n");
     237
     238        if ((inst->_event_type != EVENT_TYPE_NONE      ) and
     239            (inst->_event_type != EVENT_TYPE_SPR_ACCESS))
     240          msg += _("Invalid Event_type.\n");
     241
     242        if (inst->_address_next != (inst->_address+1))
     243          msg += _("Address must be in sequence.\n");
     244
     245        if (msg != "")
     246          throw ERRORMORPHEO("instruction_custom","Invalid decod : "+msg);
     247      }
    132248  }
    133249 
     
    706822    inst->_operation          = OPERATION_BRANCH_L_JALR;
    707823    inst->_has_immediat       = 1;
    708     inst->_immediat           = inst->_address_next+4;
     824    inst->_immediat           = inst->_address_next+1;
    709825    inst->_read_ra            = 0;
    710826//  inst->_num_reg_ra         = ;
Note: See TracChangeset for help on using the changeset viewer.