|
OpenASIP 2.2
|
#include <SimProgramBuilder.hh>

Public Member Functions | |
| SimProgramBuilder () | |
| virtual | ~SimProgramBuilder () |
| InstructionMemory * | build (const TTAProgram::Program &prog, MachineState &state) |
Private Member Functions | |
| SimProgramBuilder (const SimProgramBuilder &) | |
| Copying not allowed. | |
| SimProgramBuilder & | operator= (const SimProgramBuilder &) |
| Assignment not allowed. | |
| StateData * | processBidirTerminal (const TTAProgram::Terminal &theTerminal, MachineState &state) |
| const ReadableState & | findGuardModel (const TTAMachine::Guard &guard, MachineState &state) |
| StateData * | processSourceTerminal (const TTAProgram::Terminal &theTerminal, MachineState &state) |
| ExecutableInstruction * | processInstruction (const TTAProgram::Instruction &instruction, MachineState &state) |
| ExecutableMove * | processMove (const TTAProgram::Move &move, MachineState &state) |
Private Attributes | |
| bool | sequentialProgram_ |
Creates InstructionMemory out of Program Object Model.
Definition at line 62 of file SimProgramBuilder.hh.
| SimProgramBuilder::SimProgramBuilder | ( | ) |
|
virtual |
|
private |
Copying not allowed.
| InstructionMemory * SimProgramBuilder::build | ( | const TTAProgram::Program & | prog, |
| MachineState & | state | ||
| ) |
Builds the model of instruction memory ready to be simulated.
| prog | Program from which the contents of instruction memory is built. |
| state | The MachineState the program refers to. |
| IllegalProgram | If building fails for some reason. The exception message describes the reason. The message can be displayed in user interfaces as it's generated by SimulatorTextGenerator. |
Definition at line 472 of file SimProgramBuilder.cc.
References __func__, InstructionMemory::addExecutableInstruction(), InstructionMemory::addImplicitExecutableInstruction(), TTAProgram::Instruction::address(), POMDisassembler::disassemble(), Exception::errorMessage(), TTAProgram::CodeSnippet::instructionAtIndex(), TTAProgram::CodeSnippet::instructionCount(), TTAProgram::Address::location(), TTAProgram::Program::procedureAtIndex(), TTAProgram::Program::procedureCount(), processInstruction(), sequentialProgram_, TTAProgram::Instruction::size(), TTAProgram::Program::startAddress(), and TTAProgram::Program::targetProcessor().
Referenced by SimulationController::SimulationController().

|
private |
Helper method for finding the state object the given guard targets.
| guard | The guard object from machine object model. |
| state | The machine state model. |
| IllegalProgram | In case a state model for given guard cannot be found. |
Definition at line 231 of file SimProgramBuilder.cc.
References __func__, MachineState::guardState(), and NullGuardState::instance().
Referenced by processMove().

|
private |
Assignment not allowed.
|
private |
Helper method for processing such terminals that can be both source and destination in the move.
| theTerminal | The terminal to process. |
| state | MachineState to fetch the state objects from. |
| IllegalProgram | When the terminal is referring to illegal machine state or the terminal itself is illegal. |
Definition at line 111 of file SimProgramBuilder.cc.
References __func__, abortWithError, Exception::errorMessage(), TTAProgram::Terminal::index(), NullPortState::instance(), NullRegisterFileState::instance(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isGPR(), TTAProgram::Terminal::isOpcodeSetting(), TTAMachine::BaseFUPort::isOpcodeSetting(), TTAMachine::Component::name(), TTAMachine::Port::name(), Operation::name(), TTAProgram::Terminal::operation(), TTAMachine::Port::parentUnit(), TTAProgram::Terminal::port(), MachineState::portState(), TTAProgram::Terminal::registerFile(), MachineState::registerFileState(), RegisterFileState::registerState(), StringTools::stringToLower(), Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), Texts::TXT_ILLEGAL_PROGRAM_OPCODE_NOT_FOUND, Texts::TXT_ILLEGAL_PROGRAM_PORT_STATE_NOT_FOUND, Texts::TXT_ILLEGAL_PROGRAM_RF_STATE_NOT_FOUND, and Texts::TXT_ILLEGAL_PROGRAM_UNKNOWN_MOVE_TERMINAL_TYPE.
Referenced by processMove(), and processSourceTerminal().

