Go to the documentation of this file.
85 throwWhenConflict_(true),
86 detailedSimulationModel_(detailedSimulationModel) {
132 bool throwWhenConflict) {
175 int controlUnitGuardLatency = 0;
179 int WordWidthInMAUs = 1;
187 for (
int i = 0; i < controlUnit->
portCount(); i++) {
195 machineState, port, gcu, controlUnit, locator,
198 addPortToFU(machineState, port, gcu, controlUnit, locator);
210 string msg =
"Problems while building machine state: " +
211 results.
error(0).second;
215 for (
int i = 0; i < FUs.
count(); i++) {
223 string msg =
"Problems building machine state: " +
232 for (
int k = 0; k < unit->
portCount(); k++) {
234 addPortToFU(machineState, port, state, unit, locator);
242 for (
int i = 0; i < immediateUnits.
count(); i++) {
245 immediateUnits.
item(i)->numberOfRegisters(),
246 immediateUnits.
item(i)->latency(),
247 immediateUnits.
item(i)->name(),
248 immediateUnits.
item(i)->width(),
249 immediateUnits.
item(i)->extensionMode() ==
253 state, immediateUnits.
item(i)->name());
257 for (
int i = 0; i < registers.
count(); i++) {
267 for (
int b = 0; b < busses.
count(); ++b) {
284 int guardLatency = controlUnitGuardLatency;
286 if (portGuard != NULL) {
304 targetRegister = &port;
308 if (guardLatency == 0) {
314 }
else if (registerGuard != NULL) {
335 if (guardLatency == 1) {
341 }
else if (uncondGuard != NULL) {
350 new GuardState(*targetRegister, guardLatency);
372 for (
int i = 0; i < unit.
portCount(); i++) {
383 if (triggerPort == NULL) {
386 std::string(
"The opcode setting port ") + port.
name() +
387 " is not triggering.");
404 if (operation->
isNull()) {
408 "Operation '%s' not found in OSAL.") %
421 std::string(
"Operation ") + hwOp.
name() +
" in " +
422 unit.
name() +
" has latency of 0, which is not " +
423 "supported by TCE.");
426 bool conflictDetection =
false;
428 FUConflictDetectorIndex::iterator detectorI =
432 conflictDetection =
true;
435 *(*detectorI).second;
445 if (!conflictDetection) {
446 bool multiLatencyOp =
false;
447 const int totalLatency = hwOp.
latency();
449 i <= operation->numberOfInputs() +
451 if (hwOp.
latency(i) < totalLatency) {
452 multiLatencyOp =
true;
460 }
else if (totalLatency == 1) {
465 totalLatency, state);
471 *executor, hwOp, machineState, state, unit);
488 *operation, *finalExecutor, state, *triggerPort);
518 bool inputPort =
false;
535 bool operationBindingFound =
false;
538 for (
int i = 0; fuPort != NULL && !operationBindingFound &&
541 if (!operation.
isBound(*fuPort))
550 for (
int cycle = 0; cycle < pipe->
latency(); ++cycle) {
553 operationBindingFound =
true;
557 operationBindingFound =
true;
566 if (!operationBindingFound) {
568 <<
"warning: Cannot determine the direction of port "
570 <<
", omitting it from the simulation model."
580 if (sharesRegister) {
591 locator.
addState(*port, *triggerPort);
596 if (sharesRegister) {
608 if (sharesRegister) {
622 if (sharesRegister) {
681 for (
int j = 1; j <= operandCount; j++) {
693 string msg =
"Problems while building machine state: " +
virtual ~MachineStateBuilder()
Operation & operation(const char *name)
virtual Socket * inputSocket() const
virtual TCEString name() const
void addOperationExecutor(OperationExecutor *executor)
void addBinding(int io, PortState &port)
TTAMachine::Machine * machine
the architecture definition of the estimated processor
int registerIndex() const
FunctionUnit * parentUnit() const
PortState & portState(const std::string &portName, const std::string &fuName)
void addVirtualOpcodeSettingPortsToFU(MachineState &machineState, FUState &state, TTAMachine::FunctionUnit &unit)
std::map< std::string, FUResourceConflictDetector * > FUConflictDetectorIndex
virtual void addOperationExecutor(OperationExecutor &opExec, Operation &op)
static SimValue & instance()
void bindPortsToOperands(OperationExecutor &executor, TTAMachine::HWOperation &hwOperation, MachineState &machineState, FUState &state, TTAMachine::FunctionUnit &unit)
virtual int numberOfInputs() const
virtual void addInputPortState(PortState &port)
static NullPortState & instance()
virtual BaseFUPort * port(const std::string &name) const
virtual AddressSpace * addressSpace() const
virtual boost::format text(int textId)
static NullOperation & instance()
MachineStateBuilder(bool detailedSimulationModel=false)
virtual TCEString name() const
virtual bool isOpcodeSetting() const =0
virtual int numberOfRegisters() const
boost::shared_ptr< Memory > MemoryPtr
#define assert(condition)
virtual FUPort * port(int operand) const
void addPortState(PortState *state, const std::string &name, const std::string &fuName)
virtual ControlUnit * controlUnit() const
#define abortWithError(message)
SimValue & returnAddressRegister()
const std::string & name() const
virtual ImmediateUnitNavigator immediateUnitNavigator() const
bool throwWhenConflict_
True in case the built model should throw an exception in case of a resource conflict.
@ TXT_ILLEGAL_PROGRAM_PORT_STATE_NOT_FOUND
Text of the exception thrown when FUPortState could not be found and there is instruction referring t...
bool isPortWritten(const FUPort &port, int cycle) const
bool isBound(const FUPort &port) const
virtual FunctionUnitNavigator functionUnitNavigator() const
MachineState * buildMachineState(const TTAMachine::Machine &machine, MemorySystem &memSys, StateLocator &locator)
virtual int operationCount() const
void addGCUState(GCUState *state)
virtual bool check(const TTAMachine::Machine &mach, MachineCheckResults &results) const
static NullRegisterFileState & instance()
void addLongImmediateUnitState(LongImmediateUnitState *state, const std::string &name)
void addGuardState(GuardState *state, const TTAMachine::Guard &guard)
virtual bool isTriggering() const =0
Guard * guard(int index) const
virtual int portCount() const
std::string errorMessage() const
void addRegisterFileState(RegisterFileState *state, const std::string &name)
bool isPortRead(const FUPort &port, int cycle) const
void addFUState(FUState *state, const std::string &name)
bool detailedSimulationModel_
Set to true in case should build a detailed model which simulates FU stages, possibly with an externa...
virtual RegisterFileNavigator registerFileNavigator() const
@ TXT_OPERATION_X_NOT_FOUND
virtual RegisterState & registerState(int index)
virtual OperationID operationID(const TCEString &operationName) const
void addState(const TTAMachine::MachinePart &momComponent, StateData &state)
virtual std::string name() const
MachineState * build(const TTAMachine::Machine &machine, MemorySystem &memSys)
virtual BusNavigator busNavigator() const
MemoryPtr memory(const TTAMachine::AddressSpace &as)
virtual Socket * outputSocket() const
bool needsConflictDetection() const
virtual void addOutputPortState(PortState &port)
ExecutionPipeline * pipeline() const
static std::ostream & warningStream()
ComponentType * item(int index) const
virtual HWOperation * operation(const std::string &name) const
void addBusState(BusState *state, const std::string &name)
virtual int guardLatency() const
FUConflictDetectorIndex * detectors_
The FU resource conflict detectors. They are needed while building the machine state model.
virtual OperationExecutor * executor(Operation &op)
int globalGuardLatency() const
SpecialRegisterPort * returnAddressPort() const
virtual int width() const
const RegisterFile * registerFile() const
virtual int numberOfOutputs() const
void addPortToFU(MachineState *machineState, TTAMachine::BaseFUPort *port, FUState *state, TTAMachine::FunctionUnit *fu, StateLocator &locator)
bool hasReturnAddressPort() const
@ TXT_ILLEGAL_PROGRAM_RF_STATE_NOT_FOUND
Text of the exception thrown when RegisterFileState could not be found and there is instruction refer...
virtual int width() const
virtual bool zeroRegister() const
Error error(int index) const
RegisterFileState & registerFileState(const std::string &name)