OpenASIP
2.0
|
#include <ProgrammabilityValidator.hh>
Classes | |
struct | Connections |
Struct of connections. More... | |
struct | ConnectionSet |
Moves are generated from these. More... | |
Public Types | |
enum | ErrorCode { OPERATION_MISSING_FROM_THE_PRIMITIVE_OPERATION_SET, BOOLEAN_REGISTER_ERROR, BOOLEAN_REGISTER_GUARD_MISSING, GLOBAL_CONNECTION_REGISTER_NOT_FOUND, MISSING_CONNECTION } |
Error codes for different errors. More... | |
Public Member Functions | |
ProgrammabilityValidator (const Machine &machine) | |
~ProgrammabilityValidator () | |
ProgrammabilityValidatorResults * | validate () |
ProgrammabilityValidatorResults * | validate (const std::set< ErrorCode > &errorsToCheck) |
void | checkPrimitiveSet (ProgrammabilityValidatorResults &results) const |
void | findConnections () |
void | printConnections () |
void | printRegisterConnections () |
const RegisterFile * | findGlobalConnectionRegister () |
void | findGlobalRegisterConnections () |
void | printNotConnectedSockets (const RegisterFile *rf) |
void | searchMissingRFConnections (const RegisterFile *rf, vector< pair< string, string > > &toConnections, vector< pair< string, string > > &fromConnections) |
bool | checkBooleanRegister (ProgrammabilityValidatorResults &results) |
TPEF::Binary * | profile (ProgrammabilityValidatorResults &results) |
Private Types | |
typedef map< string, map< const Socket *, Connections > >::iterator | mapIter |
type definition for going through connection maps More... | |
typedef set< pair< const Port *, const Port * > >::iterator | portSetIter |
type definition for going through connection sets More... | |
typedef set< pair< const RegisterFile *, const RegisterFile * > >::iterator | registerRegisterSetIter |
typedef set< pair< const Port *, const RegisterFile * > >::iterator | portRegisterSetIter |
typedef set< pair< const RegisterFile *, const Port * > >::iterator | registerPortSetIter |
Private Member Functions | |
void | addConnectionToProgram (const Port *sourcePort, const Port *destPort, Segment *segment, int &counter) |
void | addConnections (set< Segment * > &newConnections, set< Segment * > &connections) |
void | addOperationConnections (const FunctionUnit *fu, set< HWOperation * > &operations) |
void | listConnections (set< Segment * > &connections, const Socket *socket) |
void | printConnection (const Port *sourcePort, const Port *destPort, Segment *segment, int &counter) |
void | findRegisterGuard (Segment *segment, RegisterGuard *&guard) |
void | addDirectConnection (const Port *sourcePort, const Port *destPort, Segment *segment) |
void | addGlobalRegisterConnection (const Port *sourcePort, const Port *destPort, Segment *segment) |
void | addDirectConnectionsToProgram () |
void | addGlobalRegisterConnectionsToProgram () |
Private Attributes | |
const Machine & | machine_ |
the target machine More... | |
Program * | program_ |
Program where moves are generated. More... | |
Procedure * | procedure_ |
Procedure of the program. More... | |
RegisterFile * | booleanRegister_ |
Boolean register file of the machine. More... | |
RegisterFile * | globalConnectionRegister_ |
The global connection register of the machine. More... | |
MinimalOpSetCheck * | minimalOpSetCheck_ |
Minimal operation checker. More... | |
vector< pair< const Port *, set< Segment * > > > | inputs |
All inputs found in the machine are stored here. More... | |
int | directCounter |
The counter of direct connections added to the program. More... | |
int | gcrCounter |
The counter of global register file connections added to the program. More... | |
set< pair< const Port *, const Port * > > | allConnections |
Set of connections to ensure that same Move is not done in multiple buses. More... | |
set< pair< const Port *, const Port * > > | gcrConnections |
set< pair< const Port *, const RegisterFile * > > | portRegisterConnections |
Set of unit connections to ensure that only one connection per register file is added. More... | |
set< pair< const RegisterFile *, const Port * > > | registerPortConnections |
set< pair< const RegisterFile *, const RegisterFile * > > | registerRegisterConnections |
set< pair< const Port *, const RegisterFile * > > | portGcrConnections |
set< pair< const RegisterFile *, const Port * > > | gcrPortConnections |
set< pair< const RegisterFile *, const RegisterFile * > > | gcrRegisterConnections |
vector< ConnectionSet > | directConnections |
Storage of all the Moves that are found in the machine. More... | |
vector< ConnectionSet > | globalRegisterConnections |
Storage of all Moves to and from the Global Connection Register. More... | |
map< string, map< const Socket *, Connections > > | FUConnections |
Function unit connections. More... | |
map< string, map< const Socket *, Connections > > | GCUConnections |
Global control unit connections. More... | |
map< string, map< const Socket *, Connections > > | RFConnections |
Register file connections. More... | |
map< string, map< const Socket *, Connections > > | IMMConnections |
Immediate unit connections. More... | |
Definition at line 75 of file ProgrammabilityValidator.hh.
|
private |
type definition for going through connection maps
Definition at line 221 of file ProgrammabilityValidator.hh.
|
private |
Definition at line 225 of file ProgrammabilityValidator.hh.
|
private |
type definition for going through connection sets
Definition at line 223 of file ProgrammabilityValidator.hh.
|
private |
Definition at line 226 of file ProgrammabilityValidator.hh.
|
private |
Definition at line 224 of file ProgrammabilityValidator.hh.
Error codes for different errors.
Definition at line 79 of file ProgrammabilityValidator.hh.
ProgrammabilityValidator::ProgrammabilityValidator | ( | const Machine & | machine | ) |
The constructor.
machine | The machine that will be profiled. |
procedure | ProgrammabilityValidator generates procedure. |
Definition at line 78 of file ProgrammabilityValidator.cc.
References __func__, TTAProgram::Program::addProcedure(), TTAMachine::FunctionUnit::addressSpace(), booleanRegister_, TTAMachine::Machine::controlUnit(), directCounter, MachineValidatorResults::error(), MachineValidatorResults::errorCount(), FUConnections, gcrCounter, MachineValidator::GCU_AS_MISSING, MachineValidator::GCU_MISSING, GCUConnections, IMMConnections, machine, machine_, procedure_, program_, RFConnections, and MachineValidator::validate().
ProgrammabilityValidator::~ProgrammabilityValidator | ( | ) |
The destructor.
Definition at line 118 of file ProgrammabilityValidator.cc.
References FUConnections, GCUConnections, IMMConnections, minimalOpSetCheck_, and RFConnections.
|
private |
Adds new connections to all connections holding set.
newConnections | New connections that can be added. |
connections | All connections holding set. |
Definition at line 1219 of file ProgrammabilityValidator.cc.
Referenced by findConnections().
|
private |
Adds connection to program. Generates instruction that is given to procedure.
sourcePort | The source port of the connection. |
destPort | The destination port of the connection. |
segment | The segment which is used in the connection. |
counter | Counter that is updated when an instruction is added. |
Definition at line 609 of file ProgrammabilityValidator.cc.
References TTAProgram::Procedure::add(), TTAProgram::Instruction::addMove(), findRegisterGuard(), TTAMachine::HWOperation::io(), TTAMachine::BaseFUPort::isTriggering(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::Segment::parentBus(), TTAMachine::Port::parentUnit(), and procedure_.
Referenced by addDirectConnectionsToProgram(), and addGlobalRegisterConnectionsToProgram().
|
private |
Adds direct connection (unit to unit) to list of direct connections. Moves can be genetated from these connections.
sourcePort | Source port of the move. |
destPort | Destionation port of the move. |
segment | The segment of the move. |
Definition at line 1687 of file ProgrammabilityValidator.cc.
References allConnections, ProgrammabilityValidator::ConnectionSet::destPort, directConnections, TTAMachine::Port::parentUnit(), portRegisterConnections, registerPortConnections, registerRegisterConnections, ProgrammabilityValidator::ConnectionSet::segment, and ProgrammabilityValidator::ConnectionSet::sourcePort.
Referenced by findConnections().
|
private |
Adds all connections found in the machine to program.
Definition at line 1648 of file ProgrammabilityValidator.cc.
References addConnectionToProgram(), ProgrammabilityValidator::ConnectionSet::destPort, directConnections, directCounter, ProgrammabilityValidator::ConnectionSet::segment, and ProgrammabilityValidator::ConnectionSet::sourcePort.
|
private |
Adds global connection register connection to list of GCR connections. Moves can be genetated from these connections.
sourcePort | Source port of the move. |
destPort | Destionation port of the move. |
segment | The segment of the move. |
Definition at line 1280 of file ProgrammabilityValidator.cc.
References assert, ProgrammabilityValidator::ConnectionSet::destPort, gcrConnections, gcrPortConnections, gcrRegisterConnections, globalRegisterConnections, TTAMachine::Port::parentUnit(), portGcrConnections, ProgrammabilityValidator::ConnectionSet::segment, and ProgrammabilityValidator::ConnectionSet::sourcePort.
Referenced by findGlobalRegisterConnections().
|
private |
Adds global connection registers connections to program.
Definition at line 1665 of file ProgrammabilityValidator.cc.
References addConnectionToProgram(), ProgrammabilityValidator::ConnectionSet::destPort, gcrCounter, globalRegisterConnections, ProgrammabilityValidator::ConnectionSet::segment, and ProgrammabilityValidator::ConnectionSet::sourcePort.
Referenced by findGlobalRegisterConnections().
|
private |
Adds operations to connections.
fu | The function unit that is the parentunit for the operations. |
opertations | Set of FWOperations where new operations are added. |
Definition at line 1237 of file ProgrammabilityValidator.cc.
References TTAMachine::FunctionUnit::operation(), and TTAMachine::FunctionUnit::operationCount().
Referenced by findConnections().
bool ProgrammabilityValidator::checkBooleanRegister | ( | ProgrammabilityValidatorResults & | results | ) |
Check the machine for a boolean register file. Only one is allowed. Boolean register should have size and width of one.
results | Results of the validation are added to the given instance. |
Definition at line 361 of file ProgrammabilityValidator.cc.
References ProgrammabilityValidatorResults::addError(), BOOLEAN_REGISTER_ERROR, BOOLEAN_REGISTER_GUARD_MISSING, booleanRegister_, TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Component::name(), TTAMachine::Guard::parentBus(), TTAMachine::RegisterGuard::registerFile(), TTAMachine::Machine::registerFileNavigator(), TTAMachine::RegisterGuard::registerIndex(), and TTAMachine::BaseRegisterFile::width().
Referenced by main(), profile(), searchMissingRFConnections(), and validate().
void ProgrammabilityValidator::checkPrimitiveSet | ( | ProgrammabilityValidatorResults & | results | ) | const |
Checks the machine which primitive operations are missing.
results | Results of the validation are added to the given instance. |
Definition at line 335 of file ProgrammabilityValidator.cc.
References ProgrammabilityValidatorResults::addError(), machine_, minimalOpSetCheck_, MinimalOpSetCheck::missingOperations(), and OPERATION_MISSING_FROM_THE_PRIMITIVE_OPERATION_SET.
Referenced by profile(), and validate().
void ProgrammabilityValidator::findConnections | ( | ) |
Finds out all the connections in the machine.
printConnections | Flag for printing of connections. |
Definition at line 1377 of file ProgrammabilityValidator.cc.
References addConnections(), addDirectConnection(), addOperationConnections(), ContainerTools::containsValue(), TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), FUConnections, TTAMachine::Machine::functionUnitNavigator(), GCUConnections, IMMConnections, TTAMachine::Machine::immediateUnitNavigator(), inputs, ProgrammabilityValidator::Connections::inputs, TTAMachine::Port::inputSocket(), SetTools::intersection(), TTAMachine::BaseFUPort::isTriggering(), TTAMachine::Machine::Navigator< ComponentType >::item(), listConnections(), machine_, TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), ProgrammabilityValidator::Connections::operations, ProgrammabilityValidator::Connections::outputs, TTAMachine::Port::outputSocket(), TTAMachine::BaseRegisterFile::port(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), TTAMachine::Machine::registerFileNavigator(), ProgrammabilityValidator::Connections::registers, RFConnections, and ProgrammabilityValidator::Connections::triggeredInputs.
Referenced by profile(), and validate().
const RegisterFile * ProgrammabilityValidator::findGlobalConnectionRegister | ( | ) |
Finds the global connection register out of the machine.
The global connection register is register that has the best connecticity.
Definition at line 1789 of file ProgrammabilityValidator.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), globalConnectionRegister_, inputs, TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Component::name(), TTAMachine::Machine::registerFileNavigator(), RFConnections, TTAMachine::BaseRegisterFile::width(), and TTAMachine::Bus::width().
Referenced by main(), profile(), and validate().
void ProgrammabilityValidator::findGlobalRegisterConnections | ( | ) |
Finds out the connections to the register file and stores those in the procedure.
Definition at line 1252 of file ProgrammabilityValidator.cc.
References addGlobalRegisterConnection(), addGlobalRegisterConnectionsToProgram(), directConnections, and globalConnectionRegister_.
Referenced by profile(), and validate().
|
private |
Finds the guard of the boolean register file.
segment | The segment where the guard is searched from. |
guard | The found guard is put here. |
Definition at line 581 of file ProgrammabilityValidator.cc.
References booleanRegister_, TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), TTAMachine::Guard::parentBus(), TTAMachine::Segment::parentBus(), TTAMachine::RegisterGuard::registerFile(), and TTAMachine::RegisterGuard::registerIndex().
Referenced by addConnectionToProgram().
|
private |
Gererates a set of segments where the socket is connected.
connections | Segments where the socket is connected is collected here. |
socket | Socket which connections are searched. |
Definition at line 797 of file ProgrammabilityValidator.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Socket::isConnectedTo(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Bus::segment(), and TTAMachine::Bus::segmentCount().
Referenced by findConnections().
|
private |
Prints one connection.
sourcePort | The source port of the connection. |
destPort | The destination port of the connection. |
segment | The segment which is used in the connection. |
counter | Updates the amount of printed connections. |
Definition at line 433 of file ProgrammabilityValidator.cc.
References TTAMachine::Port::inputSocket(), TTAMachine::BaseFUPort::isTriggering(), TTAMachine::HWOperation::name(), TTAMachine::Segment::name(), TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::Port::outputSocket(), TTAMachine::Segment::parentBus(), and TTAMachine::Port::parentUnit().
Referenced by printConnections(), and printRegisterConnections().
void ProgrammabilityValidator::printConnections | ( | ) |
Prints all connections found in the machine.
Definition at line 1766 of file ProgrammabilityValidator.cc.
References ProgrammabilityValidator::ConnectionSet::destPort, directConnections, printConnection(), ProgrammabilityValidator::ConnectionSet::segment, and ProgrammabilityValidator::ConnectionSet::sourcePort.
Referenced by main().
void ProgrammabilityValidator::printNotConnectedSockets | ( | const RegisterFile * | rf | ) |
Prints the missing connections to the register file.
rf | The register file which connections are handled. |
Definition at line 1025 of file ProgrammabilityValidator.cc.
References FUConnections, GCUConnections, IMMConnections, SetTools::intersection(), TTAMachine::Component::name(), and RFConnections.
void ProgrammabilityValidator::printRegisterConnections | ( | ) |
Prints connections from and to the global connection register.
Definition at line 1356 of file ProgrammabilityValidator.cc.
References ProgrammabilityValidator::ConnectionSet::destPort, globalRegisterConnections, printConnection(), ProgrammabilityValidator::ConnectionSet::segment, and ProgrammabilityValidator::ConnectionSet::sourcePort.
Referenced by main().
TPEF::Binary * ProgrammabilityValidator::profile | ( | ProgrammabilityValidatorResults & | results | ) |
Does all the steps needed to check maintaining the programmability.
results | Possible error messages are added here. |
NotAvailable | Thrown if binary creation is failed. |
InvalidData | Thrown if the binary can't be created. |
Definition at line 269 of file ProgrammabilityValidator.cc.
References __func__, ProgrammabilityValidatorResults::addError(), checkBooleanRegister(), checkPrimitiveSet(), TTAProgram::ProgramWriter::createBinary(), findConnections(), findGlobalConnectionRegister(), findGlobalRegisterConnections(), GLOBAL_CONNECTION_REGISTER_NOT_FOUND, globalConnectionRegister_, MISSING_CONNECTION, TTAMachine::Component::name(), program_, and searchMissingRFConnections().
Referenced by InstructionDictionary::compress(), and main().
void ProgrammabilityValidator::searchMissingRFConnections | ( | const RegisterFile * | rf, |
vector< pair< string, string > > & | toConnections, | ||
vector< pair< string, string > > & | fromConnections | ||
) |
Search and lists all the missing connections to the register file.
rf | The register file which connections are handled. |
toConnections | Missing inputs to the register file. |
fromConnections | Missing outputs from the register file. |
Definition at line 827 of file ProgrammabilityValidator.cc.
References booleanRegister_, checkBooleanRegister(), FUConnections, GCUConnections, IMMConnections, SetTools::intersection(), TTAMachine::Component::name(), and RFConnections.
Referenced by profile(), and validate().
ProgrammabilityValidatorResults * ProgrammabilityValidator::validate | ( | ) |
Does all validations of ProgrammabilityValidator.
Definition at line 137 of file ProgrammabilityValidator.cc.
References ProgrammabilityValidatorResults::addError(), checkBooleanRegister(), checkPrimitiveSet(), findConnections(), findGlobalConnectionRegister(), findGlobalRegisterConnections(), GLOBAL_CONNECTION_REGISTER_NOT_FOUND, globalConnectionRegister_, MISSING_CONNECTION, TTAMachine::Component::name(), and searchMissingRFConnections().
Referenced by ValidateMachineDialog::onValidate().
ProgrammabilityValidatorResults * ProgrammabilityValidator::validate | ( | const std::set< ErrorCode > & | errorsToCheck | ) |
Does selected validations of ProgrammabilityValidator.
errorsToCheck | Contains the error codes for the errors to check. |
Definition at line 195 of file ProgrammabilityValidator.cc.
References ProgrammabilityValidatorResults::addError(), assert, BOOLEAN_REGISTER_ERROR, BOOLEAN_REGISTER_GUARD_MISSING, checkBooleanRegister(), checkPrimitiveSet(), findConnections(), findGlobalConnectionRegister(), GLOBAL_CONNECTION_REGISTER_NOT_FOUND, globalConnectionRegister_, MISSING_CONNECTION, TTAMachine::Component::name(), OPERATION_MISSING_FROM_THE_PRIMITIVE_OPERATION_SET, and searchMissingRFConnections().
Set of connections to ensure that same Move is not done in multiple buses.
Definition at line 193 of file ProgrammabilityValidator.hh.
Referenced by addDirectConnection().
|
private |
Boolean register file of the machine.
Definition at line 161 of file ProgrammabilityValidator.hh.
Referenced by checkBooleanRegister(), findRegisterGuard(), ProgrammabilityValidator(), and searchMissingRFConnections().
|
private |
Storage of all the Moves that are found in the machine.
Definition at line 207 of file ProgrammabilityValidator.hh.
Referenced by addDirectConnection(), addDirectConnectionsToProgram(), findGlobalRegisterConnections(), and printConnections().
|
private |
The counter of direct connections added to the program.
Definition at line 187 of file ProgrammabilityValidator.hh.
Referenced by addDirectConnectionsToProgram(), and ProgrammabilityValidator().
|
private |
Function unit connections.
Definition at line 212 of file ProgrammabilityValidator.hh.
Referenced by findConnections(), printNotConnectedSockets(), ProgrammabilityValidator(), searchMissingRFConnections(), and ~ProgrammabilityValidator().
Definition at line 194 of file ProgrammabilityValidator.hh.
Referenced by addGlobalRegisterConnection().
|
private |
The counter of global register file connections added to the program.
Definition at line 189 of file ProgrammabilityValidator.hh.
Referenced by addGlobalRegisterConnectionsToProgram(), and ProgrammabilityValidator().
|
private |
Definition at line 203 of file ProgrammabilityValidator.hh.
Referenced by addGlobalRegisterConnection().
|
private |
Definition at line 204 of file ProgrammabilityValidator.hh.
Referenced by addGlobalRegisterConnection().
|
private |
Global control unit connections.
Definition at line 214 of file ProgrammabilityValidator.hh.
Referenced by findConnections(), printNotConnectedSockets(), ProgrammabilityValidator(), searchMissingRFConnections(), and ~ProgrammabilityValidator().
|
private |
The global connection register of the machine.
Definition at line 163 of file ProgrammabilityValidator.hh.
Referenced by findGlobalConnectionRegister(), findGlobalRegisterConnections(), profile(), and validate().
|
private |
Storage of all Moves to and from the Global Connection Register.
Definition at line 209 of file ProgrammabilityValidator.hh.
Referenced by addGlobalRegisterConnection(), addGlobalRegisterConnectionsToProgram(), and printRegisterConnections().
|
private |
Immediate unit connections.
Definition at line 218 of file ProgrammabilityValidator.hh.
Referenced by findConnections(), printNotConnectedSockets(), ProgrammabilityValidator(), searchMissingRFConnections(), and ~ProgrammabilityValidator().
All inputs found in the machine are stored here.
Definition at line 168 of file ProgrammabilityValidator.hh.
Referenced by findConnections(), and findGlobalConnectionRegister().
|
private |
the target machine
Definition at line 155 of file ProgrammabilityValidator.hh.
Referenced by checkBooleanRegister(), checkPrimitiveSet(), findConnections(), findGlobalConnectionRegister(), listConnections(), and ProgrammabilityValidator().
|
private |
Minimal operation checker.
Definition at line 165 of file ProgrammabilityValidator.hh.
Referenced by checkPrimitiveSet(), and ~ProgrammabilityValidator().
|
private |
Definition at line 202 of file ProgrammabilityValidator.hh.
Referenced by addGlobalRegisterConnection().
|
private |
Set of unit connections to ensure that only one connection per register file is added.
Definition at line 198 of file ProgrammabilityValidator.hh.
Referenced by addDirectConnection().
|
private |
Procedure of the program.
Definition at line 159 of file ProgrammabilityValidator.hh.
Referenced by addConnectionToProgram(), and ProgrammabilityValidator().
|
private |
Program where moves are generated.
Definition at line 157 of file ProgrammabilityValidator.hh.
Referenced by profile(), and ProgrammabilityValidator().
|
private |
Definition at line 199 of file ProgrammabilityValidator.hh.
Referenced by addDirectConnection().
|
private |
Definition at line 200 of file ProgrammabilityValidator.hh.
Referenced by addDirectConnection().
|
private |
Register file connections.
Definition at line 216 of file ProgrammabilityValidator.hh.
Referenced by findConnections(), findGlobalConnectionRegister(), printNotConnectedSockets(), ProgrammabilityValidator(), searchMissingRFConnections(), and ~ProgrammabilityValidator().