OpenASIP
2.0
|
#include <MachineValidator.hh>
Public Types | |
enum | ErrorCode { GCU_MISSING, GCU_AS_MISSING, USED_IO_NOT_BOUND, DIFFERENT_PORT_FOR_JUMP_AND_CALL, PC_PORT_MISSING, RA_PORT_MISSING, PC_AND_RA_PORTS_HAVE_UNEQUAL_WIDTH, IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC, FU_NO_VALID_OPERATIONS, FU_PORT_MISSING } |
Error codes for different errors. More... | |
Public Member Functions | |
MachineValidator (const TTAMachine::Machine &machine) | |
virtual | ~MachineValidator () |
MachineValidatorResults * | validate (const std::set< ErrorCode > &errorsToCheck) const |
Private Member Functions | |
void | checkGCUExists (MachineValidatorResults &results) const |
void | checkGCUHasAddressSpace (MachineValidatorResults &results) const |
void | checkOperandBindings (MachineValidatorResults &results) const |
void | checkJumpAndCallOperandBindings (MachineValidatorResults &results) const |
void | checkProgramCounterPort (MachineValidatorResults &results) const |
void | checkReturnAddressPort (MachineValidatorResults &results) const |
void | checkRAPortHasSameWidthAsPCPort (MachineValidatorResults &results) const |
void | checkIMemAddrWidth (MachineValidatorResults &results) const |
void | checkFUConnections (MachineValidatorResults &results) const |
Private Attributes | |
const TTAMachine::Machine & | machine_ |
The machine to validate. More... | |
Validator of target architecture definitions (machines). It tests a given machine against various criteria (completeness, implementation-dependent restrictions to structure, synthesisability).
Definition at line 52 of file MachineValidator.hh.
Error codes for different errors.
Definition at line 55 of file MachineValidator.hh.
MachineValidator::MachineValidator | ( | const TTAMachine::Machine & | machine | ) |
The constructor.
machine | The machine to validate. |
Definition at line 62 of file MachineValidator.cc.
|
virtual |
|
private |
Checks that the every FU has all the input and output ports that it needs.
results | Results of the validation are added to the given instance. |
Definition at line 362 of file MachineValidator.cc.
References MachineValidatorResults::addError(), TTAMachine::Machine::Navigator< ComponentType >::count(), FU_PORT_MISSING, TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), and TTAMachine::Port::socketCount().
Referenced by validate().
|
private |
Checks that the machine has a control unit.
results | Results of the validation are added to the given instance. |
Definition at line 120 of file MachineValidator.cc.
References MachineValidatorResults::addError(), TTAMachine::Machine::controlUnit(), GCU_MISSING, and machine_.
Referenced by validate().
|
private |
Checks that the GCU has an address space.
results | Results of the validation are added to the given instance. |
Definition at line 134 of file MachineValidator.cc.
References MachineValidatorResults::addError(), TTAMachine::FunctionUnit::addressSpace(), TTAMachine::Machine::controlUnit(), GCU_AS_MISSING, and machine_.
Referenced by validate().
|
private |
Checks that the address width of instruction memory is the same as PC and RA port width.
results | Results of the validation are added to the given instance. |
Definition at line 309 of file MachineValidator.cc.
References MachineValidatorResults::addError(), TTAMachine::FunctionUnit::addressSpace(), CALL, TTAMachine::Machine::controlUnit(), TTAMachine::AddressSpace::end(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::ControlUnit::hasReturnAddressPort(), IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC, JUMP, machine_, TTAMachine::FunctionUnit::operation(), TTAMachine::HWOperation::port(), MathTools::requiredBits(), TTAMachine::ControlUnit::returnAddressPort(), and TTAMachine::BaseFUPort::width().
Referenced by validate().
|
private |
Checks that the operands of JUMP and CALL operations are bound to the same port in GCU.
results | Results of the validation are added to the given instance. |
Definition at line 179 of file MachineValidator.cc.
References MachineValidatorResults::addError(), CALL, TTAMachine::Machine::controlUnit(), DIFFERENT_PORT_FOR_JUMP_AND_CALL, TTAMachine::FunctionUnit::hasOperation(), JUMP, machine_, TTAMachine::FunctionUnit::operation(), and TTAMachine::HWOperation::port().
Referenced by validate().
|
private |
Checks that all the used operands of operations are bound to some port in function units.
results | Results of the validation are added to the given instance. |
Definition at line 155 of file MachineValidator.cc.
References FUValidator::checkOperandBindings(), TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and machine_.
Referenced by validate().
|
private |
Checks that the GCU has a PC port if it has JUMP or CALL operation.
results | Results of the validation are added to the given instance. |
Definition at line 209 of file MachineValidator.cc.
References MachineValidatorResults::addError(), CALL, TTAMachine::Machine::controlUnit(), TTAMachine::FunctionUnit::hasOperation(), JUMP, machine_, TTAMachine::FunctionUnit::operation(), PC_PORT_MISSING, and TTAMachine::HWOperation::port().
Referenced by validate().
|
private |
Checks that the return address port has the same width as program counter port if both exists.
results | Results of the validation are added to the given instance. |
Definition at line 271 of file MachineValidator.cc.
References MachineValidatorResults::addError(), CALL, TTAMachine::Machine::controlUnit(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::ControlUnit::hasReturnAddressPort(), JUMP, machine_, TTAMachine::FunctionUnit::operation(), PC_AND_RA_PORTS_HAVE_UNEQUAL_WIDTH, TTAMachine::HWOperation::port(), TTAMachine::ControlUnit::returnAddressPort(), and TTAMachine::BaseFUPort::width().
Referenced by validate().
|
private |
Checks that the GCU has return address port if it has CALL operation.
results | Results of the validation are added to the given instance. |
Definition at line 245 of file MachineValidator.cc.
References MachineValidatorResults::addError(), CALL, TTAMachine::Machine::controlUnit(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::ControlUnit::hasReturnAddressPort(), machine_, and RA_PORT_MISSING.
Referenced by validate().
MachineValidatorResults * MachineValidator::validate | ( | const std::set< ErrorCode > & | errorsToCheck | ) | const |
Validates the machine.
errorsToCheck | Contains the error codes for the errors to check. |
Definition at line 81 of file MachineValidator.cc.
References assert, checkFUConnections(), checkGCUExists(), checkGCUHasAddressSpace(), checkIMemAddrWidth(), checkJumpAndCallOperandBindings(), checkOperandBindings(), checkProgramCounterPort(), checkRAPortHasSameWidthAsPCPort(), checkReturnAddressPort(), DIFFERENT_PORT_FOR_JUMP_AND_CALL, FU_PORT_MISSING, GCU_AS_MISSING, GCU_MISSING, IMEM_ADDR_WIDTH_DIFFERS_FROM_RA_AND_PC, PC_AND_RA_PORTS_HAVE_UNEQUAL_WIDTH, PC_PORT_MISSING, RA_PORT_MISSING, and USED_IO_NOT_BOUND.
Referenced by LLVMBackend::compile(), ProgrammabilityValidator::ProgrammabilityValidator(), and ProGe::ProcessorGenerator::validateMachine().
|
private |
The machine to validate.
Definition at line 98 of file MachineValidator.hh.
Referenced by checkFUConnections(), checkGCUExists(), checkGCUHasAddressSpace(), checkIMemAddrWidth(), checkJumpAndCallOperandBindings(), checkOperandBindings(), checkProgramCounterPort(), checkRAPortHasSameWidthAsPCPort(), and checkReturnAddressPort().