Skip to content
Snippets Groups Projects
Commit 67bac169 authored by Hugues Cassé's avatar Hugues Cassé
Browse files

etime: small fix in AbstractTimeBuilder; added header for

StandardXGraphBuilder for customization.
parent 633ad434
No related branches found
No related tags found
No related merge requests found
/*
* StandardXGraphBuilder class interface
*
* This file is part of OTAWA
* Copyright (c) 2020, IRIT UPS.
*
* OTAWA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* OTAWA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OTAWA; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <otawa/etime/AbstractTimeBuilder.h>
namespace otawa { namespace etime {
class StandardXGraphBuilder: public XGraphBuilder {
public:
StandardXGraphBuilder(Monitor& mon);
ParExeGraph *build(ParExeSequence *seq) override;
protected:
inline string comment(string com) {
if(isExplicit())
return com;
else
return "";
}
virtual void createNodes(ParExeGraph *g, ParExeSequence *seq);
virtual void addEdgesForPipelineOrder(ParExeGraph *g, ParExeSequence *seq);
virtual void addEdgesForFetch();
virtual void addEdgesForProgramOrder();
virtual void addEdgesForMemoryOrder();
virtual void addEdgesForDataDependencies();
virtual void addEdgesForQueues();
virtual void init();
WorkSpace *_ws = nullptr;
int _cache_line_size = 0;
ParExeProc *_proc = nullptr;
ParExeStage *fetch_stage = nullptr;
ParExeStage *branch_stage = nullptr;
};
} } // otawa::etime
......@@ -135,6 +135,7 @@ Factory& Factory::def = elm::single<StandardFactory>();
* * @ref Engine object in charge of computing the execution considering all event configurations,
* * @ref Generator object in charge of generating objective function and ILP constraints to
* taken into account the different configurations and times.
* @ingroup etime
*/
......@@ -324,7 +325,7 @@ void AbstractTimeBuilder::buildResources(void) {
for(auto resource: _resources) {
if(resource->type() == Resource::STAGE) {
StageResource *sresource = static_cast<StageResource *>(resource);
if(sresource->stage() == queue->emptyingStage()) {
if(sresource->stage() <= queue->emptyingStage()) {
if(i < queue->size() - sresource->stage()->width() - 1) {
if(sresource->slot() == sresource->stage()->width() - 1)
upper_bound = sresource;
......
......@@ -19,12 +19,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <otawa/etime/AbstractTimeBuilder.h>
#include <otawa/etime/StandardXGraphBuilder.h>
namespace otawa { namespace etime {
/**
* @class TimeBuilder
* @class XGraphBuilder
* TODO
* @ingroup etime
*/
......@@ -99,19 +99,19 @@ void XGraphBuilder::configure(const PropList& props) {
/**
* @class StandardBuilder
* @class StandardXGraphBuilder
* ParExeGraph builder using the standard resources and microprocessor
* description to build the graph.
*
* @ingroup etime
*/
class StandardXGraphBuilder: public XGraphBuilder {
public:
StandardXGraphBuilder(Monitor& mon): XGraphBuilder(mon) {
///
StandardXGraphBuilder::StandardXGraphBuilder(Monitor& mon): XGraphBuilder(mon) {
}
ParExeGraph *build(ParExeSequence *seq) override {
///
ParExeGraph *StandardXGraphBuilder::build(ParExeSequence *seq) {
// build the graph
PropList props;
......@@ -130,14 +130,12 @@ public:
return g;
}
private:
/**
* Creates nodes in the graph: one node for each (instruction/pipeline_stage) pair.
* For the execution stage, creates as many nodes as stages in the pipeline of the required functional unit.
* TODO
*/
void createNodes(ParExeGraph *g, ParExeSequence *seq) {
void StandardXGraphBuilder::createNodes(ParExeGraph *g, ParExeSequence *seq) {
ParExeNode *last_node = nullptr;
ParExeNode *node;
......@@ -182,7 +180,7 @@ private:
/**
* TODO
*/
void addEdgesForPipelineOrder(ParExeGraph *g, ParExeSequence *seq) {
void StandardXGraphBuilder::addEdgesForPipelineOrder(ParExeGraph *g, ParExeSequence *seq) {
static string pipeline_order("pipeline order");
for(ParExeGraph::InstIterator inst(seq) ; inst() ; inst++){
ParExeNode *previous = NULL;
......@@ -196,19 +194,14 @@ private:
}
/**
* @fn string StandardXGraphBuilder::comment(string com);
* TODO
*/
inline string comment(string com) {
if(isExplicit())
return com;
else
return "";
}
/**
* TODO
*/
void addEdgesForFetch(void) {
void StandardXGraphBuilder::addEdgesForFetch(void) {
static string cache_trans_msg = "cache", cache_inter_msg = "line", branch_msg = "branch";
static string in_order = "in-order";
......@@ -274,7 +267,7 @@ private:
* @param list_of_stages List of stages that process nodes in order
* (if an empty pointer is passed, one is created containing the in-order-scheduled stages).
*/
void addEdgesForProgramOrder(void){
void StandardXGraphBuilder::addEdgesForProgramOrder(void){
static string program_order("program order");
// select list of in-order stages
......@@ -310,7 +303,7 @@ private:
* Adds edges to represent contention to access memory, basically, between FUs
* of instructions performing memory access.
*/
void addEdgesForMemoryOrder(void) {
void StandardXGraphBuilder::addEdgesForMemoryOrder(void) {
static string memory_order = "memory order";
// !!HUG!! Memory stage?
......@@ -372,7 +365,7 @@ private:
* produces content of a register and instruction (b) uses this register value
* create a solid edge between their execute stages.
*/
void addEdgesForDataDependencies(void){
void StandardXGraphBuilder::addEdgesForDataDependencies(void){
static string data = "data";
ParExeStage *exec_stage = _proc->execStage();
......@@ -411,7 +404,7 @@ private:
* Called to add edges representing contention on the different
* queues of the microprocessor.
*/
void addEdgesForQueues(void){
void StandardXGraphBuilder::addEdgesForQueues(void){
for (ParExePipeline::StageIterator stage(_proc->pipeline()) ; stage() ; stage++) {
ParExeStage * prod_stage;
if (stage->sourceQueue() != NULL) {
......@@ -429,7 +422,7 @@ private:
/**
* Prepare data useful to build the graph.
*/
void init(void) {
void StandardXGraphBuilder::init(void) {
// initialize cache size
if(_ws != workspace()) {
......@@ -449,13 +442,6 @@ private:
}
}
WorkSpace *_ws = nullptr;
int _cache_line_size = 0;
ParExeProc *_proc = nullptr;
ParExeStage *fetch_stage = nullptr;
ParExeStage *branch_stage = nullptr;
};
/**
* TODO
......
......@@ -341,6 +341,21 @@ void StepGraphBuilder::CircularQueue::reset() {
array::set(ns, s, static_cast<ParExeNode *>(nullptr));
}
///
StepGraphBuilder::Stage::Stage() {
}
///
StepGraphBuilder::Stage::Stage(const Stage& s): CircularQueue(s) {
st = s.st;
}
///
void StepGraphBuilder::Stage::configure(ParExeStage *st) {
this->st = st;
CircularQueue::configure(st->width());
}
///
StepGraphBuilder::ProcQueue::ProcQueue() {
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment