Next: , Previous: , Up: Instruction Class Set Definition   [Contents][Index]


4.4.5 Setting the Number of States

Every node of a multinode model has a certain number of states, one of which is current node state. Current state of a node is changed automatically according to the input from the instruction execution environment. The input is conveyed in the form of an identifier of the last invoked instruction, an outcome of that instruction, and the contents of the look-ahead signal segment if the multinode model uses this segment.

A prerequisite for the synthesis of an assembler program of tolerable quality for a node is that the node must have a sufficient number of states. At the same time, the more states a node has the more instructions need to be executed by the node for the synthesis of an assembler program of tolerable quality.

When creating a node, its number of states is inherited from the number of states specified for a node class the node belongs to. The node class is represented by an instruction class set. The number of states specified for a node class is the default number of states for newly created nodes and, at the same time, the maximum allowed number of states of nodes of the node class. After creating a node, its number of states can be changed to a value less than the maximum allowed one.

To retrieve or set the maximum number of states for a node class, which is also the default number of states for newly created nodes that belong to the node class, the following functions can be used.

Function: int qsmm_get_nstate_max (qsmm_t model, const char *instr_class_set_name)

This function returns the maximum allowed number of states of nodes that belong to a node class of a multinode model specified by handle model. The returned number is also the default number of states of newly created nodes that belong to the node class.

The node class is represented by instruction class set instr_class_set_name.

On success, a positive value is returned. On failure, a negative error code is returned. Currently, the following error codes can be returned.

QSMM_ERR_NOTFOUND

Instruction class set instr_class_set_name does not exist.

QSMM_ERR_TYPE

An entity named instr_class_set_name is not an instruction class set. The entity is an instruction meta-class.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation.

Function: int qsmm_set_nstate_max (qsmm_t model, const char *instr_class_set_name, int nstate)

This function sets the maximum allowed number of states of nodes, which belong to a node class of a multinode model specified by handle model, to nstate. That number will also be the default number of states of newly created nodes that belong to the node class.

The node class is represented by instruction class set instr_class_set_name.

The function returns a non-negative value on success or a negative error code on failure. Currently, the following error codes can be returned.

QSMM_ERR_INVAL

The value of nstate is less than 2.

QSMM_ERR_NOTFOUND

Instruction class set instr_class_set_name does not exist.

QSMM_ERR_TYPE

An entity named instr_class_set_name is not an instruction class set. The entity is an instruction meta-class.

QSMM_ERR_VIOLAP

The model instance exists and the value of nstate is greater than the number of states of the environment state identification engine. When creating the model instance, that engine is created as having the number of states equal to the maximum value among maximum numbers of states specified using the function qsmm_set_nstate_max for instruction class sets registered for the multinode model.

QSMM_ERR_VIOLNODE

The value of nstate is less than the number of states of one or more already created nodes that belong to a node class represented by instruction class set instr_class_set_name.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation.

The default number of states for newly registered instruction class sets is equal to 2.


Next: , Previous: , Up: Instruction Class Set Definition   [Contents][Index]