23 #ifndef _PARAM_EXEGRAPH_H_
24 #define _PARAM_EXEGRAPH_H_
28 #include <elm/util/BitVector.h>
32 #define INFINITE_TIME 0x0FFFFFF
114 int upper_bound_offset)
307 {(*
_d[bound])[index] = value;}
314 (*
_d[ExeGraph<ParamExeNode>::MIN])[index] = 0;
337 if ( (*
_delay[bound])[index] != delay ) {
338 (*
_delay[bound])[index] = delay;
343 (*_contention_dep)[
index] =
true;
368 : ExeNode(graph, stage, inst), _graph((
ParamExeGraph *)graph) {
372 for (
int j=0 ; j<ExeGraph<ParamExeNode>::BOUNDS ; j++) {
380 for (
int j=0 ; j<ExeGraph<ParamExeNode>::BOUNDS ; j++) {
385 for (
int j=0 ; j<ExeGraph<ParamExeNode>::BOUNDS ; j++)
391 (*_contention_dep)[k] =
false;
413 int resource_index = 0;
423 int _last_stage_index = 0;
424 int _operand_producing_stage_index;
425 for (PipelineIterator stage(microprocessor) ; stage ; stage++) {
427 _operand_producing_stage_index = _last_stage_index;
431 int _stage_index = 0;
432 for (PipelineIterator stage(microprocessor) ; stage ; stage++) {
433 if (! stage->usesFunctionalUnits()) {
435 for (
int i=0 ; i<stage->width() ; i++) {
437 buffer << stage->name() <<
"[" << i <<
"]";
444 for(FunctionalUnitIterator fu(stage); fu; fu++) {
445 for (
int i=0 ; i<fu->width() ; i++) {
447 buffer << fu->name() <<
"[" << i <<
"]";
458 int num = queue->size();
459 if (num > sequence->
count())
460 num = sequence->
count();
461 for (
int i=0 ; i<num ; i++) {
463 buffer << queue->name() <<
"[" << i <<
"]";
464 int _i = 0, _empty_i;
466 if (stage == queue->emptyingStage())
471 int upper_bound_offset;
473 if (resource->type() ==
STAGE) {
474 if (((
StageResource *)(*resource))->stage() == queue->emptyingStage()) {
478 upper_bound_offset = (queue->size() - i) / ((
StageResource *)(*resource))->stage()->width();
484 upper_bound_offset = 0;
492 _last_stage_index - _empty_i, upper_bound, upper_bound_offset);
498 int reg_bank_count = pf->
banks().count();
499 for(
int i = 0; i <reg_bank_count ; i++) {
501 inputs[i]._is_input =
503 inputs[i]._resource_index =
505 for (
int j=0 ; j<inputs[i].reg_bank->count() ; j++) {
506 inputs[i]._is_input->set(j,
true);
507 inputs[i]._resource_index->set(j,-1);
512 for(
int i = 0; i < reads.count(); i++) {
513 for (
int b=0 ; b<reg_bank_count ; b++) {
514 if (inputs[b].reg_bank == reads[i]->bank()) {
515 if (inputs[b]._is_input->get(reads[i]->number()) ==
true) {
516 if (inputs[b]._resource_index->get(reads[i]->number()) == -1) {
519 buffer << reads[i]->bank()->name() << reads[i]->number();
521 _last_stage_index - _operand_producing_stage_index);
524 inputs[b]._resource_index->set(reads[i]->number(),
_resources.length()-1);
534 for(
int i = 0; i < writes.count(); i++) {
535 for (
int b=0 ; b<reg_bank_count ; b++) {
536 if (inputs[b].reg_bank == writes[i]->bank()) {
537 inputs[b]._is_input->set(writes[i]->number(),
false);
546 buffer <<
"extconf[" << i <<
"]";
551 another_buffer <<
"intconf[" << i <<
"]";
577 #endif //_PARAM_EXEGRAPH_H_
struct otawa::sem::inst inst
struct otawa::ParamExeGraph::input_t input_t
int regIndex()
Definition: ParamExeGraph.h:147
This class represents a bank of registers.
Definition: Register.h:68
int _late_contenders
Definition: ParamExeGraph.h:268
Queue< ParamExeNode > * _queue
Definition: ParamExeGraph.h:103
bool isContender(int index)
Definition: ParamExeGraph.h:282
virtual void propagate()
Definition: exegraph_ParamExeGraph.cpp:391
void setContentionDelay(ExeGraph< ParamExeNode >::time_bound_t bound, int delay)
Definition: ParamExeGraph.h:352
otawa::hard::RegBank * _reg_bank
Definition: ParamExeGraph.h:133
int slot()
Definition: ParamExeGraph.h:98
int resourceCount()
Definition: ParamExeGraph.h:226
#define EPSILON
Definition: ParamExeGraph.h:560
void setDelay(int index, ExeGraph< ParamExeNode >::time_bound_t bound, int delay)
Definition: ParamExeGraph.h:336
int _slot
Definition: ParamExeGraph.h:88
elm::genstruct::Vector< Resource * > _resources
Definition: ParamExeGraph.h:200
int _reg_index
Definition: ParamExeGraph.h:134
Definition: ParamExeGraph.h:159
ResourceIterator(const ParamExeGraph *graph)
Definition: ParamExeGraph.h:237
resource_type_t type()
Definition: ParamExeGraph.h:56
ExternalConflictIterator(const ParamExeGraph *graph)
Definition: ParamExeGraph.h:247
int contentionDelay(ExeGraph< ParamExeNode >::time_bound_t bound)
Definition: ParamExeGraph.h:334
Definition: ParamExeGraph.h:253
Definition: ParamExeGraph.h:39
int _max_contention_delay
Definition: ParamExeGraph.h:258
int res_dep_impact[RES_TYPE_NUM]
Definition: ParamExeGraph.h:209
int d(int index)
Definition: ParamExeGraph.h:301
int _capacity
Definition: ParamExeGraph.h:199
int _internal_delay[ExeGraph< ParamExeNode >::BOUNDS]
Definition: ParamExeGraph.h:263
int slot()
Definition: ParamExeGraph.h:82
elm::genstruct::AllocatedTable< int > * _delay[ExeGraph< ParamExeNode >::BOUNDS]
Definition: ParamExeGraph.h:262
int countBits(void) const
bool res_dep[RES_TYPE_NUM]
Definition: ParamExeGraph.h:208
int _min_contention_delay
Definition: ParamExeGraph.h:259
InternalConflictIterator(const ParamExeGraph *graph)
Definition: ParamExeGraph.h:242
otawa::hard::RegBank * regBank()
Definition: ParamExeGraph.h:145
virtual void analyzeContentions()
Definition: exegraph_ParamExeGraph.cpp:199
Definition: ParamExeGraph.h:245
void setMinContentionDelay(int value)
Definition: ParamExeGraph.h:326
elm::genstruct::Vector< N * > _contenders
Definition: ExeGraph.h:154
Definition: ParamExeGraph.h:39
int _upper_bound_offset
Definition: ParamExeGraph.h:106
RegResource(elm::String name, otawa::hard::RegBank *reg_bank, int reg_index, int index, int offset)
Definition: ParamExeGraph.h:136
void addUsingInst(ExeInst< ParamExeNode > *inst)
Definition: ParamExeGraph.h:149
elm::String _name
Definition: ParamExeGraph.h:47
StageResource * _upper_bound
Definition: ParamExeGraph.h:105
int d(int index, ExeGraph< ParamExeNode >::time_bound_t bound)
Definition: ParamExeGraph.h:299
int _offset
Definition: ParamExeGraph.h:50
int latestResourceIndex()
Definition: ParamExeGraph.h:232
int delay(int index, ExeGraph< ParamExeNode >::time_bound_t bound)
Definition: ParamExeGraph.h:328
#define INFINITE_TIME
Definition: ParamExeGraph.h:32
bool contentionDep(int index)
Definition: ParamExeGraph.h:330
elm::genstruct::SLList< ParamExeGraph::InternalConflictResource * > _contenders_list
Definition: ParamExeGraph.h:265
void dumpSimple(elm::io::Output &dotFile)
Definition: exegraph_ParamExeGraph.cpp:601
void buildContendersMasks()
Definition: exegraph_ParamExeGraph.cpp:275
void clearTimesChanged()
Definition: ParamExeGraph.h:218
int instructionCount()
Definition: ParamExeGraph.h:228
Definition: ParamExeGraph.h:235
bool _has_pred
Definition: ParamExeGraph.h:205
int minContentionDelay()
Definition: ParamExeGraph.h:324
void setD(int index, int value, ExeGraph< ParamExeNode >::time_bound_t bound)
Definition: ParamExeGraph.h:306
int _resource_count
Definition: ParamExeGraph.h:198
bool hasContenders()
Definition: ParamExeGraph.h:297
elm::genstruct::AllocatedTable< bool > * _contention_dep
Definition: ParamExeGraph.h:261
virtual hard::Platform * platform(void)
Definition: WorkSpace.h:75
int _slot
Definition: ParamExeGraph.h:71
ExeInst< ParamExeNode > * instruction()
Definition: ParamExeGraph.h:185
PipelineStage< N > * pipelineStage(void)
Definition: ExeGraph.h:167
Definition: ParamExeGraph.h:39
Graph * graph(void) const
Get the container graph if any.
Definition: Graph.h:75
elm::BitVector * _possible_contenders
Definition: ParamExeGraph.h:266
int internalDelay(ExeGraph< ParamExeNode >::time_bound_t bound)
Definition: ParamExeGraph.h:332
Resource(elm::String name, resource_type_t type, int index, int offset)
Definition: ParamExeGraph.h:52
Definition: ParamExeGraph.h:153
PipelineStage< ParamExeNode > * _stage
Definition: ParamExeGraph.h:70
int _contention_delay[ExeGraph< ParamExeNode >::BOUNDS]
Definition: ParamExeGraph.h:264
ParamExeNode(ExeGraph< ParamExeNode > *graph, PipelineStage< ParamExeNode > *stage, ExeInst< ParamExeNode > *inst)
Definition: ParamExeGraph.h:364
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
class ParamExeNode Node
Definition: ParamExeGraph.h:38
int _index
Definition: ParamExeGraph.h:49
elm::genstruct::Vector< Resource * > _internal_conflicts
Definition: ParamExeGraph.h:201
Definition: ParamExeGraph.h:85
QueueResource(elm::String name, Queue< ParamExeNode > *queue, int slot, int index, int offset, StageResource *upper_bound, int upper_bound_offset)
Definition: ParamExeGraph.h:108
Definition: ParamExeGraph.h:36
elm::genstruct::SLList< ParamExeGraph::InternalConflictResource * > * conflictList()
Definition: ParamExeGraph.h:291
Queue< ParamExeNode > * queue()
Definition: ParamExeGraph.h:121
PipelineStage< N > * operandProducingStage(void)
Definition: Microprocessor.h:314
PipelineStage< ParamExeNode > * stage()
Definition: ParamExeGraph.h:80
InternalConflictResource(elm::String name, ExeInst< ParamExeNode > *instruction, int index, int offset)
Definition: ParamExeGraph.h:178
Definition: ParamExeGraph.h:130
ParamExeNode * node()
Definition: ParamExeGraph.h:189
virtual int cost()
Definition: exegraph_ParamExeGraph.cpp:134
void set(int index) const
Definition: ParamExeGraph.h:68
void setContender(int index)
Definition: ParamExeGraph.h:284
resource_type_t _type
Definition: ParamExeGraph.h:48
inst(void)
Definition: inst.h:118
PipelineStage< ParamExeNode >::FunctionalUnit * fu()
Definition: ParamExeGraph.h:96
FuResource(elm::String name, PipelineStage< ParamExeNode >::FunctionalUnit *fu, int slot, int index, int offset)
Definition: ParamExeGraph.h:90
void setStageNumber(int number)
Definition: ParamExeGraph.h:293
Definition: ParamExeGraph.h:45
bool e(int index)
Definition: ParamExeGraph.h:303
void setMaxContentionDelay(int value)
Definition: ParamExeGraph.h:322
Definition: ParamExeGraph.h:39
PipelineStage< ParamExeNode >::FunctionalUnit * _fu
Definition: ParamExeGraph.h:87
void setLateContenders(int num)
Definition: ParamExeGraph.h:278
elm::BitVector * possibleContenders()
Definition: ParamExeGraph.h:274
elm::genstruct::Vector< Resource * > _external_conflicts
Definition: ParamExeGraph.h:202
An instruction represented in an ExeGraph.
Definition: ExeGraph.h:49
Definition: ParamExeGraph.h:173
void setInternalDelay(ExeGraph< ParamExeNode >::time_bound_t bound, int delay)
Definition: ParamExeGraph.h:346
An execution graph that expresses precedence constraints on the execution of a sequence of instructio...
Definition: ExeGraph.h:40
void dump(elm::io::Output &dotFile)
Definition: exegraph_ParamExeGraph.cpp:439
StageResource(elm::String name, PipelineStage< ParamExeNode > *stage, int slot, int index, int offset)
Definition: ParamExeGraph.h:73
virtual int Delta(ParamExeNode *a, Resource *res)
Definition: exegraph_ParamExeGraph.cpp:28
void setD(int index, int value)
Definition: ParamExeGraph.h:308
resource_type_t
Definition: ParamExeGraph.h:39
ParamExeNode * _node
Definition: ParamExeGraph.h:176
elm::String name()
Definition: ParamExeGraph.h:54
void addConflict(ParamExeGraph::InternalConflictResource *conflict)
Definition: ParamExeGraph.h:289
void initContenders(int size)
Definition: ParamExeGraph.h:280
bool timesChanged()
Definition: ParamExeGraph.h:222
int offset()
Definition: ParamExeGraph.h:60
ExeInst< ParamExeNode > * instruction()
Definition: ParamExeGraph.h:170
Definition: Microprocessor.h:65
ExeInst< ParamExeNode > * _instruction
Definition: ParamExeGraph.h:161
Definition: ParamExeGraph.h:39
void setNode(ParamExeNode *node)
Definition: ParamExeGraph.h:187
Definition: ParamExeGraph.h:240
Definition: ParamExeGraph.h:39
ExeInst< N > * inst(void)
Definition: ExeGraph.h:169
elm::String delayName(int delay)
Definition: ParamExeGraph.h:561
int index(void) const
Definition: GenGraph.h:51
Definition: ParamExeGraph.h:39
int slot()
Definition: ParamExeGraph.h:123
elm::genstruct::AllocatedTable< int > * _d[ExeGraph< ParamExeNode >::BOUNDS]
Definition: ParamExeGraph.h:256
Definition: ParamExeGraph.h:101
Definition: ParamExeGraph.h:63
int upperBoundOffset()
Definition: ParamExeGraph.h:127
int _latest_resource_index
Definition: ParamExeGraph.h:203
StageResource * upperBound()
Definition: ParamExeGraph.h:125
int index()
Definition: ParamExeGraph.h:58
virtual void initDelays()
Definition: exegraph_ParamExeGraph.cpp:310
ExeInst< ParamExeNode > * _instruction
Definition: ParamExeGraph.h:175
int stageNumber()
Definition: ParamExeGraph.h:295
void setTimesChanged()
Definition: ParamExeGraph.h:220
int _stage_number
Definition: ParamExeGraph.h:260
elm::genstruct::Vector< ExeInst< ParamExeNode > * > _using_instructions
Definition: ParamExeGraph.h:132
int _slot
Definition: ParamExeGraph.h:104
Iterator(const Vector &vec)
void setE(int index, bool value)
Definition: ParamExeGraph.h:310
UsingInstIterator(const RegResource *res)
Definition: ParamExeGraph.h:155
ParamExeGraph(WorkSpace *fw, Microprocessor< ParamExeNode > *microprocessor, ExeSequence< ParamExeNode > *sequence, bool has_pred, Trace *_trace)
Definition: ParamExeGraph.h:404
ExternalConflictResource(elm::String name, ExeInst< ParamExeNode > *instruction, int index, int offset)
Definition: ParamExeGraph.h:163
int _last_resource_index
Definition: ParamExeGraph.h:204
elm::genstruct::SLList< elm::BitVector * > * contendersMasksList()
Definition: ParamExeGraph.h:272
int lateContenders()
Definition: ParamExeGraph.h:276
elm::genstruct::SLList< elm::BitVector * > _contenders_masks_list
Definition: ParamExeGraph.h:267
GenGraph< ParamExeNode, typename ExeGraph< ParamExeNode >::ExeEdge > * graph()
Definition: ExeGraph.h:225
void setContentionDep(int index)
Definition: ParamExeGraph.h:342
Trace * _trace
Definition: ParamExeGraph.h:194
int analyze()
Definition: exegraph_ParamExeGraph.cpp:413
ParamExeGraph * _graph
Definition: ParamExeGraph.h:255
int maxContentionDelay()
Definition: ParamExeGraph.h:320
bool _times_changed
Definition: ParamExeGraph.h:197
int contendersNumber()
Definition: ParamExeGraph.h:286
elm::genstruct::Vector< ParamExeNode * > _contending_nodes
Definition: ParamExeGraph.h:207
StartResource(elm::String name, int index, int offset)
Definition: ParamExeGraph.h:65
Definition: ParamExeGraph.h:39
ExeSequence< ParamExeNode > * _sequence
Definition: ParamExeGraph.h:206
int length()
Definition: ExeGraph.h:98