|
private |
Processes a POM Instruction and produces an ExecutableInstruction.
| instruction | The instruction to process. |
| state | The MachineState the program refers to. |
| IllegalProgram | If the input instruction was illegal. |
Definition at line 402 of file SimProgramBuilder.cc.
References __func__, ExecutableInstruction::addExecutableMove(), ExecutableInstruction::addLongImmediateUpdateAction(), assert, TTAProgram::Immediate::destination(), POMDisassembler::disassemble(), Exception::errorMessage(), Exception::fileName(), TTAProgram::Instruction::immediate(), TTAProgram::Instruction::immediateCount(), LongImmediateUnitState::immediateRegister(), TTAProgram::Terminal::immediateUnit(), TTAProgram::Terminal::index(), NullLongImmediateUnitState::instance(), TTAProgram::Terminal::isImmediateRegister(), Exception::lineNum(), MachineState::longImmediateUnitState(), TTAProgram::Instruction::move(), TTAProgram::Instruction::moveCount(), TTAMachine::Component::name(), Exception::procedureName(), processMove(), SimulatorToolbox::textGenerator(), Texts::TXT_ILLEGAL_PROGRAM_IU_STATE_NOT_FOUND, TTAProgram::Immediate::value(), and TTAProgram::TerminalImmediate::value().
Referenced by build().

|
private |
Processes a POM Move and produces an ExecutableMove.
| move | The move to process. |
| state | The MachineState the program refers to. |
| IllegalProgram | If the input move was illegal. |
Definition at line 257 of file SimProgramBuilder.cc.
References __func__, assert, TTAProgram::Move::bus(), MachineState::busState(), TTAProgram::Move::destination(), findGuardModel(), TTAProgram::Terminal::functionUnit(), GCU_OPERATION_MOVES_VISIBLE_IN_BUS, TTAProgram::Move::guard(), TTAProgram::MoveGuard::guard(), TTAMachine::Bus::immediateWidth(), NullBusState::instance(), TTAProgram::Move::isControlFlowMove(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isImmediate(), TTAMachine::Guard::isInverted(), TTAProgram::Move::isUnconditional(), TTAMachine::Component::name(), TTAProgram::Terminal::port(), processBidirTerminal(), processSourceTerminal(), MathTools::requiredBits(), MathTools::requiredBitsSigned(), sequentialProgram_, RegisterState::setValue(), TTAMachine::Bus::signExtends(), SimValue::signExtendTo(), SimValue::sLongWordValue(), TTAProgram::Move::source(), SimulatorToolbox::textGenerator(), TTAProgram::Move::toString(), Texts::TXT_ILLEGAL_PROGRAM_BUS_STATE_NOT_FOUND, SimValue::uLongWordValue(), TTAProgram::Terminal::value(), TTAMachine::Bus::width(), TTAMachine::Port::width(), and SimValue::zeroExtendTo().
Referenced by processInstruction().

|
private |
Helper method for processing source terminals.
| theTerminal | The terminal to process. |
| state | MachineState to fetch the state objects from. |
| IllegalProgram | When the terminal is referring to illegal machine state or the terminal itself is illegal. |
Definition at line 194 of file SimProgramBuilder.cc.
References __func__, LongImmediateUnitState::immediateRegister(), TTAProgram::Terminal::immediateUnit(), TTAProgram::Terminal::index(), NullLongImmediateUnitState::instance(), TTAProgram::Terminal::isImmediateRegister(), MachineState::longImmediateUnitState(), TTAMachine::Component::name(), processBidirTerminal(), SimulatorToolbox::textGenerator(), Texts::TXT_ILLEGAL_PROGRAM_IU_STATE_NOT_FOUND, and Texts::TXT_ILLEGAL_PROGRAM_UNKNOWN_MOVE_TERMINAL_TYPE.
Referenced by processMove().

|
private |
Definition at line 92 of file SimProgramBuilder.hh.
Referenced by build(), and processMove().