Go to the documentation of this file.
35 #ifndef TTA_CODE_COMPRESSOR_PLUGIN_HH
36 #define TTA_CODE_COMPRESSOR_PLUGIN_HH
62 class ImmediateElement;
76 class InstructionTemplate;
99 void setPrograms(std::map<std::string, TPEF::Binary*>& programs);
120 std::ostream& stream,
TCEString entityStr) = 0;
138 typedef std::map<std::string, TPEF::Binary*>
TPEFMap;
185 typedef std::map<const TTAProgram::Instruction*, unsigned int>
215 const std::string& slotName,
243 unsigned int registerIndex);
252 unsigned int elementIndex,
InstructionAddressMap instructionAddresses_
Contains the addresses of instructions.
virtual void generateDecompressor(std::ostream &stream, TCEString entityStr)=0
virtual void printDescription(std::ostream &stream)=0
static BitVector socketCodeBits(const SocketCodeTable &socketCodes, const PortCode &portCode, unsigned int registerIndex)
std::map< std::string, TPEF::Binary * > TPEFMap
Map type for handling programs.
std::map< const TTAProgram::Immediate *, const TTAProgram::Instruction * > RelocMap
Map type that maps Immediates to the Instructions they are referring to.
TerminalSet terminalsToRelocate_
Set of (short) immediate terminals that refer to an instruction.
IndexTable indexTable_
A table of indexes used when encoding long immediates.
InstructionSet instructionsAtBeginningOfMAU_
Set of instructions that start at the beginning of MAU.
TPEFMap tpefPrograms_
Programs run in the machine.
static void encodeFUTerminal(const SlotField &field, const TTAProgram::Terminal &terminal, BitVector &bitVector)
std::string parameterValue(const std::string ¶mName) const
bool allStartsAtBeginningOfMAU_
Tells whether all the instructions starts at the beginning of MAU.
InstructionBitVector * bemBits(const TTAProgram::Program &program)
virtual ~CodeCompressorPlugin()
static void encodeIUTerminal(const SlotField &field, const TTAProgram::Terminal &terminal, BitVector &bitVector)
ParameterTable parameters_
Parameters for the plugin.
std::set< const TTAProgram::Terminal * > TerminalSet
Set type for Terminals.
std::string value
Value of the parameter.
void initializeRelocations()
TTAProgram::Program * currentPOM_
The current program in POM.
virtual InstructionBitVector * compress(const std::string &program)=0
void setBEM(const BinaryEncoding &bem)
void encodeImmediateTerminal(const SourceField &field, const TTAProgram::Terminal &terminal, InstructionBitVector &bitVector) const
int firstMoveSlotIndex() const
void setPrograms(std::map< std::string, TPEF::Binary * > &programs)
static void addBitsForGuardField(const GuardField &guardField, const TTAProgram::Move &move, BitVector &bitVector)
static void addBits(unsigned int number, int leftmostBit, int rightmostBit, BitVector &bitVector)
void addInstruction(const TTAProgram::Instruction &instruction, InstructionBitVector *bits)
std::map< const TTAProgram::Instruction *, unsigned int > InstructionAddressMap
Map type for addresses of instructions.
int numberOfPrograms() const
const TTAMachine::Machine & machine() const
static void addBitsForDestinationField(const DestinationField &dstField, const TTAProgram::Move &move, BitVector &bitVector)
std::vector< Parameter > ParameterTable
Table for passing plugin parameters.
int addressSpaceOffset_
The offset of the instruction memory (the address of the first instruction).
void addBitsForICField(const ImmediateControlField &icField, const TTAProgram::Instruction &instruction, BitVector &bitVector) const
void setInstructionToStartAtBeginningOfMAU(const TTAProgram::Instruction &instruction)
TTAProgram::Immediate * programImmediate(const TPEF::ImmediateElement &immElem, const TTAProgram::Instruction &instruction) const
std::string currentProgram_
The current program.
InstructionBitVector * bemInstructionBits(const TTAProgram::Instruction &)
int moveSlotCount() const
InstructionBitVector * programBits_
The bits of the program.
void startNewProgram(const std::string &programName)
void setParameters(ParameterTable parameters)
void encodeLongImmediate(const std::string &slotName, int slotWidth, const TTAProgram::Instruction &instruction, BitVector &bitVector)
std::map< const TTAProgram::Immediate *, std::vector< IndexBound > > IndexTable
Map type that maps Immediates to a vector of indexes.
int moveSlotWidth(int index) const
bool hasParameter(const std::string ¶mName) const
TTAProgram::Program & currentProgram() const
std::string instructionTemplate(const TTAProgram::Instruction &instruction) const
int mau_
The size of the minimum addressable unit.
TPEFMap::const_iterator programElement(int index) const
TPEF::Binary * currentTPEF_
The current TPEF.
const BinaryEncoding * bem_
The binary encoding map.
void addBitsForMoveSlot(const MoveSlot &slot, const TTAProgram::Instruction &instruction, InstructionBitVector &bitVector)
void addBitsForImmediateSlot(const ImmediateSlotField &immSlot, const TTAProgram::Instruction &instruction, BitVector &bitVector)
unsigned int nextAddressablePositionFrom(unsigned int position) const
unsigned int memoryAddress(const TTAProgram::Instruction &instruction) const
ImmediateSet immediatesToRelocate_
Set of (long) immediates that refer to an instruction.
RelocMap relocMap_
Contains information to which instructions the immediates are referring to.
void addBitsForSourceField(const SourceField &srcField, const TTAProgram::Move &move, InstructionBitVector &bitVector) const
static void encodeNOP(const MoveSlot &slot, BitVector &bitVector)
const TTAMachine::Machine * machine_
The machine.
void encodeMove(const MoveSlot &slot, const TTAProgram::Instruction &instruction, InstructionBitVector &bitVector) const
void setMachine(const TTAMachine::Machine &machine)
void setAllInstructionsToStartAtBeginningOfMAU()
find Finds info of the inner loops in the program
static void encodeSlotField(const SlotField &field, const BitVector &componentIDBits, const BitVector &socketCodeBits, BitVector &BitVector)
bool startsAtBeginningOfMAU(const TTAProgram::Instruction &instruction) const
const BinaryEncoding & binaryEncoding() const
std::string name
Name of the parameter.
static void encodeRFTerminal(const SlotField &field, const TTAProgram::Terminal &terminal, BitVector &bitVector)
TTAProgram::Terminal * immediateTerminal(const TPEF::CodeSection &codeSection, unsigned int elementIndex, const TPEF::ImmediateElement &immElem, const TTAProgram::Instruction &instruction) const
std::string indentation(int level)
InstructionBitVector * programBits() const
void setImemWidth(int mau, int widthInMaus=1)
std::set< const TTAProgram::Instruction * > InstructionSet
Set type for Instructions.
void addBitsForDstRegisterField(const LImmDstRegisterField &field, const TTAProgram::Instruction &instruction, BitVector &bitVector)
std::set< const TTAProgram::Immediate * > ImmediateSet
Set type for Immediates.