OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SimProgramBuilder Class Reference

#include <SimProgramBuilder.hh>

Collaboration diagram for SimProgramBuilder:
Collaboration graph

Public Member Functions

 SimProgramBuilder ()
 
virtual ~SimProgramBuilder ()
 
InstructionMemorybuild (const TTAProgram::Program &prog, MachineState &state)
 

Private Member Functions

 SimProgramBuilder (const SimProgramBuilder &)
 Copying not allowed. More...
 
SimProgramBuilderoperator= (const SimProgramBuilder &)
 Assignment not allowed. More...
 
StateDataprocessBidirTerminal (const TTAProgram::Terminal &theTerminal, MachineState &state)
 
const ReadableStatefindGuardModel (const TTAMachine::Guard &guard, MachineState &state)
 
StateDataprocessSourceTerminal (const TTAProgram::Terminal &theTerminal, MachineState &state)
 
ExecutableInstructionprocessInstruction (const TTAProgram::Instruction &instruction, MachineState &state)
 
ExecutableMoveprocessMove (const TTAProgram::Move &move, MachineState &state)
 

Private Attributes

bool sequentialProgram_
 

Detailed Description

Creates InstructionMemory out of Program Object Model.

Definition at line 62 of file SimProgramBuilder.hh.

Constructor & Destructor Documentation

◆ SimProgramBuilder() [1/2]

SimProgramBuilder::SimProgramBuilder ( )

Constructor.

Definition at line 90 of file SimProgramBuilder.cc.

90  :
91  sequentialProgram_(false) {
92 }

◆ ~SimProgramBuilder()

SimProgramBuilder::~SimProgramBuilder ( )
virtual

Destructor.

Definition at line 97 of file SimProgramBuilder.cc.

97  {
98 }

◆ SimProgramBuilder() [2/2]

SimProgramBuilder::SimProgramBuilder ( const SimProgramBuilder )
private

Copying not allowed.

Member Function Documentation

◆ build()

InstructionMemory * SimProgramBuilder::build ( const TTAProgram::Program prog,
MachineState state 
)

Builds the model of instruction memory ready to be simulated.

Parameters
progProgram from which the contents of instruction memory is built.
stateThe MachineState the program refers to.
Returns
The created instruction memory, owned by client.
Exceptions
IllegalProgramIf 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.

472  {
474  (dynamic_cast<const UniversalMachine*>(
475  &prog.targetProcessor()) != NULL);
476  const Address& programStartAddress = prog.startAddress();
477 
478  InstructionMemory* memory =
479  new InstructionMemory(programStartAddress.location());
480 
481  const TTAProgram::Instruction* currentInstruction = NULL;
482  try {
483 
484  for (int procIndex = 0; procIndex < prog.procedureCount();
485  ++procIndex) {
486  const Procedure& proc = prog.procedureAtIndex(procIndex);
487  for (int instrIndex = 0; instrIndex < proc.instructionCount();
488  ++instrIndex) {
489  currentInstruction =
490  &proc.instructionAtIndex(instrIndex);
491  ExecutableInstruction* processedInstruction =
492  processInstruction(*currentInstruction, state);
493 
494  if (currentInstruction->size() > 0) {
495  memory->addExecutableInstruction(
496  currentInstruction->address().location(),
497  processedInstruction);
498  } else {
500  currentInstruction->address().location(),
501  processedInstruction);
502  }
503  }
504  }
505  } catch (const Exception& e) {
506  throw IllegalProgram(
507  __FILE__, __LINE__, __func__,
508  (boost::format("Error while processing instruction %d "
509  "(with moves %s): %s")
510  % currentInstruction->address().location()
511  % POMDisassembler::disassemble(*currentInstruction)
512  % e.errorMessage()).str());
513  }
514 
515  return memory;
516 }

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().

Here is the call graph for this function:

◆ findGuardModel()

const ReadableState & SimProgramBuilder::findGuardModel ( const TTAMachine::Guard guard,
MachineState state 
)
private

Helper method for finding the state object the given guard targets.

Parameters
guardThe guard object from machine object model.
stateThe machine state model.
Returns
The state object represeting the current value of the guard.
Exceptions
IllegalProgramIn case a state model for given guard cannot be found.

