INSTRUCTIONS_TYPES Class Reference


Detailed Description

This class describes a generic instruction, used by the class ARCHITECTURE to describe an ISA. A generic instruction object contains opcode, unique id per opcode, string opcode, list of writtent registers, list of written register types, etc.

Author:
Sid Touati
Each node in a data dependence graph corresponds to an instruction instance or to an operation. The generic instruction defined by the ISA is defined by the class INSTRUCTIONS_TYPES. A generic instruction is defined by a unique id, an opcode (of type string) and a flag saying if the instances of such generic instruction write into a register.

To each node in a DAG or in a LOOP, we associate an attribute of type INSTRUCTIONS_TYPES describing its generic instruction description. A generic instruction has the following attributes:

The user can construct its own ISA as explained in User Defined Instruction Set Architectures (XML format).

Examples:

dag_example.cpp, loop_example.cpp, and RS_example.cpp.

Definition at line 62 of file instructions_types.h.


Public Member Functions

Creation


 INSTRUCTIONS_TYPES ()
 Constructor by default. Build a generic instruction of type "add_op" by default, and gives it a null opcode id, and sets a flag saying that such instruction writes into a register. Reading and writing delays are set to zero. Latency set to 1.
 ~INSTRUCTIONS_TYPES ()
 INSTRUCTIONS_TYPES (std::string sopcode, int id)
 INSTRUCTIONS_TYPES (const char *sopcode, int id)
 INSTRUCTIONS_TYPES (const char *sopcode, int id, int latency)
 INSTRUCTIONS_TYPES (std::string sopcode, int id, int latency)
 INSTRUCTIONS_TYPES (const INSTRUCTIONS_TYPES &it)
Access Operations


int opcode_id () const
 Returns the integer id that defines the instruction type.
int delta_r () const
 Returns $ \delta_r $ the architecturally visible latency of reading from a register (in processor clock cycles).
int delta_w (int regtype_id) const
 Returns $ \delta_w $ the architecturally visible latency of writing into a register (in processor clock cycles).
int latency () const
 Returns the latency of the instruction type (in processor clock cycles).
std::string opcode () const
 Returns the string opcode of the instruction type.
const char * opcode_str () const
 Returns the string opcode of the instruction type.
bool is_value () const
 Returns true if instruction type writes into a register of any type.
leda::list< int > get_list_reg_id ()
 Returns the list of the id of the register types written by this generic instruction.
leda::list< int > get_list_regtypes_id () const
 Same as get_list_reg_id().
int nb_write_reg () const
 Returns the number of written register types.
bool is_value (int t) const
 Returns true if instruction type writes into a register of type t.
bool does_write_into_reg () const
 An alias of the method is_value(). Returns true if the instruction type writes into a register.
bool does_write_into_reg (int regtype_id) const
 Returns true if the instruction type writes into a register of a given type.
bool check () const
 This method makes a simple check of the consistancy of the object. Returns true if OK, false otherwise.
Update Operations


void set_opcode_id (const int &theValue)
 Sets the opcode id.
void set_opcode (const std::string &theValue)
 Sets the string opcode of the instruction type.
void set_delta_r (int dr_value)
 Sets $ \delta_r $ the architecturally visible latency of reading from a register (in processor clock cycles).
bool set_delta_w (int regtype_id, int dw_value)
 Sets $ \delta_w $ the architecturally visible latency of writing into a register (in processor clock cycles).
void set_latency (int latency_value)
 Sets the latency of the instruction type (in processor clock cycles).
void add_write_reg_id (int t)
 Add a written register type given by its id.
void add_write_reg_id (int regtype_id, int deltaw)
 Add a written register type given by its id and sets $ \delta_w $.

Friends

Input/Output stream operations


ostream & operator<< (ostream &os, INSTRUCTIONS_TYPES x)
istream & operator>> (istream &is, INSTRUCTIONS_TYPES &x)

Related Functions

(Note that these are not member functions.)

bool operator== (INSTRUCTIONS_TYPES a, INSTRUCTIONS_TYPES b)

Constructor & Destructor Documentation

INSTRUCTIONS_TYPES ( std::string  sopcode,
int  id 
)

Constructor with two arguments.

Parameters:
[in] sopcode The string of the opcode, such as "load_op", "store_op", etc.
[in] id A (unique) opcode id defining the instruction. Reading and writing delays are set to zero.

INSTRUCTIONS_TYPES ( const char *  sopcode,
int  id 
)

Constructor with two arguments.

Parameters:
[in] sopcode The string (of type char *) of the opcode, such as "load_op", "store_op", etc.
[in] id A (unique) opcode id defining the instruction. Reading and writing delays are set to zero.

INSTRUCTIONS_TYPES ( const char *  sopcode,
int  id,
int  latency 
)

Constructor with three arguments.

Parameters:
[in] sopcode The string (of type char *) of the opcode, such as "load_op", "store_op", etc.
[in] id A (unique) opcode id defining the instruction.
[in] latency The latency of the instruction type (in processor clock cycles).

INSTRUCTIONS_TYPES ( std::string  sopcode,
int  id,
int  latency 
)

Constructor with three arguments.

Parameters:
[in] sopcode The string (of type std::string) of the opcode, such as "ld_op", "st_op", etc.
[in] id A (unique) opcode id defining the instruction.
[in] latency The latency of the instruction type (in processor clock cycles).


Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
INSTRUCTIONS_TYPES  x 
) [friend]

Output stream of the INSTRUCTIONS_TYPES attribute. Print all INSTRUCTIONS_TYPES attributes in the form : string_opcode, opcode_id, latency, $ \delta_r $, $ \delta_w $, does_write_into_reg?

istream& operator>> ( istream &  is,
INSTRUCTIONS_TYPES x 
) [friend]

Input stream of the INSTRUCTIONS_TYPES. Read all INSTRUCTIONS_TYPES attributes in the following order : string_opcode, opcode_id, latency, $ \delta_r $, $ \delta_w $, does_write_into_reg?

bool operator== ( INSTRUCTIONS_TYPES  a,
INSTRUCTIONS_TYPES  b 
) [related]

Returns True if two INSTRUCTIONS_TYPES objects are assumed equal : they are "equal" if they have the same opcode identifier.


January 2009, by Sid Touati (Copyright INRIA and University of Versailles)