OpenASIP 2.2
Loading...
Searching...
No Matches
Macros | Functions | Variables
POMGenMacros.hh File Reference
#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"
Include dependency graph for POMGenMacros.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
 
#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::RegisterFilefindRegisterFile (const TTAMachine::Machine &machine, std::string name)
 
TTAMachine::FunctionUnitfindFunctionUnit (const TTAMachine::Machine &machine, std::string name)
 
TTAProgram::TerminalFUPortcreateTerminalFUPort (const TTAMachine::Machine &machine, std::string fuName, std::string pName, std::string opName)
 
TTAMachine::PortfindFUPort (const TTAMachine::Machine &machine, std::string fuName, std::string portName)
 
SimValuetempSimValue (unsigned int bitWidth, SIntWord intValue)
 
TTAMachine::BusfindBus (const TTAMachine::Machine &machine, std::string busName)
 
TTAMachine::RegisterFilefindBooleanRegisterFile (const TTAMachine::Machine &machine)
 
TTAMachine::GuardfindBooleanGuard (const TTAMachine::Machine &machine, bool isInverted)
 

Variables

SimValuetemporary = NULL
 

Detailed Description

A macro set and helper functions for implementing the macros to make creating of Program Object Models for unit tests manually easy.

Author
Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)

Definition in file POMGenMacros.hh.

Macro Definition Documentation

◆ BASIC_MOVE_CONSTRUCTION

#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.

◆ BOOL

#define BOOL ( )
Value:
new TerminalRegister(\
*findBooleanRegisterFile(machine__).port(0), 0);\
PRINTOUT("bool")
TTAMachine::RegisterFile & findBooleanRegisterFile(const TTAMachine::Machine &machine)

Creates a terminal pointing to the boolean register.

Definition at line 371 of file POMGenMacros.hh.

413{\
414 Instruction* tempInstruction__ = new Instruction(); \
415 int moveCounter__ = 1; \
416 PRINTOUT("\t" << currentIP__ << ": ");\
417 ADD_MOVES; \
418 PRINTOUT("\n");\
419 proc->add(tempInstruction__); \
420} currentIP__ += incrementOfIP__
421
422/**
423 * A helper macro to create different types of moves.
424 *
425 * @param SRC The source terminal.
426 * @param DST The destination terminal.
427 * @param MOVE_CONSTRUCTOR A constructor of the move to create.
428 */
429#define MOVE_TEMPLATE(SRC, DST, CONSTRUCT_MOVE) \
430{\
431 Terminal* src__ = SRC;\
432 PRINTOUT(" -> "); \
433 Terminal* dst__ = DST;\
434 PRINTOUT(" "); \
435 Bus* bus__ = &findBus(\
436 machine__, std::string("bus") + Conversion::toString(moveCounter__));\
437 std::shared_ptr<Move> tempMove = nullptr; \
438 CONSTRUCT_MOVE;\
439 tempInstruction__->addMove(tempMove);\
440} moveCounter__++;
441
442/**
443 * Creates a basic move without any guards.
444 */
445#define BASIC_MOVE_CONSTRUCTION tempMove = std::make_shared<Move>(src__, dst__, *bus__)
446
447/**
448 * Creates a basic move and adds it to the instruction this macro is
449 * invoked in.
450 *
451 * Expects that the bus names of the machine are named by appending the
452 * index of the bus to the word 'bus', i.e., 'bus1', 'bus2', etc.
453 *
454 * @param SRC The source terminal.
455 * @param DST The destination terminal.
456 */
457#define MOVE(SRC, DST) MOVE_TEMPLATE(SRC, DST, BASIC_MOVE_CONSTRUCTION);
458
459/**
460 * A no-operation move.
461 *
462 * Just skips the move slot by incrementing the move counter.
463 */
464#define NOP PRINTOUT("nop "); moveCounter__++;
465
466/**
467 * Gets the variable connected to a label.
468 *
469 * Using LABEL and SET_LABEL macros one can make implementing backward
470 * jumps easier.
471 *
472 * @param LABEL_NAME The name of the label to refer to.
473 */
474#define LABEL(LABEL_NAME) iaddress_##LABEL_NAME
475
476/**
477 * Sets a label at the current instruction pointer position.
478 *
479 * Using LABEL and SET_LABEL macros one can make implementing backward
480 * jumps easier.
481 *
482 * @param LABEL_NAME The name of the label to refer to.
483 */
484#define SET_LABEL(LABEL_NAME) \
485 PRINTOUT(#LABEL_NAME ":\n");\
486 unsigned int LABEL(LABEL_NAME) = currentIP__; \
487 LABEL(LABEL_NAME) = currentIP__;
488
489/**
490 * Forces a new value to the instruction pointer.
491 *
492 * @param VALUE The new value to assign to the instruction pointer counter.
493 */
494#define SET_IP(VALUE) currentIP__ = VALUE
495
496/**
497 * Sets the amount how much instruction pointer should be incremented after
498 * adding an instruction.
499 *
500 * @param COUNT The increment.
501 */
502#define SET_IP_INCREMENT(COUNT) incrementOfIP__ = COUNT
503
504/**
505 * Creation of guarded move.
506 *
507 * @param TERMINAL The terminal the guard should watch.
508 * @param INVERT Is the guard inverted? true if it is.
509
510#define GUARDED_MOVE_CONSTRUCTION(TERMINAL, INVERT) \
511 PRINTOUT(" || only if ");\
512 Terminal* term__ = TERMINAL;\
513 PRINTOUT(" != " #INVERT); \
514 PRINTOUT(" ||"); \
515 MoveGuard* guard__ = new MoveGuard(term__, INVERT); \
516 tempMove = new Move(src__, dst__, *bus__, guard__);
517 */
518
519#define GUARDED_MOVE_CONSTRUCTION(ADFGUARD) \
520 TTAMachine::Guard &adfGuard__ = ADFGUARD; \
521 MoveGuard* guard__ = new MoveGuard(adfGuard__); \
522 tempMove = std::make_shared<Move>(src__, dst__, *bus__, guard__);
523
524
525/**
526 * Creates a guarded move and adds it to the instruction this macro is
527 * invoked in.
528 *
529 * Non-inverted version.
530 *
531 * @param SRC The source terminal.
532 * @param DST The destination terminal.
533 * @param GTERM The termimal that is watched by this guard.
534 #define GMOVE(SRC, DST, GTERM) \
535 MOVE_TEMPLATE(SRC, DST, GUARDED_MOVE_CONSTRUCTION(GTERM, false));
536 */
537
538#define GMOVE(SRC, DST, GUARD) \
539 MOVE_TEMPLATE(SRC, DST, GUARDED_MOVE_CONSTRUCTION(GUARD));
540
541/**
542 * Creates a guarded move and adds it to the instruction this macro is
543 * invoked in.
544 *
545 * Inverted version.s
546 *
547 * @param SRC The source terminal.
548 * @param DST The destination terminal.
549 * @param GTERM The termimal that is watched by this guard.
550 #define IGMOVE(SRC, DST, GTERM) \
551 MOVE_TEMPLATE(SRC, DST, GUARDED_MOVE_CONSTRUCTION(GTERM, true));
552*/
553
554/**
555 * Initializes the POM generator macros.
556 *
557 * This should be stated before using the above macros.
558 *
559 * @PROGRAM The name of the program.
560 * @MACHINE The target processor of the program.
561 */
562#define CREATE_PROGRAM(PROGRAM, MACHINE) \
563\
564 Application::initialize(); \
565 OperationPool operationPool; \
566 unsigned int currentIP__ = 0; \
567 currentIP__ = 0; \
568 unsigned int incrementOfIP__ = 1; \
569 incrementOfIP__ = 1; \
570 Procedure* proc = NULL;\
571 const AddressSpace& programSpace__ = \
572 *MACHINE.controlUnit()->addressSpace();\
573 Program PROGRAM(programSpace__);\
574 Program& program__ = PROGRAM; \
575 const Machine& machine__ = MACHINE;\
576 PRINTOUT("\n# program '" #PROGRAM "':\n")
577
578/**
579 * Creates a new procedure to add instructions to.
580 *
581 * Sets a label to the creation position.
582 */
583#define CREATE_PROCEDURE(PROCNAME) \
584 SET_LABEL(PROCNAME); \
585 Procedure* PROCNAME = \
586 new Procedure("proc_"#PROCNAME, programSpace__, LABEL(PROCNAME));\
587 program__.addProcedure(PROCNAME);\
588 proc = PROCNAME
589
590/**
591 * Frees the resources allocated by the POM generator macros.
592 *
593 * Currently does basically nothing. Code is there just to avoid compiler
594 * warnings/errors.
595 */
596#define END_PROGRAM \
597 int foooooO__ = 1; foooooO__++;\
598 PRINTOUT("\n# program ends\n")
599
600#endif

◆ BOOLGUARD

#define BOOLGUARD ( )
Value:
findBooleanGuard(machine__, false);\
PRINTOUT("boolguard")
TTAMachine::Guard & findBooleanGuard(const TTAMachine::Machine &machine, bool isInverted)

Returns RegisterGuard pointing to boolean register

Definition at line 379 of file POMGenMacros.hh.

◆ CONTROL_OPERAND

#define CONTROL_OPERAND (   OPERATION,
  OPNUM 
)
Value:
new TerminalFUPort( \
*machine__.controlUnit()->operation(#OPERATION), \
OPNUM);\
PRINTOUT(#OPERATION "." #OPNUM)
#define OPERATION(OPNAME)
Definition OSAL.hh:90

Creates a TerminalFUPort that writes to the GCU operand port, thus triggering a control flow operation.

Parameters
OPERATIONThe name of the operation to trigger.
OPNUMThe operand number.

Definition at line 297 of file POMGenMacros.hh.

◆ CREATE_PROCEDURE

#define CREATE_PROCEDURE (   PROCNAME)
Value:
SET_LABEL(PROCNAME); \
Procedure* PROCNAME = \
new Procedure("proc_"#PROCNAME, programSpace__, LABEL(PROCNAME));\
program__.addProcedure(PROCNAME);\
proc = PROCNAME
#define LABEL(LABEL_NAME)
#define SET_LABEL(LABEL_NAME)

Creates a new procedure to add instructions to.

Sets a label to the creation position.

Definition at line 584 of file POMGenMacros.hh.

◆ CREATE_PROGRAM

#define CREATE_PROGRAM (   PROGRAM,
  MACHINE 
)
Value:
\
Application::initialize(); \
OperationPool operationPool; \
unsigned int currentIP__ = 0; \
currentIP__ = 0; \
unsigned int incrementOfIP__ = 1; \
incrementOfIP__ = 1; \
Procedure* proc = NULL;\
const AddressSpace& programSpace__ = \
*MACHINE.controlUnit()->addressSpace();\
Program PROGRAM(programSpace__);\
Program& program__ = PROGRAM; \
const Machine& machine__ = MACHINE;\
PRINTOUT("\n# program '" #PROGRAM "':\n")

Creates a guarded move and adds it to the instruction this macro is invoked in.

Inverted version.s

Parameters
SRCThe source terminal.
DSTThe destination terminal.
GTERMThe 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.

577 :\n")

◆ END_PROGRAM

#define END_PROGRAM
Value:
int foooooO__ = 1; foooooO__++;\
PRINTOUT("\n# program ends\n")

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.

◆ GMOVE

#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.

Parameters
SRCThe source terminal.
DSTThe destination terminal.
GTERMThe 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.

◆ GUARDED_MOVE_CONSTRUCTION

#define GUARDED_MOVE_CONSTRUCTION (   ADFGUARD)
Value:
TTAMachine::Guard &adfGuard__ = ADFGUARD; \
MoveGuard* guard__ = new MoveGuard(adfGuard__); \
tempMove = std::make_shared<Move>(src__, dst__, *bus__, guard__);

Creation of guarded move.

Parameters
TERMINALThe terminal the guard should watch.
INVERTIs 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.

◆ IMM

#define IMM (   WIDTH,
  VALUE 
)
Value:
new TerminalImmediate(tempSimValue(WIDTH, VALUE)); \
PRINTOUT("#" #VALUE)
const string WIDTH
SimValue & tempSimValue(unsigned int bitWidth, SIntWord intValue)

Creates a TerminalImmediate by width and value.

Expects the creator to manage deallocation.

Parameters
WIDTHThe bit width of the value.
VALUEThe value of the immediate.

Definition at line 286 of file POMGenMacros.hh.

◆ IMM32

#define IMM32 (   VALUE)     IMM(32, VALUE)

A shortcut which creates a 32 bit TerminalImmediate.

Parameters
VALUEThe value of the immediate.

Definition at line 405 of file POMGenMacros.hh.

◆ INSTRUCTION

#define INSTRUCTION (   ADD_MOVES)
Value:
{\
Instruction* tempInstruction__ = new Instruction(); \
int moveCounter__ = 1; \
PRINTOUT("\t" << currentIP__ << ": ");\
ADD_MOVES; \
PRINTOUT("\n");\
proc->add(tempInstruction__); \
} currentIP__ += incrementOfIP__

Creates an instruction and adds it to a procedure.

Parameters
ADD_MOVESA (list of) move creation statement(s).

Definition at line 413 of file POMGenMacros.hh.

414{\
415 Instruction* tempInstruction__ = new Instruction(); \
416 int moveCounter__ = 1; \
417 PRINTOUT("\t" << currentIP__ << ": ");\
418 ADD_MOVES; \
419 PRINTOUT("\n");\
420 proc->add(tempInstruction__); \
421} currentIP__ += incrementOfIP__

◆ INVBOOLGUARD

#define INVBOOLGUARD ( )
Value:
findBooleanGuard(machine__, true);\
PRINTOUT("invboolguard")

Returns Inverted RegisterGuard pointing to boolean register

Definition at line 386 of file POMGenMacros.hh.

◆ IREG

#define IREG (   REGNUM)     REG(r, REGNUM)

Shortcut to an integer register in sequential code.

Parameters
REGNUMThe integer register index.

Definition at line 133 of file POMGenMacros.hh.

◆ LABEL

#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.

Parameters
LABEL_NAMEThe name of the label to refer to.

Definition at line 475 of file POMGenMacros.hh.

◆ MOVE

#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.

Parameters
SRCThe source terminal.
DSTThe destination terminal.

Definition at line 458 of file POMGenMacros.hh.

◆ MOVE_TEMPLATE

#define MOVE_TEMPLATE (   SRC,
  DST,
  CONSTRUCT_MOVE 
)
Value:
{\
Terminal* src__ = SRC;\
PRINTOUT(" -> "); \
Terminal* dst__ = DST;\
PRINTOUT(" "); \
Bus* bus__ = &findBus(\
machine__, std::string("bus") + Conversion::toString(moveCounter__));\
std::shared_ptr<Move> tempMove = nullptr; \
CONSTRUCT_MOVE;\
tempInstruction__->addMove(tempMove);\
} moveCounter__++;
TTAMachine::Bus & findBus(const TTAMachine::Machine &machine, std::string busName)
static std::string toString(const T &source)

A helper macro to create different types of moves.

Parameters
SRCThe source terminal.
DSTThe destination terminal.
MOVE_CONSTRUCTORA constructor of the move to create.

Definition at line 430 of file POMGenMacros.hh.

431{\
432 Terminal* src__ = SRC;\
433 PRINTOUT(" -> "); \
434 Terminal* dst__ = DST;\
435 PRINTOUT(" "); \
436 Bus* bus__ = &findBus(\
437 machine__, std::string("bus") + Conversion::toString(moveCounter__));\
438 std::shared_ptr<Move> tempMove = nullptr; \
439 CONSTRUCT_MOVE;\
440 tempInstruction__->addMove(tempMove);\
441} moveCounter__++;

◆ NOP

#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.

◆ OPERAND

#define OPERAND (   OPERATION,
  OPERAND_INDEX 
)     OPORT(OPERATION, OPERAND_INDEX, OPERATION)

A shortcut to an operand in sequential code.

Parameters
OPERATIONThe name of the operation.
OPERAND_INDEXIndex of the operand.

Definition at line 241 of file POMGenMacros.hh.

◆ OPORT

#define OPORT (   FUNAME,
  PORTNAME,
  OPERATION 
)
Value:
machine__, #FUNAME, #PORTNAME, #OPERATION);\
PRINTOUT(#FUNAME "." #OPERATION "." #PORTNAME)
TTAProgram::TerminalFUPort * createTerminalFUPort(const TTAMachine::Machine &machine, std::string fuName, std::string pName, std::string opName)

Creates a TerminalFUPort using the given name strings.

Parameters
FUNAMEThe function unit or operation name (in sequential).
PORTNAMEThe port name or operand index (in sequential).
OPERATIONThe name of the operation.

Definition at line 229 of file POMGenMacros.hh.

◆ PORT

#define PORT (   FUNAME,
  PORTNAME 
)
Value:
new TerminalFUPort( \
dynamic_cast<BaseFUPort&>( \
findFUPort(machine__, #FUNAME, #PORTNAME)));\
PRINTOUT(#FUNAME "." #PORTNAME)
TTAMachine::Port & findFUPort(const TTAMachine::Machine &machine, std::string fuName, std::string portName)

Creates a TerminalFUPort using the given name strings.

Parameters
FUNAMEThe function unit or operation name (in sequential).
PORTNAMEThe port name or operand index (in sequential).

Definition at line 216 of file POMGenMacros.hh.

◆ PRINTOUT

#define PRINTOUT (   STUFF)

define this to get the programs printed to stdout while they are contructed

Definition at line 73 of file POMGenMacros.hh.

◆ RA

#define RA ( )
Value:
new TerminalFUPort(\
dynamic_cast<BaseFUPort&>( \
*machine__.controlUnit()->returnAddressPort()));\
PRINTOUT("ra")

Creates a terminal pointing to the return address port of the GCU.

Definition at line 393 of file POMGenMacros.hh.

◆ REG

#define REG (   RFNAME,
  REGNUM 
)
Value:
new TerminalRegister(\
*findRegisterFile(machine__, #RFNAME).port(0), \
REGNUM);\
PRINTOUT(#RFNAME "" #REGNUM)
TTAMachine::RegisterFile & findRegisterFile(const TTAMachine::Machine &machine, std::string name)

Creates a TerminalRegister using the given register file and register.

Parameters
RFNAMEThe register file name (either 'r' or 'f' in sequential).
REGNUMThe index of the register.

Definition at line 123 of file POMGenMacros.hh.

◆ SET_IP

#define SET_IP (   VALUE)    currentIP__ = VALUE

Forces a new value to the instruction pointer.

Parameters
VALUEThe new value to assign to the instruction pointer counter.

Definition at line 495 of file POMGenMacros.hh.

◆ SET_IP_INCREMENT

#define SET_IP_INCREMENT (   COUNT)    incrementOfIP__ = COUNT

Sets the amount how much instruction pointer should be incremented after adding an instruction.

Parameters
COUNTThe increment.

Definition at line 503 of file POMGenMacros.hh.

◆ SET_LABEL

#define SET_LABEL (   LABEL_NAME)
Value:
PRINTOUT(#LABEL_NAME ":\n");\
unsigned int LABEL(LABEL_NAME) = currentIP__; \
LABEL(LABEL_NAME) = currentIP__;
#define PRINTOUT(STUFF)
define this to get the programs printed to stdout while they are contructed

Sets a label at the current instruction pointer position.

Using LABEL and SET_LABEL macros one can make implementing backward jumps easier.

Parameters
LABEL_NAMEThe name of the label to refer to.

Definition at line 485 of file POMGenMacros.hh.

486 :\n");\
487 unsigned int LABEL(LABEL_NAME) = currentIP__; \
488 LABEL(LABEL_NAME) = currentIP__;

Function Documentation

◆ createTerminalFUPort()

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.

163 {
164
166 TTAMachine::HWOperation *op = NULL;
167
168 if (fu.hasOperation(opName)) {
169 op = fu.operation(opName);
170 } else {
171 op = new TTAMachine::HWOperation(opName, fu);
172 }
173
174 int index = 0;
175
176 try {
177 index = Conversion::toInt(pName);
178 } catch ( ... ) {
179 index = op->io(*fu.operationPort(pName));
180 }
181
182 return new TTAProgram::TerminalFUPort(*op, index);
183}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
TTAMachine::FunctionUnit & findFunctionUnit(const TTAMachine::Machine &machine, std::string name)
static int toInt(const T &source)
virtual HWOperation * operation(const std::string &name) const
virtual FUPort * operationPort(const std::string &name) const
virtual bool hasOperation(const std::string &name) const
int io(const FUPort &port) const

References findFunctionUnit(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::HWOperation::io(), machine, TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationPort(), and Conversion::toInt().

Here is the call graph for this function:

◆ findBooleanGuard()

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.

Parameters
machineThe machine to search in.
isInvertedDo we look for inverted guard.
Returns
The found Guard

Definition at line 343 of file POMGenMacros.hh.

343 {
344
346
347 // go through all the register files in the machine
348 for (int i = 0; i < bus->guardCount(); ++i) {
349 TTAMachine::RegisterGuard *regGuard =
350 dynamic_cast<TTAMachine::RegisterGuard*>(bus->guard(i));
351
352 if (regGuard == NULL) {
353 continue;
354 }
355
356 if (regGuard->isInverted() == isInverted &&
357 regGuard->registerFile()->width() == 1 &&
358 regGuard->registerFile()->numberOfRegisters() == 1) {
359 return *regGuard;
360 }
361 }
362
363 // just to avoid compiler warnings
364 abortWithError("Can't find BooleanGuard!");
365 throw 1;
366}
#define abortWithError(message)
virtual int numberOfRegisters() const
virtual int width() const
Guard * guard(int index) const
Definition Bus.cc:456
int guardCount() const
Definition Bus.cc:441
virtual bool isInverted() const
ComponentType * item(int index) const
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
const RegisterFile * registerFile() const

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().

Here is the call graph for this function:

◆ findBooleanRegisterFile()

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.

Parameters
machineThe machine to search in.
Returns
The found register file.

Definition at line 312 of file POMGenMacros.hh.

312 {
313
316
317 // go through all the register files in the machine
318 for (int i = 0; i < navigator.count(); ++i) {
319 TTAMachine::RegisterFile& rf = *navigator.item(i);
320
321 // expect the boolean register to be the first register file with
322 // only one register of width 1
323 if (rf.width() == 1 && rf.numberOfRegisters() == 1) {
324 return rf;
325 }
326 }
327 // just to avoid compiler warnings
328 abortWithError("Can't find boolean register file from machine!.");
329 throw 1;
330}
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450

References abortWithError, TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::Machine::registerFileNavigator(), and TTAMachine::BaseRegisterFile::width().

Here is the call graph for this function:

◆ findBus()

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.

Parameters
machineThe machine to search in.
busNameThe name of the bus. Unused in case of UniversalMachine.
Returns
The found bus.

Definition at line 269 of file POMGenMacros.hh.

269 {
270 if (dynamic_cast<const UniversalMachine*>(&machine) != NULL) {
271 return dynamic_cast<const UniversalMachine&>(machine).universalBus();
272 } else {
274 return *nav.item(busName);
275 }
276}

References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and machine.

Here is the call graph for this function:

◆ findFunctionUnit()

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.

Parameters
machineThe machine to search in.
nameThe name of the function unit. Can be empty in sequential.
Returns
The found register file.

Definition at line 146 of file POMGenMacros.hh.

146 {
147 if (dynamic_cast<const UniversalMachine*>(&machine) != NULL) {
148 return dynamic_cast<const UniversalMachine&>(
149 machine).universalFunctionUnit();
150 } else {
153 return *nav.item(name);
154 }
155}
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380

References TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and machine.

Referenced by createTerminalFUPort(), and findFUPort().

Here is the call graph for this function:

◆ 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.

Parameters
machineThe machine to search in.
fuNameThe name of the function unit. The operation, if sequential.
portNameThe name of the port. The operand, if sequential code.
Returns
The found port.

Definition at line 196 of file POMGenMacros.hh.

199 {
200
201 if (dynamic_cast<const UniversalMachine*>(&machine) != NULL) {
202 return *dynamic_cast<const UniversalMachine&>(machine).
203 universalFunctionUnit().operation(fuName)->port(
204 Conversion::toInt(portName));
205 } else {
206 return *findFunctionUnit(machine, fuName).port(portName);
207 }
208}
virtual BaseFUPort * port(const std::string &name) const

References findFunctionUnit(), machine, TTAMachine::FunctionUnit::port(), and Conversion::toInt().

Here is the call graph for this function:

◆ findRegisterFile()

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.

Parameters
machineThe machine to search in.
nameThe name of the register file.
Returns
The found register file.

Definition at line 94 of file POMGenMacros.hh.

94 {
95
96 if (dynamic_cast<const UniversalMachine*>(&machine) != NULL) {
97 if (StringTools::ciEqual(name, "r")) {
98 return dynamic_cast<const UniversalMachine&>(
99 machine).integerRegisterFile();
100 } else
101 if (StringTools::ciEqual(name, "f")) {
102 return dynamic_cast<const UniversalMachine&>(
103 machine).doubleRegisterFile();
104 }
105 abortWithError(std::string("No register file ") + name + " found.");
106 } else {
109 return *nav.item(name);
110 }
111
112 abortWithError("Can't find register file " + name);
113 // just to avoid compiler warnings
114 throw 1;
115}
static bool ciEqual(const std::string &a, const std::string &b)

References abortWithError, StringTools::ciEqual(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, and TTAMachine::Machine::registerFileNavigator().

Here is the call graph for this function:

◆ null__()

void null__ ( )

A procedure that does nothing.

Definition at line 81 of file POMGenMacros.hh.

81 {
82}

◆ tempSimValue()

SimValue & tempSimValue ( unsigned int  bitWidth,
SIntWord  intValue 
)

Creates a temporary SimValue to be used in TerminalImmediate construction.

Parameters
bitWidthThe bit width of the SimValue.
intValueThe integer value of the SimValue.
Returns
A SimValue reference (owned by the function).

Definition at line 252 of file POMGenMacros.hh.

252 {
253 delete temporary;
254 temporary = new SimValue(bitWidth);
255 *temporary = intValue;
256 return *temporary;
257}
SimValue * temporary

References temporary.

Variable Documentation

◆ temporary

SimValue* temporary = NULL

Definition at line 76 of file POMGenMacros.hh.

Referenced by EnableBPCommand::execute(), and tempSimValue().