Definition at line 231 of file SimProgramBuilder.cc.

232  {
233  try {
234  GuardState& guardModel = state.guardState(guard);
235  if (&guardModel != &NullGuardState::instance())
236  return guardModel;
237  } catch (const Exception& e) {
238  }
239 
240  throw IllegalProgram(
241  __FILE__, __LINE__, __func__,
242  "Program references an illegal guard.");
243 
244  // should never return from here
245  return NullGuardState::instance();
246 }

References __func__, MachineState::guardState(), and NullGuardState::instance().

Referenced by processMove().

Here is the call graph for this function:

◆ operator=()

SimProgramBuilder& SimProgramBuilder::operator= ( const SimProgramBuilder )
private

Assignment not allowed.

◆ processBidirTerminal()

StateData * SimProgramBuilder::processBidirTerminal ( const TTAProgram::Terminal theTerminal,
MachineState state 
)
private

Helper method for processing such terminals that can be both source and destination in the move.

Parameters
theTerminalThe terminal to process.
stateMachineState to fetch the state objects from.
Returns
The StateData object created from the terminal.
Exceptions
IllegalProgramWhen the terminal is referring to illegal machine state or the terminal itself is illegal.

Definition at line 111 of file SimProgramBuilder.cc.

112  {
113  try {
114  if (theTerminal.isGPR()) {
115 
116  RegisterFileState& unit = state.registerFileState(
117  theTerminal.registerFile().name());
118  if (&unit == &NullRegisterFileState::instance()) {
119  throw IllegalProgram(
120  __FILE__, __LINE__, __func__,
123  }
124  return &unit.registerState(theTerminal.index());
125 
126  } else if (theTerminal.isFUPort()) {
127 
128  const BaseFUPort* thePort =
129  dynamic_cast<const BaseFUPort*>(&theTerminal.port());
130 
131  if (thePort == NULL)
132  throw IllegalProgram(
133  __FILE__, __LINE__, __func__,
134  "Could not find the FU port.");
135 
136  std::string operationString = "";
137  // if this is an opcode-setting port, find the
138  // OpcodeSettingVirtualInputPort instead of a real port
139 
140  if (thePort->isOpcodeSetting()) {
141 
142  if (!theTerminal.isOpcodeSetting()) {
143  throw IllegalProgram(
144  __FILE__, __LINE__, __func__,
147  str());
148  }
149  operationString =
151  std::string(".") + theTerminal.operation().name());
152  }
153 
154  PortState& port = state.portState(
155  thePort->name() + operationString,
156  theTerminal.port().parentUnit()->name());
157 
158  if (&port == &NullPortState::instance()) {
159  throw IllegalProgram(
160  __FILE__, __LINE__, __func__,
163  str());
164  }
165 
166  return &port;
167 
168  } else {
169  abortWithError("Illegal terminal!");
170  }
171  } catch (const OutOfRange& e) {
173  } catch (const WrongSubclass&) {
174  abortWithError("Wrong sub class!");
175  }
176 
177  std::string errorMsg =
180  throw IllegalProgram(__FILE__, __LINE__, __func__, errorMsg);
181  return NULL;
182 }

