OpenASIP
2.0
|
#include "UniversalMachine.hh"
#include "Program.hh"
#include "Procedure.hh"
#include "Instruction.hh"
#include "Move.hh"
#include "MoveGuard.hh"
#include "Guard.hh"
#include "Terminal.hh"
#include "TerminalImmediate.hh"
#include "TerminalRegister.hh"
#include "SimValue.hh"
#include "OperationPool.hh"
#include "Application.hh"
#include "UniversalFunctionUnit.hh"
#include "UnboundedRegisterFile.hh"
#include "SmartHWOperation.hh"
#include "FUPort.hh"
#include "TerminalFUPort.hh"
#include "BaseFUPort.hh"
#include "Port.hh"
#include "SpecialRegisterPort.hh"
#include "RegisterFile.hh"
#include "FunctionUnit.hh"
#include "ControlUnit.hh"
#include "AssocTools.hh"
#include "StringTools.hh"
#include "Conversion.hh"
Go to the source code of this file.
Macros | |
#define | PRINTOUT(STUFF) |
define this to get the programs printed to stdout while they are contructed More... | |
#define | REG(RFNAME, REGNUM) |
#define | IREG(REGNUM) REG(r, REGNUM) |
#define | PORT(FUNAME, PORTNAME) |
#define | OPORT(FUNAME, PORTNAME, OPERATION) |
#define | OPERAND(OPERATION, OPERAND_INDEX) OPORT(OPERATION, OPERAND_INDEX, OPERATION) |
#define | IMM(WIDTH, VALUE) |
#define | CONTROL_OPERAND(OPERATION, OPNUM) |
#define | BOOL() |
#define | BOOLGUARD() |
#define | INVBOOLGUARD() |
#define | RA() |
#define | IMM32(VALUE) IMM(32, VALUE) |
#define | INSTRUCTION(ADD_MOVES) |
#define | MOVE_TEMPLATE(SRC, DST, CONSTRUCT_MOVE) |
#define | BASIC_MOVE_CONSTRUCTION tempMove = std::make_shared<Move>(src__, dst__, *bus__) |
#define | MOVE(SRC, DST) MOVE_TEMPLATE(SRC, DST, BASIC_MOVE_CONSTRUCTION); |
#define | NOP PRINTOUT("nop "); moveCounter__++; |
#define | LABEL(LABEL_NAME) iaddress_##LABEL_NAME |
#define | SET_LABEL(LABEL_NAME) |
#define | SET_IP(VALUE) currentIP__ = VALUE |
#define | SET_IP_INCREMENT(COUNT) incrementOfIP__ = COUNT |
#define | GUARDED_MOVE_CONSTRUCTION(ADFGUARD) |
#define | GMOVE(SRC, DST, GUARD) MOVE_TEMPLATE(SRC, DST, GUARDED_MOVE_CONSTRUCTION(GUARD)); |
#define | CREATE_PROGRAM(PROGRAM, MACHINE) |
#define | CREATE_PROCEDURE(PROCNAME) |
#define | END_PROGRAM |
Functions | |
void | null__ () |
TTAMachine::RegisterFile & | findRegisterFile (const TTAMachine::Machine &machine, std::string name) |
TTAMachine::FunctionUnit & | findFunctionUnit (const TTAMachine::Machine &machine, std::string name) |
TTAProgram::TerminalFUPort * | createTerminalFUPort (const TTAMachine::Machine &machine, std::string fuName, std::string pName, std::string opName) |
TTAMachine::Port & | findFUPort (const TTAMachine::Machine &machine, std::string fuName, std::string portName) |
SimValue & | tempSimValue (unsigned int bitWidth, SIntWord intValue) |
TTAMachine::Bus & | findBus (const TTAMachine::Machine &machine, std::string busName) |
TTAMachine::RegisterFile & | findBooleanRegisterFile (const TTAMachine::Machine &machine) |
TTAMachine::Guard & | findBooleanGuard (const TTAMachine::Machine &machine, bool isInverted) |
Variables | |
SimValue * | temporary = NULL |
A macro set and helper functions for implementing the macros to make creating of Program Object Models for unit tests manually easy.
Definition in file POMGenMacros.hh.
#define BASIC_MOVE_CONSTRUCTION tempMove = std::make_shared<Move>(src__, dst__, *bus__) |
Creates a basic move without any guards.
Definition at line 446 of file POMGenMacros.hh.
#define BOOL | ( | ) |
Creates a terminal pointing to the boolean register.
Definition at line 371 of file POMGenMacros.hh.
#define BOOLGUARD | ( | ) |
Returns RegisterGuard pointing to boolean register
Definition at line 379 of file POMGenMacros.hh.
#define CONTROL_OPERAND | ( | OPERATION, | |
OPNUM | |||
) |
Creates a TerminalFUPort that writes to the GCU operand port, thus triggering a control flow operation.
OPERATION | The name of the operation to trigger. |
OPNUM | The operand number. |
Definition at line 297 of file POMGenMacros.hh.
#define CREATE_PROCEDURE | ( | PROCNAME | ) |
Creates a new procedure to add instructions to.
Sets a label to the creation position.
Definition at line 584 of file POMGenMacros.hh.
#define CREATE_PROGRAM | ( | PROGRAM, | |
MACHINE | |||
) |
Creates a guarded move and adds it to the instruction this macro is invoked in.
Inverted version.s
SRC | The source terminal. |
DST | The destination terminal. |
GTERM | The termimal that is watched by this guard. #define IGMOVE(SRC, DST, GTERM) \ MOVE_TEMPLATE(SRC, DST, GUARDED_MOVE_CONSTRUCTION(GTERM, true)); Initializes the POM generator macros. |
This should be stated before using the above macros.
@PROGRAM The name of the program. @MACHINE The target processor of the program.
Definition at line 563 of file POMGenMacros.hh.
#define END_PROGRAM |
Frees the resources allocated by the POM generator macros.
Currently does basically nothing. Code is there just to avoid compiler warnings/errors.
Definition at line 597 of file POMGenMacros.hh.
#define GMOVE | ( | SRC, | |
DST, | |||
GUARD | |||
) | MOVE_TEMPLATE(SRC, DST, GUARDED_MOVE_CONSTRUCTION(GUARD)); |
Creates a guarded move and adds it to the instruction this macro is invoked in.
Non-inverted version.
SRC | The source terminal. |
DST | The destination terminal. |
GTERM | The termimal that is watched by this guard. #define GMOVE(SRC, DST, GTERM) \ MOVE_TEMPLATE(SRC, DST, GUARDED_MOVE_CONSTRUCTION(GTERM, false)); |
Definition at line 539 of file POMGenMacros.hh.
#define GUARDED_MOVE_CONSTRUCTION | ( | ADFGUARD | ) |
Creation of guarded move.
TERMINAL | The terminal the guard should watch. |
INVERT | Is the guard inverted? true if it is. |
#define GUARDED_MOVE_CONSTRUCTION(TERMINAL, INVERT) \ PRINTOUT(" || only if ");\ Terminal* term__ = TERMINAL;\ PRINTOUT(" != " #INVERT); \ PRINTOUT(" ||"); \ MoveGuard* guard__ = new MoveGuard(term__, INVERT); \ tempMove = new Move(src__, dst__, *bus__, guard__);
Definition at line 520 of file POMGenMacros.hh.
#define IMM | ( | WIDTH, | |
VALUE | |||
) |
Creates a TerminalImmediate by width and value.
Expects the creator to manage deallocation.
WIDTH | The bit width of the value. |
VALUE | The value of the immediate. |
Definition at line 286 of file POMGenMacros.hh.
#define IMM32 | ( | VALUE | ) | IMM(32, VALUE) |
A shortcut which creates a 32 bit TerminalImmediate.
VALUE | The value of the immediate. |
Definition at line 405 of file POMGenMacros.hh.
#define INSTRUCTION | ( | ADD_MOVES | ) |
Creates an instruction and adds it to a procedure.
ADD_MOVES | A (list of) move creation statement(s). |
Definition at line 413 of file POMGenMacros.hh.
#define INVBOOLGUARD | ( | ) |
Returns Inverted RegisterGuard pointing to boolean register
Definition at line 386 of file POMGenMacros.hh.
#define IREG | ( | REGNUM | ) | REG(r, REGNUM) |
Shortcut to an integer register in sequential code.
REGNUM | The integer register index. |
Definition at line 133 of file POMGenMacros.hh.
#define LABEL | ( | LABEL_NAME | ) | iaddress_##LABEL_NAME |
Gets the variable connected to a label.
Using LABEL and SET_LABEL macros one can make implementing backward jumps easier.
LABEL_NAME | The name of the label to refer to. |
Definition at line 475 of file POMGenMacros.hh.
#define MOVE | ( | SRC, | |
DST | |||
) | MOVE_TEMPLATE(SRC, DST, BASIC_MOVE_CONSTRUCTION); |
Creates a basic move and adds it to the instruction this macro is invoked in.
Expects that the bus names of the machine are named by appending the index of the bus to the word 'bus', i.e., 'bus1', 'bus2', etc.
SRC | The source terminal. |
DST | The destination terminal. |
Definition at line 458 of file POMGenMacros.hh.
#define MOVE_TEMPLATE | ( | SRC, | |
DST, | |||
CONSTRUCT_MOVE | |||
) |
A helper macro to create different types of moves.
SRC | The source terminal. |
DST | The destination terminal. |
MOVE_CONSTRUCTOR | A constructor of the move to create. |
Definition at line 430 of file POMGenMacros.hh.
#define NOP PRINTOUT("nop "); moveCounter__++; |
A no-operation move.
Just skips the move slot by incrementing the move counter.
Definition at line 465 of file POMGenMacros.hh.
A shortcut to an operand in sequential code.
OPERATION | The name of the operation. |
OPERAND_INDEX | Index of the operand. |
Definition at line 241 of file POMGenMacros.hh.
#define OPORT | ( | FUNAME, | |
PORTNAME, | |||
OPERATION | |||
) |
Creates a TerminalFUPort using the given name strings.
FUNAME | The function unit or operation name (in sequential). |
PORTNAME | The port name or operand index (in sequential). |
OPERATION | The name of the operation. |
Definition at line 229 of file POMGenMacros.hh.
#define PORT | ( | FUNAME, | |
PORTNAME | |||
) |
Creates a TerminalFUPort using the given name strings.
FUNAME | The function unit or operation name (in sequential). |
PORTNAME | The port name or operand index (in sequential). |
Definition at line 216 of file POMGenMacros.hh.
#define PRINTOUT | ( | STUFF | ) |
define this to get the programs printed to stdout while they are contructed
Definition at line 73 of file POMGenMacros.hh.
#define RA | ( | ) |
Creates a terminal pointing to the return address port of the GCU.
Definition at line 393 of file POMGenMacros.hh.
#define REG | ( | RFNAME, | |
REGNUM | |||
) |
Creates a TerminalRegister using the given register file and register.
RFNAME | The register file name (either 'r' or 'f' in sequential). |
REGNUM | The index of the register. |
Definition at line 123 of file POMGenMacros.hh.
#define SET_IP | ( | VALUE | ) | currentIP__ = VALUE |
Forces a new value to the instruction pointer.
VALUE | The new value to assign to the instruction pointer counter. |
Definition at line 495 of file POMGenMacros.hh.
#define SET_IP_INCREMENT | ( | COUNT | ) | incrementOfIP__ = COUNT |
Sets the amount how much instruction pointer should be incremented after adding an instruction.
COUNT | The increment. |
Definition at line 503 of file POMGenMacros.hh.
#define SET_LABEL | ( | LABEL_NAME | ) |
Sets a label at the current instruction pointer position.
Using LABEL and SET_LABEL macros one can make implementing backward jumps easier.
LABEL_NAME | The name of the label to refer to. |
Definition at line 485 of file POMGenMacros.hh.
TTAProgram::TerminalFUPort* createTerminalFUPort | ( | const TTAMachine::Machine & | machine, |
std::string | fuName, | ||
std::string | pName, | ||
std::string | opName | ||
) |
Creates terminal of given parameters.
Definition at line 161 of file POMGenMacros.hh.
References findFunctionUnit(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::HWOperation::io(), machine, TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationPort(), and Conversion::toInt().
TTAMachine::Guard& findBooleanGuard | ( | const TTAMachine::Machine & | machine, |
bool | isInverted | ||
) |
Helper function which finds either normal or inverted guard pointing to boolean register
Aborts with error if the boolean register file is not found.
machine | The machine to search in. |
isInverted | Do we look for inverted guard. |
Definition at line 343 of file POMGenMacros.hh.
References abortWithError, TTAMachine::Machine::busNavigator(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), TTAMachine::Guard::isInverted(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::RegisterGuard::registerFile(), and TTAMachine::BaseRegisterFile::width().
TTAMachine::RegisterFile& findBooleanRegisterFile | ( | const TTAMachine::Machine & | machine | ) |
Helper function which finds the boolean register file in the machine.
Aborts with error if the boolean register file is not found.
machine | The machine to search in. |
Definition at line 312 of file POMGenMacros.hh.
References abortWithError, TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::Machine::registerFileNavigator(), and TTAMachine::BaseRegisterFile::width().
TTAMachine::Bus& findBus | ( | const TTAMachine::Machine & | machine, |
std::string | busName | ||
) |
Helper function which finds a bus in a machine.
Aborts with error if the bus is not found.
machine | The machine to search in. |
busName | The name of the bus. Unused in case of UniversalMachine. |
Definition at line 269 of file POMGenMacros.hh.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and machine.
TTAMachine::FunctionUnit& findFunctionUnit | ( | const TTAMachine::Machine & | machine, |
std::string | name | ||
) |
Helper function which finds a function unit in the machine.
Aborts with error if the function unit is not found.
machine | The machine to search in. |
name | The name of the function unit. Can be empty in sequential. |
Definition at line 146 of file POMGenMacros.hh.
References TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and machine.
Referenced by createTerminalFUPort(), and findFUPort().
TTAMachine::Port& findFUPort | ( | const TTAMachine::Machine & | machine, |
std::string | fuName, | ||
std::string | portName | ||
) |
Helper function which finds a port in a function unit.
Aborts with error if the port is not found.
machine | The machine to search in. |
fuName | The name of the function unit. The operation, if sequential. |
portName | The name of the port. The operand, if sequential code. |
Definition at line 196 of file POMGenMacros.hh.
References findFunctionUnit(), machine, TTAMachine::FunctionUnit::port(), and Conversion::toInt().
TTAMachine::RegisterFile& findRegisterFile | ( | const TTAMachine::Machine & | machine, |
std::string | name | ||
) |
Helper function which finds a register file in the machine.
Aborts with error if the register file is not found.
machine | The machine to search in. |
name | The name of the register file. |
Definition at line 94 of file POMGenMacros.hh.
References abortWithError, StringTools::ciEqual(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, and TTAMachine::Machine::registerFileNavigator().
void null__ | ( | ) |
Creates a temporary SimValue to be used in TerminalImmediate construction.
Definition at line 252 of file POMGenMacros.hh.
References temporary.
SimValue* temporary = NULL |
Definition at line 76 of file POMGenMacros.hh.
Referenced by EnableBPCommand::execute(), and tempSimValue().