Fixed the SW instruction (how did this no cause problems before...).

This commit is contained in:
Marco Satti 2018-02-04 14:28:00 +08:00
parent 2079bb7072
commit 4cf733d169
6 changed files with 48 additions and 34 deletions

View file

@ -926,30 +926,32 @@ MipsInstructionInfo lookup(const MipsInstruction & inst)
return &INSTRUCTION_TABLE[372];
case 41:
return &INSTRUCTION_TABLE[373];
case 43:
case 42:
return &INSTRUCTION_TABLE[374];
case 44:
case 43:
return &INSTRUCTION_TABLE[375];
case 45:
case 44:
return &INSTRUCTION_TABLE[376];
case 46:
case 45:
return &INSTRUCTION_TABLE[377];
case 47:
case 46:
return &INSTRUCTION_TABLE[378];
case 49:
case 47:
return &INSTRUCTION_TABLE[379];
case 51:
case 49:
return &INSTRUCTION_TABLE[380];
case 54:
case 51:
return &INSTRUCTION_TABLE[381];
case 55:
case 54:
return &INSTRUCTION_TABLE[382];
case 57:
case 55:
return &INSTRUCTION_TABLE[383];
case 62:
case 57:
return &INSTRUCTION_TABLE[384];
case 63:
case 62:
return &INSTRUCTION_TABLE[385];
case 63:
return &INSTRUCTION_TABLE[386];
default:
throw std::runtime_error("Could not determine instruction");
}

View file

@ -1,4 +1,4 @@
MipsInstructionInfo INSTRUCTION_TABLE[386] =
MipsInstructionInfo INSTRUCTION_TABLE[387] =
{
{ "SLL", 48, CPI_R5900_DEFAULT },
{ "SRL", 49, CPI_R5900_DEFAULT },
@ -374,7 +374,8 @@ MipsInstructionInfo INSTRUCTION_TABLE[386] =
{ "LWU", 32, CPI_R5900_LOAD },
{ "SB", 33, CPI_R5900_STORE },
{ "SH", 34, CPI_R5900_STORE },
{ "SWL", 36, CPI_R5900_STORE },
{ "SWL", 35, CPI_R5900_STORE },
{ "SW", 36, CPI_R5900_STORE },
{ "SDL", 37, CPI_R5900_STORE },
{ "SDR", 38, CPI_R5900_STORE },
{ "SWR", 39, CPI_R5900_STORE },

View file

@ -2755,6 +2755,13 @@
"SWL": {
"type": "instruction",
"name": "SWL",
"class_index": 42,
"impl_index": 35,
"cpi": "CPI_R5900_STORE"
},
"SW": {
"type": "instruction",
"name": "SW",
"class_index": 43,
"impl_index": 36,
"cpi": "CPI_R5900_STORE"

View file

@ -64,17 +64,19 @@ def build_instruction_tree(inst_entry):
'cpi': entry['CPI'],
}
if inst_entry['Class'] == 'OPCODE':
base_class_name = inst_entry['Class']
inst_name = inst_entry['Instruction']
if dict_deep_find(inst_name, lookup_tree):
raise ValueError(f'Instruction {inst_name} already exists.')
if base_class_name == 'OPCODE':
insert_entry(lookup_tree, inst_entry)
else:
# Find the base class by searching the tree.
base_class_name = inst_entry['Class']
inst_name = inst_entry['Instruction']
base_class = dict_deep_find(base_class_name, lookup_tree)
if not base_class:
raise ValueError(f'Base class {base_class_name} not found.')
if dict_deep_find(inst_name, lookup_tree):
raise ValueError(f'Instruction {inst_name} already exists.')
insert_entry(base_class, inst_entry)

View file

@ -1,6 +1,6 @@
#include "Resources/Ee/Core/EeCoreInstruction.hpp"
MipsInstructionInfo EE_CORE_INSTRUCTION_TABLE[386] =
MipsInstructionInfo EE_CORE_INSTRUCTION_TABLE[387] =
{
{ "SLL", 48, EeCoreInstruction::CPI_R5900_DEFAULT },
{ "SRL", 49, EeCoreInstruction::CPI_R5900_DEFAULT },
@ -376,7 +376,8 @@ MipsInstructionInfo EE_CORE_INSTRUCTION_TABLE[386] =
{ "LWU", 32, EeCoreInstruction::CPI_R5900_LOAD },
{ "SB", 33, EeCoreInstruction::CPI_R5900_STORE },
{ "SH", 34, EeCoreInstruction::CPI_R5900_STORE },
{ "SWL", 36, EeCoreInstruction::CPI_R5900_STORE },
{ "SWL", 35, EeCoreInstruction::CPI_R5900_STORE },
{ "SW", 36, EeCoreInstruction::CPI_R5900_STORE },
{ "SDL", 37, EeCoreInstruction::CPI_R5900_STORE },
{ "SDR", 38, EeCoreInstruction::CPI_R5900_STORE },
{ "SWR", 39, EeCoreInstruction::CPI_R5900_STORE },
@ -390,7 +391,6 @@ MipsInstructionInfo EE_CORE_INSTRUCTION_TABLE[386] =
{ "SD", 47, EeCoreInstruction::CPI_R5900_STORE }
};
EeCoreInstruction::EeCoreInstruction(const uword value) :
MipsInstruction(value),
info(nullptr)
@ -1332,30 +1332,32 @@ MipsInstructionInfo * EeCoreInstruction::lookup() const
return &EE_CORE_INSTRUCTION_TABLE[372];
case 41:
return &EE_CORE_INSTRUCTION_TABLE[373];
case 43:
case 42:
return &EE_CORE_INSTRUCTION_TABLE[374];
case 44:
case 43:
return &EE_CORE_INSTRUCTION_TABLE[375];
case 45:
case 44:
return &EE_CORE_INSTRUCTION_TABLE[376];
case 46:
case 45:
return &EE_CORE_INSTRUCTION_TABLE[377];
case 47:
case 46:
return &EE_CORE_INSTRUCTION_TABLE[378];
case 49:
case 47:
return &EE_CORE_INSTRUCTION_TABLE[379];
case 51:
case 49:
return &EE_CORE_INSTRUCTION_TABLE[380];
case 54:
case 51:
return &EE_CORE_INSTRUCTION_TABLE[381];
case 55:
case 54:
return &EE_CORE_INSTRUCTION_TABLE[382];
case 57:
case 55:
return &EE_CORE_INSTRUCTION_TABLE[383];
case 62:
case 57:
return &EE_CORE_INSTRUCTION_TABLE[384];
case 63:
case 62:
return &EE_CORE_INSTRUCTION_TABLE[385];
case 63:
return &EE_CORE_INSTRUCTION_TABLE[386];
default:
throw std::runtime_error("Could not determine instruction");
}