References __func__, abortWithError, Exception::errorMessage(), TTAProgram::Terminal::index(), NullPortState::instance(), NullRegisterFileState::instance(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isGPR(), TTAMachine::BaseFUPort::isOpcodeSetting(), TTAProgram::Terminal::isOpcodeSetting(), TTAMachine::Port::name(), TTAMachine::Component::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().

Here is the call graph for this function:

◆ processInstruction()

ExecutableInstruction * SimProgramBuilder::processInstruction ( const TTAProgram::Instruction instruction,
MachineState state 
)
private

Processes a POM Instruction and produces an ExecutableInstruction.

Parameters
instructionThe instruction to process.
stateThe MachineState the program refers to.
Returns
The processed instruction.
Exceptions
IllegalProgramIf the input instruction was illegal.

Definition at line 402 of file SimProgramBuilder.cc.

403  {
404  ExecutableInstruction* processedInstruction = new ExecutableInstruction();
405 
406  // process long immediates
407  for (int i = 0; i < instruction.immediateCount(); ++i) {
408  assert(instruction.immediate(i).destination().isImmediateRegister());
409 
410  // first fetch the LongImmediateUnitState, then fetch the
411  // LongImmediateRegisterState from it, because there is no such
412  // object in MOM as LongImmediateRegister, nor any single registers
413  LongImmediateRegisterState* destination = NULL;
414  try {
416  instruction.immediate(i).destination().immediateUnit().name());
417 
418  destination = &targetUnit.immediateRegister(
419  instruction.immediate(i).destination().index());
420 
421  if (&targetUnit == &NullLongImmediateUnitState::instance()) {
422  throw IllegalProgram(
423  __FILE__, __LINE__, __func__,
426  }
427  } catch (const IllegalParameters&) {
428  throw IllegalProgram(
429  __FILE__, __LINE__, __func__,
432  } catch (const OutOfRange&) {
433  throw IllegalProgram(
434  __FILE__, __LINE__, __func__,
437  }
438 
439  processedInstruction->addLongImmediateUpdateAction(
440  new LongImmUpdateAction(instruction.immediate(i).value().value(),
441  *destination));
442  }
443 
444  // process all the moves in the instruction
445  for (int j = 0; j < instruction.moveCount(); ++j) {
446  try {
447  processedInstruction->addExecutableMove(
448  processMove(instruction.move(j), state));
449  } catch (const IllegalProgram& e) {
450  IllegalProgram ip(
451  e.fileName(), e.lineNum(), e.procedureName(),
452  e.errorMessage() + " Illegal move: " +
453  POMDisassembler::disassemble(instruction.move(j)));
454  throw ip;
455  }
456  }
457  return processedInstruction;
458 }

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::TerminalImmediate::value(), and TTAProgram::Immediate::value().

Referenced by build().

Here is the call graph for this function:

◆ processMove()

ExecutableMove * SimProgramBuilder::processMove ( const TTAProgram::Move move,
MachineState state 
)
private

Processes a POM Move and produces an ExecutableMove.

Parameters
moveThe move to process.
stateThe MachineState the program refers to.
Returns
The processed move.
Exceptions
IllegalProgramIf the input move was illegal.

Definition at line 257 of file SimProgramBuilder.cc.

257  {
258  ReadableState* source = NULL;
259  InlineImmediateValue* immediateSource = NULL;
260 
261  if (move.source().isImmediate()) {
262  // extend the immediate so we don't have to extend it
263  // during runtime every time the move is simulated
264  immediateSource = new InlineImmediateValue(move.bus().width());
265 
266  if (move.isControlFlowMove()) {
267  int targetWidth = move.destination().port().width();
268  if (!move.bus().signExtends()) {
269  ULongWord immediate =
270  move.source().value().uLongWordValue();
271  if (targetWidth < MathTools::requiredBits(immediate)) {
272  TCEString errorMsg =
273  (boost::format(
274  "Immediate of jump '%s' gets clipped due to the target "
275  "port being too narrow. Wrong execution would occur.")
276  % move.toString()).str();
277  throw IllegalProgram(
278  __FILE__, __LINE__, __func__, errorMsg);
279  }
280  } else {
281  SLongWord immediate =
282  move.source().value().sLongWordValue();
283  if (targetWidth < MathTools::requiredBitsSigned(immediate)) {
284  TCEString errorMsg =
285  (boost::format(
286  "Immediate of jump '%s' gets clipped due to the target "
287  "port being too narrow. Wrong execution would occur.")
288  % move.toString()).str();
289  throw IllegalProgram(
290  __FILE__, __LINE__, __func__, errorMsg);
291  }
292  }
293  }
294 
295  SimValue val(move.bus().width());
296  val = move.source().value();
297  if (move.bus().signExtends()) {
298  val.signExtendTo(move.bus().immediateWidth());
299  } else {
300  val.zeroExtendTo(move.bus().immediateWidth());
301  }
302  immediateSource->setValue(val);
303  } else {
304  source = processSourceTerminal(move.source(), state);
305  }
306 
307  BusState& bus = state.busState(move.bus().name());
308  if (&bus == &NullBusState::instance()) {
309  throw IllegalProgram(
310  __FILE__, __LINE__, __func__,
313  }
314 
315  WritableState& destination =
316  *processBidirTerminal(move.destination(), state);
317 
318  // in case this is a sequential move, or a move that executes a
319  // control flow operation with immediate or control unit port source (RA)
320  // it does not utilize any bus
321  bool buslessMove = sequentialProgram_;
323  if (move.destination().isFUPort()) {
324  if (dynamic_cast<const TTAMachine::ControlUnit*>(
325  &move.destination().functionUnit())) {
326  if (move.source().isImmediate() ||
327  (move.source().isFUPort() &&
328  dynamic_cast<const TTAMachine::ControlUnit*>(
329  &move.source().functionUnit()) != NULL)) {
330  buslessMove = true;
331  }
332  }
333  }
334  }
335 
336  // handle guards
337  if (move.isUnconditional()) {
338  // create a guardless execmove
339  if (move.source().isImmediate()) {
340  assert(immediateSource != NULL);
341  if (buslessMove) {
342  return new BuslessExecutableMove(immediateSource, destination);
343  } else {
344  return new ExecutableMove(immediateSource, bus, destination);
345  }
346  } else {
347  assert(source != NULL);
348  if (buslessMove) {
349  return new BuslessExecutableMove(*source, destination);
350  } else {
351  return new ExecutableMove(*source, bus, destination);
352  }
353  }
354  } else {
355  // create a guarded move
356  MoveGuard& guard = move.guard();
357 
358  if (move.source().isImmediate()) {
359  assert(immediateSource != NULL);
360  if (buslessMove) {
361  return new BuslessExecutableMove(
362  immediateSource, destination,
363  findGuardModel(guard.guard(), state),
364  guard.guard().isInverted());
365  } else {
366  return new ExecutableMove(
367  immediateSource, bus, destination,
368  findGuardModel(guard.guard(), state),
369  guard.guard().isInverted());
370  }
371  } else {
372  assert(source != NULL);
373  if (buslessMove) {
374  return new BuslessExecutableMove(
375  *source, destination,
376  findGuardModel(guard.guard(), state),
377  guard.guard().isInverted());
378  } else {
379  return new ExecutableMove(
380  *source, bus, destination,
381  findGuardModel(guard.guard(), state),
382  guard.guard().isInverted());
383  }
384  }
385  }
386 
387  // should never end up here
388  assert(false);
389 
390  return NULL;
391 }

References __func__, assert, TTAProgram::Move::bus(), MachineState::busState(), TTAProgram::Move::destination(), findGuardModel(), TTAProgram::Terminal::functionUnit(), GCU_OPERATION_MOVES_VISIBLE_IN_BUS, TTAProgram::MoveGuard::guard(), TTAProgram::Move::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::Port::width(), TTAMachine::Bus::width(), and SimValue::zeroExtendTo().

Referenced by processInstruction().

Here is the call graph for this function:

◆ processSourceTerminal()

StateData * SimProgramBuilder::processSourceTerminal ( const TTAProgram::Terminal theTerminal,
MachineState state 
)
private

Helper method for processing source terminals.

Parameters
theTerminalThe terminal to process.
stateMachineState to fetch the state objects from.
Returns
The StateData object created from the terminal.
Exceptions
IllegalProgramWhen the terminal is referring to illegal machine state or the terminal itself is illegal.

Definition at line 194 of file SimProgramBuilder.cc.

195  {
196  try {
197  if (theTerminal.isImmediateRegister()) {
198 
200  theTerminal.immediateUnit().name());
201  if (&unit == &NullLongImmediateUnitState::instance()) {
202  throw IllegalProgram(
203  __FILE__, __LINE__, __func__,
206  }
207  return &unit.immediateRegister(theTerminal.index());
208  } else {
209  return processBidirTerminal(theTerminal, state);
210  }
211  } catch (const OutOfRange&) {
212  } catch (const WrongSubclass&) {
213  }
214  throw IllegalProgram(
215  __FILE__, __LINE__, __func__,
218  return NULL;
219 }

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().

Here is the call graph for this function:

Member Data Documentation

◆ sequentialProgram_

bool SimProgramBuilder::sequentialProgram_
private

Definition at line 92 of file SimProgramBuilder.hh.

Referenced by build(), and processMove().


The documentation for this class was generated from the following files:
SimProgramBuilder::processSourceTerminal
StateData * processSourceTerminal(const TTAProgram::Terminal &theTerminal, MachineState &state)
Definition: SimProgramBuilder.cc:194
TTAMachine::Bus::immediateWidth
int immediateWidth() const
Definition: Bus.cc:160
TTAProgram::Terminal::isFUPort
virtual bool isFUPort() const
Definition: Terminal.cc:118
TTAProgram::Immediate::value
TerminalImmediate & value() const
Definition: Immediate.cc:103
Texts::TXT_ILLEGAL_PROGRAM_IU_STATE_NOT_FOUND
@ TXT_ILLEGAL_PROGRAM_IU_STATE_NOT_FOUND
Text of the exception thrown when Immediate Unit state could not be found and there is instruction re...
Definition: SimulatorTextGenerator.hh:112
ExecutableInstruction
Definition: ExecutableInstruction.hh:49
LongImmediateUnitState::immediateRegister
virtual LongImmediateRegisterState & immediateRegister(int i)
Definition: LongImmediateUnitState.cc:160
Exception::procedureName
std::string procedureName() const
MachineState::longImmediateUnitState
LongImmediateUnitState & longImmediateUnitState(const std::string &name)
Definition: MachineState.cc:196
Exception::lineNum
int lineNum() const
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
Texts::TXT_ILLEGAL_PROGRAM_UNKNOWN_MOVE_TERMINAL_TYPE
@ TXT_ILLEGAL_PROGRAM_UNKNOWN_MOVE_TERMINAL_TYPE
Text of the exception thrown when the terminal type of a move is not regocnized.
Definition: SimulatorTextGenerator.hh:115
TTAProgram::Instruction::move
Move & move(int i) const
Definition: Instruction.cc:193
InstructionMemory::addImplicitExecutableInstruction
void addImplicitExecutableInstruction(InstructionAddress addr, ExecutableInstruction *instruction)
Definition: InstructionMemory.cc:92
TTAProgram::Terminal::index
virtual int index() const
Definition: Terminal.cc:274
SimValue::sLongWordValue
SLongWord sLongWordValue() const
Definition: SimValue.cc:997
TTAProgram::Address
Definition: Address.hh:51
TTAProgram::Program::procedureCount
int procedureCount() const
Definition: Program.cc:610
NullLongImmediateUnitState::instance
static NullLongImmediateUnitState & instance()
Definition: LongImmediateUnitState.cc:191
TTAProgram::Program::startAddress
Address startAddress() const
Definition: Program.cc:286
TTAProgram::Terminal::registerFile
virtual const TTAMachine::RegisterFile & registerFile() const
Definition: Terminal.cc:225
TTAMachine::Bus::width
int width() const
Definition: Bus.cc:149
MachineState::portState
PortState & portState(const std::string &portName, const std::string &fuName)
Definition: MachineState.cc:175
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAProgram::Move::isUnconditional
bool isUnconditional() const
Definition: Move.cc:154
OutOfRange
Definition: Exception.hh:320
ReadableState
Definition: ReadableState.hh:41
TTAMachine::BaseFUPort
Definition: BaseFUPort.hh:44
TTAMachine::Port::width
virtual int width() const =0
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
LongImmUpdateAction
Definition: LongImmUpdateAction.hh:43
TTAProgram::Move::bus
const TTAMachine::Bus & bus() const
Definition: Move.cc:373
TTAProgram::Move::toString
std::string toString() const
Definition: Move.cc:436
WritableState
Definition: WritableState.hh:41
BusState
Definition: BusState.hh:48
NullPortState::instance
static NullPortState & instance()
Definition: PortState.cc:96
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
InstructionMemory
Definition: InstructionMemory.hh:54
Operation::name
virtual TCEString name() const
Definition: Operation.cc:93
TTAMachine::Bus::signExtends
bool signExtends() const
Definition: Bus.cc:171
TTAMachine::BaseFUPort::isOpcodeSetting
virtual bool isOpcodeSetting() const =0
SimValue
Definition: SimValue.hh:96
TTAProgram::Terminal::operation
virtual Operation & operation() const
Definition: Terminal.cc:319
TTAProgram::Program::procedureAtIndex
const Procedure & procedureAtIndex(int index) const
Definition: Program.cc:508
Exception::fileName
std::string fileName() const
TTAProgram::Immediate::destination
const Terminal & destination() const
Definition: Immediate.cc:92
assert
#define assert(condition)
Definition: Application.hh:86
TTAProgram::TerminalImmediate::value
virtual SimValue value() const
Definition: TerminalImmediate.cc:75
TTAProgram::Terminal::isImmediateRegister
virtual bool isImmediateRegister() const
Definition: Terminal.cc:97
LongImmediateRegisterState
Definition: LongImmediateRegisterState.hh:47
IllegalParameters
Definition: Exception.hh:113
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
TTAProgram::Move::isControlFlowMove
bool isControlFlowMove() const
Definition: Move.cc:233
MachineState::guardState
GuardState & guardState(const TTAMachine::Guard &guard)
Definition: MachineState.cc:230
NullGuardState::instance
static NullGuardState & instance()
Definition: GuardState.cc:118
TTAProgram::CodeSnippet::instructionCount
virtual int instructionCount() const
Definition: CodeSnippet.cc:205
GCU_OPERATION_MOVES_VISIBLE_IN_BUS
#define GCU_OPERATION_MOVES_VISIBLE_IN_BUS
Definition: SimProgramBuilder.cc:85
MachineState::busState
BusState & busState(const std::string &name)
Definition: MachineState.cc:116
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
UniversalMachine
Definition: UniversalMachine.hh:56
WrongSubclass
Definition: Exception.hh:336
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
Texts::TXT_ILLEGAL_PROGRAM_PORT_STATE_NOT_FOUND
@ TXT_ILLEGAL_PROGRAM_PORT_STATE_NOT_FOUND
Text of the exception thrown when FUPortState could not be found and there is instruction referring t...
Definition: SimulatorTextGenerator.hh:121
IllegalProgram
Definition: Exception.hh:895
__func__
#define __func__
Definition: Application.hh:67
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
BuslessExecutableMove
Definition: BuslessExecutableMove.hh:53
SimValue::uLongWordValue
ULongWord uLongWordValue() const
Definition: SimValue.cc:1027
TTAProgram::Terminal::isGPR
virtual bool isGPR() const
Definition: Terminal.cc:107
ExecutableMove
Definition: ExecutableMove.hh:52
TTAProgram::Terminal::value
virtual SimValue value() const
Definition: Terminal.cc:178
TTAProgram::Terminal::immediateUnit
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
Definition: Terminal.cc:240
ExecutableInstruction::addExecutableMove
void addExecutableMove(ExecutableMove *move)
Definition: ExecutableInstruction.cc:64
MathTools::requiredBits
static int requiredBits(unsigned long int number)
TTAProgram::Address::location
InstructionAddress location() const
NullRegisterFileState::instance
static NullRegisterFileState & instance()
Definition: RegisterFileState.cc:111
Exception
Definition: Exception.hh:54
PortState
Definition: PortState.hh:51
TTAProgram::Instruction::immediate
Immediate & immediate(int i) const
Definition: Instruction.cc:285
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
TTAProgram::Terminal::isOpcodeSetting
virtual bool isOpcodeSetting() const
Definition: Terminal.cc:285
InlineImmediateValue
RegisterState InlineImmediateValue
RegisterState can be used as a storage for inline immediates.
Definition: InlineImmediateValue.hh:39
TTAProgram::Terminal::functionUnit
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition: Terminal.cc:251
NullBusState::instance
static NullBusState & instance()
Definition: BusState.cc:112
SimProgramBuilder::processInstruction
ExecutableInstruction * processInstruction(const TTAProgram::Instruction &instruction, MachineState &state)
Definition: SimProgramBuilder.cc:402
Texts::TXT_ILLEGAL_PROGRAM_BUS_STATE_NOT_FOUND
@ TXT_ILLEGAL_PROGRAM_BUS_STATE_NOT_FOUND
Text of the exception thrown when FUPortState could not be found and there is instruction referring t...
Definition: SimulatorTextGenerator.hh:124
SimValue::signExtendTo
void signExtendTo(int bitWidth)
Definition: SimValue.cc:1531
POMDisassembler::disassemble
static std::string disassemble(const TTAProgram::Move &move)
Definition: POMDisassembler.cc:629
TTAMachine::Guard::isInverted
virtual bool isInverted() const
RegisterFileState::registerState
virtual RegisterState & registerState(int index)
Definition: RegisterFileState.cc:81
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
TCEString
Definition: TCEString.hh:53
TTAProgram::Instruction::size
short size() const
Definition: Instruction.cc:365
TTAProgram::Instruction::immediateCount
int immediateCount() const
Definition: Instruction.cc:267
RegisterFileState
Definition: RegisterFileState.hh:49
SimProgramBuilder::findGuardModel
const ReadableState & findGuardModel(const TTAMachine::Guard &guard, MachineState &state)
Definition: SimProgramBuilder.cc:231
TTAProgram::Program::targetProcessor
TTAMachine::Machine & targetProcessor() const
Definition: Program.cc:202
RegisterState
Definition: RegisterState.hh:50
ULongWord
unsigned long ULongWord
Definition: BaseType.hh:51
TTAProgram::CodeSnippet::instructionAtIndex
virtual Instruction & instructionAtIndex(int index) const
Definition: CodeSnippet.cc:285
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
GuardState
Definition: GuardState.hh:60
TTAProgram::Terminal::port
virtual const TTAMachine::Port & port() const
Definition: Terminal.cc:378
TTAProgram::MoveGuard::guard
const TTAMachine::Guard & guard() const
Definition: MoveGuard.cc:86
TTAProgram::Terminal::isImmediate
virtual bool isImmediate() const
Definition: Terminal.cc:63
TTAProgram::MoveGuard
Definition: MoveGuard.hh:47
Texts::TXT_ILLEGAL_PROGRAM_OPCODE_NOT_FOUND
@ TXT_ILLEGAL_PROGRAM_OPCODE_NOT_FOUND
Text of the exception thrown when a port to be written is an opcode setting port and no opcode is fou...
Definition: SimulatorTextGenerator.hh:127
TTAProgram::Procedure
Definition: Procedure.hh:55
SimProgramBuilder::processMove
ExecutableMove * processMove(const TTAProgram::Move &move, MachineState &state)
Definition: SimProgramBuilder.cc:257
SLongWord
long SLongWord
Definition: BaseType.hh:52
MathTools::requiredBitsSigned
static int requiredBitsSigned(SLongWord number)
ExecutableInstruction::addLongImmediateUpdateAction
void addLongImmediateUpdateAction(LongImmUpdateAction *action)
Definition: ExecutableInstruction.cc:74
SimProgramBuilder::processBidirTerminal
StateData * processBidirTerminal(const TTAProgram::Terminal &theTerminal, MachineState &state)
Definition: SimProgramBuilder.cc:111
InstructionMemory::addExecutableInstruction
void addExecutableInstruction(InstructionAddress addr, ExecutableInstruction *instruction)
Definition: InstructionMemory.cc:76
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
TTAProgram::Instruction::moveCount
int moveCount() const
Definition: Instruction.cc:176
Texts::TXT_ILLEGAL_PROGRAM_RF_STATE_NOT_FOUND
@ TXT_ILLEGAL_PROGRAM_RF_STATE_NOT_FOUND
Text of the exception thrown when RegisterFileState could not be found and there is instruction refer...
Definition: SimulatorTextGenerator.hh:118
LongImmediateUnitState
Definition: LongImmediateUnitState.hh:55
TTAProgram::Instruction::address
Address address() const
Definition: Instruction.cc:327
RegisterState::setValue
virtual void setValue(const SimValue &value)
Definition: RegisterState.cc:80
MachineState::registerFileState
RegisterFileState & registerFileState(const std::string &name)
Definition: MachineState.cc:213
SimProgramBuilder::sequentialProgram_
bool sequentialProgram_
Definition: SimProgramBuilder.hh:92
TTAMachine::Port::parentUnit
Unit * parentUnit() const