All again,
ST also wants to propose to add an optional
priority value to the SystemC processes.
Rationale
---------
The idea behind a priority value per process is a help given by the
simulation to the scheduler to order processes execution that might help
the global performance of the simulation (by trying to reduce for
example the number of delta cycles). In any case, all runnable processes
will be run at the end of a delta cycle. Only the execution order might
be changed by different priority values. In particular, it could be used
to execute during the same delta cycle at first processes producing
data, and then processes consuming data. If consumer processes run
first, and then producer ones, the simulation shall provide similar
results, but the synchronization overhead might be higher.
We provide the various modifications of the norm below:
* In chapter 4.2.1.2 Evaluation phase:
Instead of
----------
The order in which process instances are selected from the set of
runnable processes is implementation defined. However, if a specific
version of a specific implementation runs a specific application using a
specific input data set, the order of process execution shall not vary
from run to run.
Specify as
----------
The order in which process instances are selected from the set of
runnable processes is implementation defined. *Each process is given a
priority value hint that an implementation is free to use or not for
ordering the process execution*. However, if a specific version of a
specific implementation runs a specific application using a specific
input data set, the order of process execution shall not vary from run
to run.
* In chapter 5.2 sc_module
Add new method& constant
-----------------------------
void set_priority(int);
#define SC_PRIORITY_LOW = implementation_defined;
(note: SC_PRIORITY_LOW could also be defined as a true C++
constant, depending on the constraints).
Add new chapter
------------------
5.2.23 void set_priority(int);
This subclause describes member function set_priority of class
sc_module, which sets the value of the priority of an unspawned process
instance during initialization. The value of the priority of a spawned
process is set by the member function set_priority of class
sc_spawn_options (see 5.5).
The priority of a process instance is a hint that the scheduler is free
to use or not in order to run processes during the evaluation phase
accordingly to their priority value. The range of priority values is
defined between 0, the highest priority value and SC_PRIORITY_LOW, the
lowest priority value. All priority values outside the 0..SC_PRIORITY
LOW value range are implementation defined. The initial priority value
of any process shall be set to SC_PRIORITY_LOW. The SC_PRIORITY_LOW
value shall be a positive integer.
set_priority shall only be called in the body of the constructor, in the
before_end_of_elaboration or end_of_elaboration callbacks of a module,
or in a member function called from the constructor or callback, and
only after having created an unspawned process instance within that same
constructor or callback.
The order of execution of the statements within the body of the
constructor or the before_end_of_elaboration or end_of_elaboration
callbacks is used to associate the call to set_priority with a
particular unspawned process instance; it is associated with the most
recently created unspawned process instance.
After a process has been started, the only way to change its priority is
through the set_priority method of its associated sc_process_instance.
* In chapter 5.5.2 Class definition
Add new method
------------------
void set_priority(int);
* In chapter 5.5.5 Member functions
Add new paragraph
--------------------
void set_priority(int);
Member function set_priority shall set a property of the spawn options
to set the initial priority value of the spawned process. This member
function shall provide the same behavior for spawned processes as the
member function set_priority of class sc_module provides for unspawned
processes. The actual priority value set is implementation defined if
outside the 0..SC_PRIORITY_LOW value range. The default priority value
of a newly created spawn option instance is SC_PRIORITY_LOW. After a
process has been started, the only way to change its priority is through
the set_priority method of its associated sc_process_instance.
* In chapter 5.6.2 Class definition
Add new methods
------------------
int get_priority(void);
int set_priority(int);
* In chapter 5.6.5 Member functions
Add new chapter
------------------
int get priority(void);
Member function get_priority shall return the current priority value of
the underlying process instance. If the process handle is invalid,
member function get_priority shall return -1. Notice that the priority
returned might be different from the one set last time set_priority has
been called if the priority set at last successful set_priority call was
outside the value range 0..SC_PRIORITY_LOW.
int set_priority(int);
Member function set_priority shall update the priority value of the
underlying process instance. If the process handle is invalid, member
function set_priority shall not modify anything, and return -1. If the
handle is valid, then the member function shall return the previous
priority of the underlying process. If the priority is outside the range
0..SC_PRIORITY_LOW, then the actual priority value set by this function
is implementation defined. Changing the priority of the current running
process shall not preempt it.
Jerome Cornet
STMicroelectronics
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Mar 10 06:23:52 2010
This archive was generated by hypermail 2.1.8 : Wed Mar 10 2010 - 06:23:52 PST