Skip to content
Snippets Groups Projects
Commit 05066edf authored by Bouquillon Fabien's avatar Bouquillon Fabien
Browse files

vulnerability and RMB LMB init change

parent b2cdbf51
No related branches found
No related tags found
No related merge requests found
Showing
with 1014 additions and 470 deletions
#cflags pour tout compiler
CXXFLAGS=`otawa-config otawa/display --cflags`
LDLIBS2=`otawa-config otawa/display otawa/classic_ecb otawa/ucb_otawa --libs`
CXXFLAGS += -std=c++11 -O0 -g -I /home/fabien/cristal/otawa/include/ -I ../otawa-core2-build/otawa/include/elm/ -I ../include
CXXFLAGS += -std=c++11 -O0 -g -I ../include
ARMCC=arm-none-eabi-gcc
......
......@@ -26,7 +26,6 @@ using namespace otawa::classic_ecb;
using namespace otawa::ucb_otawa;
using namespace Mathset;
// BIG ERROR !!!!
int main(int argc, char **argv) {
......
......@@ -9,18 +9,9 @@ LDLIBS2=`otawa-config otawa/display otawa/classic_ecb --libs`
ARMCC=arm-none-eabi-gcc
CXXFLAGS += -std=c++11 -O0 -g -I /home/fabien/cristal/otawa/include/ -I ../otawa-core2-build/otawa/include/elm/ -I ../include
CXXFLAGS += -std=c++11 -O0 -g -I ../include
all: clean classic_ecb.so install application binaire simple_code mpeg2
mpeg2: mpeg2.c
$(ARMCC) -nostdlib -nostdinc -static -o mpeg mpeg2.c
binaire: binaire.c
$(ARMCC) -nostdlib -nostdinc -static -o binaire binaire.c
simple_code: simple_code.c
$(ARMCC) -nostdlib -nostdinc -static -o simple_code simple_code.c
all: clean classic_ecb.so install application
##debut
application: application.o
......@@ -34,7 +25,7 @@ classic_ecb.so: classic_ecb.cpp include/classic_ecb.h
##fin
clean:
rm -f *.o application binaire simple_code *~ *.dot *.ps *.so
rm -f *.o application *~ *.dot *.ps *.so
install: classic_ecb.so
mkdir -p $(HOME)/.otawa/proc/otawa
......@@ -42,4 +33,4 @@ install: classic_ecb.so
cp classic_ecb.so $(HOME)/.otawa/proc/otawa/
.PHONY: all test clean graph
.PHONY: all clean
......@@ -84,7 +84,11 @@ namespace otawa {
struct Element<int> tmp_e;
tmp_e.elem = cache->line(lb->address());
// one block may erase a full cache
tmp_e.counter = cache->wayCount();
ecb_set.add_elem_struct(tmp_e);
/*
switch(status) {
case ALWAYS_HIT:
break;
......@@ -128,6 +132,7 @@ namespace otawa {
ecb_set.add_elem_struct(tmp_e);
break;
}
*/
}
}
}
......
#cflags pour tout compiler
CXXFLAGS=`otawa-config otawa/display --cflags`
CXXFLAGS=`otawa-config otawa/display otawa/etime --cflags`
#ldlibs pour compiler le plugin
LDLIBS=`otawa-config otawa/display --libs`
LDLIBS=`otawa-config otawa/display --libs` -Wl,-rpath,"/home/fabien/cristal/otawa/lib/otawa/otawa/"
#ldlibs pour compiler la application
LDLIBS2=`otawa-config otawa/display otawa/explo --libs`
#ldlibs pour compiler l'application
LDLIBS2=`otawa-config otawa/display otawa/etime --libs` -Wl,-rpath,"/home/fabien/cristal/otawa/lib/otawa/otawa/"
ARMCC=arm-none-eabi-gcc
CXXFLAGS += -std=c++11 -O0 -g -I ../otawa-core2-build/otawa/include/ -I ../otawa-core2-build/elm/include/ -I ../include/
CXXFLAGS += -std=c++11 -O0 -g3 -I ../otawa-core2-build/otawa/include/ -I ../otawa-core2-build/elm/include/ -I ../include/
all: clean explo.so install application binaire one_function loop condition large_code large_loop test_new_graph
all: clean explo.so install application large_loop
binaire: binaire.c
$(ARMCC) -nostdlib -nostdinc -static -o binaire binaire.c
# binaire: binaire.c
# $(ARMCC) -nostdlib -nostdinc -static -o binaire binaire.c
one_function: one_function.c
$(ARMCC) -nostdlib -nostdinc -static -o one_function one_function.c
# one_function: one_function.c
# $(ARMCC) -nostdlib -nostdinc -static -o one_function one_function.c
condition: condition.c
$(ARMCC) -nostdlib -nostdinc -static -o condition condition.c
# condition: condition.c
# $(ARMCC) -nostdlib -nostdinc -static -o condition condition.c
loop: loop.c
$(ARMCC) -nostdlib -nostdinc -static -o loop loop.c
# loop: loop.c
# $(ARMCC) -nostdlib -nostdinc -static -o loop loop.c
large_loop: large_loop.c
$(ARMCC) -nostdlib -nostdinc -static -o large_loop large_loop.c
one_function: one_function.c
$(ARMCC) -nostdlib -nostdinc -static -o one_function one_function.c
# large_loop_function: large_loop_function.c
# $(ARMCC) -nostdlib -nostdinc -static -o large_loop_function large_loop_function.c
large_code: large_code.c
$(ARMCC) -nostdlib -nostdinc -static -o large_code large_code.c
# one_function: one_function.c
# $(ARMCC) -nostdlib -nostdinc -static -o one_function one_function.c
test_new_graph: test_new_graph.c
$(ARMCC) -nostdlib -nostdinc -static -o test_new_graph test_new_graph.c
# large_code: large_code.c
# $(ARMCC) -nostdlib -nostdinc -static -o large_code large_code.c
# test_1: test_1.c
# $(ARMCC) -nostdlib -nostdinc -static -o test_1 test_1.c
# test_new_graph: test_new_graph.c
# $(ARMCC) -nostdlib -nostdinc -static -o test_new_graph test_new_graph.c
##debut
application: application.o
$(CXX) -o application application.o $(LDLIBS2)
application: application.cpp
$(CXX) $(CXXFLAGS) -o application application.cpp $(LDLIBS2)
application.o: application.cpp
explo.so: explo.cpp include/explo.h
$(CXX) -fPIC -shared $(CXXFLAGS) -o explo.so explo.cpp $(LDLIBS)
......
*#include <otawa/app/Application.h>
//#include <iostream>
#include <otawa/app/Application.h>
#include <otawa/cfg/features.h>
#include <otawa/script/Script.h>
#include <otawa/prog/WorkSpace.h>
#include <otawa/proc/DynProcessor.h>
#include <otawa/cfg/Dominance.h>
#include <otawa/proc/DynFeature.h>
#include <otawa/flowfact/features.h>
//includes pour l'affichage du CFG
#include <otawa/display/CFGOutput.h>
#include <elm/io/OutFileStream.h>
// includes cache
#include <otawa/cache/cat2/features.h>
//#include <otawa/icat3/features.h>
// includes wcet
#include <otawa/ipet/features.h>
#include <otawa/ipet/FlowFactLoader.h>
#include <otawa/flowfact/features.h>
// include plugin explo
#include "include/explo.h"
// processors includes
#include <otawa/hard/features.h>
#include <otawa/hard/Processor.h>
// edge time processors
#include <otawa/etime/features.h>
#include <otawa/tsim/BBTimeSimulator.h>
#include <otawa/sim/Simulator.h>
//#include <otawa/icat3/features.h>
using namespace otawa; //comme import
using namespace otawa::explo;
int main(int argc, char **argv) {
if (argc != 4) {
fprintf(stderr, "usage: %s <binary> <cache> <flowfact>", argv[0]);
exit(1);
if(argc != 3) {
std::cout << "Error number of argument. Usage:" << argv[0] << " <binary> <flow fact>" << std::endl;
}
WorkSpace *ws = NULL;
PropList conf;
Manager manager;
NO_SYSTEM(conf) = true;
TASK_ENTRY(conf) = "main";
VERBOSE(conf) = true;
CACHE_CONFIG_PATH(conf) = argv[2];
FLOW_FACTS_PATH(conf) = argv[3];
StringBuffer buf;
buf << argv[1] << "-decomp.c";
elm::io::OutFileStream s(buf.toString());
elm::io::Output out(s);
conf.print(out);
// Flow fact
std::cout << "-------------------- Configuration paths ----------------------" << std::endl;
FLOW_FACTS_PATH(conf) = argv[2];
// Platform description
CACHE_CONFIG_PATH(conf) = "xmc4500/cache.xml";
PROCESSOR_PATH(conf) = "xmc4500/pipeline.xml";
//MEMORY_PATH(conf) = "xmc4500/memory.xml";
// Generic processor
//PROCESSOR_PATH(conf) = "/home/fabien/cristal/otawa/share/Otawa/scripts/generic/pipeline.xml";
std::cout << "----------------------------Workspace building----------------------------------" << std::endl;
ws = manager.load(argv[1], conf);
// CFG Building
std::cout << "----------------------------run virtualizer--------------------------------------" << std::endl;
ws->run("otawa::Virtualizer", conf);
std::cout << "-------------------------------cache configuration-----------------------------------------" << std::endl;
ws->require(otawa::ICACHE_ONLY_CONSTRAINT2_FEATURE , conf);
std::cout << "-------------------------------edge time-----------------------------------------" << std::endl;
otawa::etime::RECORD_TIME(conf) = true;
// ws->require(otawa::ICACHE_CONSTRAINT2_FEATURE , conf);
ws->require(otawa::ICACHE_ONLY_CONSTRAINT2_FEATURE, conf);
ws->require(otawa::etime::EDGE_TIME_FEATURE, conf);
std::cout << "-------------------------------wcet----------------------------------------------" << std::endl;
ws->require(otawa::ipet::WCET_FEATURE, conf);
ws->require(DynFeature("otawa::explo::EXPLO_FEATURE"), conf);
std::cout << "WCET:" << ipet::WCET(ws) << std::endl;
return 0;
}
#include "include/explo.h"
#include <otawa/prog/Inst.h>
#include <otawa/proc/DynFeature.h>
#include <otawa/hard/CacheConfiguration.h>
#include <otawa/cache/features.h>
#include <otawa/sim/TrivialSimulator.h>
#include <otawa/cfg/CFG.h>
#include <otawa/cache/features.h>
#include <otawa/cache/cat2/CAT2Builder.h>
......@@ -14,6 +14,8 @@
#include <otawa/ipet/FlowFactLoader.h>
#include <otawa/flowfact/features.h>
#include <otawa/cfg/Loop.h>
#include <otawa/etime/features.h>
namespace otawa {
namespace explo {
......@@ -31,11 +33,13 @@ namespace otawa {
p::declare ExploProcessor::reg = p::init("otawa::explo::ExploProcessor", Version(1, 0, 0))
.require(COLLECTED_CFG_FEATURE)
.require(LOOP_INFO_FEATURE)
.require(ICACHE_CATEGORY2_FEATURE)
.require(etime::EDGE_TIME_FEATURE)
.require(MKFF_PRESERVATION_FEATURE)
.require(ipet::FLOW_FACTS_FEATURE)
.require(cache::COLLECTED_LBLOCKS_FEATURE)
.require(hard::CACHE_CONFIGURATION_FEATURE)
.require(ipet::BB_TIME_FEATURE)
.require(otawa::ipet::WCET_FEATURE)
.provide(EXPLO_FEATURE);
// definition feature
p::feature EXPLO_FEATURE("otawa::explo::EXPLO_FEATURE", new Maker<ExploProcessor>());
......@@ -47,6 +51,50 @@ namespace otawa {
}
// unsigned long time_lblock(LBlock* lb) {
// BasicBlock* bb = lb->bb();
// std::cout << " -- LB -- " << std::endl;
// InstIter* iter = lb->instruction();
// // for(iter;) {
// //std::cout << "instruction:" << &(instructions[i]) << std::endl;
// //}
// std::cout << " -------- " << std::endl;
// //INSTRUCTION_TIME();
// }
void compute_trivial_lblocks(BasicBlock *bb) {
auto iter = bb->begin();
AllocArray<LBlock *> *lblock_array = BB_LBLOCKS(bb);
for (int i = 0; i < lblock_array->count(); i++) {
LBlock *lb = (*lblock_array)[i];
unsigned long time_lblock = 0;
for(int j = 0; j < lb->countInsts(); j++) {
unsigned long cost_instruction = otawa::sim::INSTRUCTION_TIME(*iter);
if(cost_instruction <= 0) {
//std::cout << "INSTR_TRVL" << std::endl;
cost_instruction = 5;
} else {
//std::cout << "INSTR_V:" << cost_instruction << std::endl;
}
time_lblock += cost_instruction;
iter++;
}
//std::cout << "lblock time:" << time_lblock << std::endl;
}
}
unsigned long time_bblock(BasicBlock* bb) {
std::cout << " -- BB -- " << std::endl;
for(auto i : *bb) {
//std::cout << "instruction:" << ipet::TIME(i) << std::endl;
}
std::cout << " -------- " << std::endl;
}
int get_exit_id_of_cfg(CFG *cfg) {
for(CFG::BlockIter block_iter = cfg->blocks(); block_iter(); block_iter++) {
Block * b = *block_iter;
......@@ -91,14 +139,39 @@ namespace otawa {
return tmp_v;
}
unsigned long compute_total_iteration(Block *b) {
// if the loop header exist return the nb of iteration
Block *bh = Loop::of(b)->header();
if(bh->isBasic()) {
return TOTAL_ITERATION(bh->toBasic()->first());
}
// if the CFG is the main function
if(b->cfg()->callers().count() == 0) {
return 1;
}
// if the CFG is a function then we sum the nb of iteration from all of synth block that call it
unsigned int total = 0;
for(int i = 0; i < b->cfg()->callers().count(); i++) {
total += compute_total_iteration(b->cfg()->callers()[i]);
}
return total;
}
void explo_by_block(Block *b) {
std::cout << "-------------------" << std::endl;
std::cout << "Block: " << b->id() << " ";
if(b->isBasic()) {
std::cout << "Basic " << std::endl;
std::cout << "total iteration: " << TOTAL_ITERATION(b->toBasic()->first()) << std::endl;
std::cout << "ExecTimeBasic "<< ipet::TIME(b->toBasic()) << std::endl;
// if(Loop::of(b)->header() != NULL) {
std::cout << "total iteration: " << compute_total_iteration(b) << std::endl;
// }
// time_bblock(b->toBasic());
compute_trivial_lblocks(b->toBasic());
AllocArray<LBlock *> *lblock_array = BB_LBLOCKS(b->toBasic());
if (lblock_array != NULL)
......@@ -108,11 +181,11 @@ namespace otawa {
{
LBlock *lb = (*lblock_array)[i];
// time_lblock(lb);
category_t status = cache::CATEGORY(lb);
const hard::Cache *cache = lb->lblockset()->cache();
otawa::Address lb_id = cache->round(lb->address());
std::cout << cache->line(lb_id) << ":" <<lb_id.page() << ":" << lb_id.offset() << " " ;
//std::cout << ipet::TIME(lb->instruction()) << "--" << cache->line(lb_id) << ":" <<lb_id.page() << ":" << lb_id.offset() << " " ;
switch(status) {
case FIRST_HIT:
std::cout << "FIRST_HIT" << std::endl;
......@@ -148,18 +221,27 @@ namespace otawa {
Edge *edge = *iter_suc;
Block *target = edge->target();
std::cout << "B" << target->id() << " ";
elm::Pair<long int, otawa::ilp::Var*> p = etime::HTS_CONFIG(edge);
std::cout << "HTS " << p.fst << std::endl;
std::cout << "LTS B" << b->id() << "-B" << target->id() << " : " << etime::LTS_TIME(edge) << std::endl;
std::cout << "B" << b->id() << "-B" << target->id() << " : " << ipet::TIME(edge) << std::endl;
std::cout << "DELTA B" << b->id() << "-B" << target->id() << " : " << ipet::TIME_DELTA(edge) << std::endl;
}
std::cout << std::endl;
// for(Block::EdgeIter iter_suc(b->ins());
// iter_suc();
// iter_suc++) {
// Edge *edge = *iter_suc;
// Block *target = edge->source();
// std::cout << "B" << target->id() << " ";
// }
for(Block::EdgeIter iter_pred(b->ins());
iter_pred();
iter_pred++) {
Edge *edge = *iter_pred;
Block *source = edge->source();
elm::Pair<long int, otawa::ilp::Var*> p =etime:: HTS_CONFIG(edge);
std::cout << "HTS " << p.fst << std::endl;
std::cout << "LTS B" << source->id() << "-B" << b->id() << " : " << etime::LTS_TIME(edge) << std::endl;
std::cout << "B" << source->id() << "-B" << b->id() << " : " << ipet::TIME(edge) << std::endl;
std::cout << "DELTA B" << source->id() << "-B" << b->id() << " : " << ipet::TIME_DELTA(edge) << std::endl;
}
// std::cout << std::endl;
std::cout << "-------------------" << std::endl;
}
......
void fct() {
int l = 0;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
l++;
}
int main() {
int i;
i++;
......@@ -21,4 +40,7 @@ int main() {
int j;
j++;
fct();
j++;
j++;
}
......@@ -11,7 +11,7 @@ ARMCC=arm-none-eabi-gcc
CXXFLAGS += -std=c++11 -O0 -g -I ../otawa-core2-build/otawa/include/ -I ../otawa-core2-build/elm/include/ -I ../include
all: clean initialize_RMB_LMB.so install application binaire condition loop one_function large_code large_loop
all: clean initialize_RMB_LMB.so install application binaire condition loop one_function large_code large_loop test_rmb
binaire: binaire.c
$(ARMCC) -nostdlib -nostdinc -static -o binaire binaire.c
......@@ -41,8 +41,8 @@ application.o: application.cpp
test_graph: test_graph.o
$(CXX) -o test_graph test_graph.o $(LDLIBS2)
test_rmb: test_rmb.o
$(CXX) -o test_rmb test_rmb.o $(LDLIBS2)
test_rmb: test_main.o test_rmb.o
$(CXX) -o test_rmb test_rmb.o test_main.o $(LDLIBS2)
test: test_graph test_rmb
./test_graph
......
......@@ -60,11 +60,11 @@ const otawa::hard::Cache *get_cache(WorkSpace *ws){
return NULL;
}
void print_mb(Mathset::Multiset<std::vector<Address>> *multi, int nb_index, ofstream &file) {
void print_mb(std::vector<std::vector<Address>> *multi, int nb_index, ofstream &file) {
//file << "{";
for(int i = 0; i < nb_index; i++) {
std::vector<std::vector<Address>> tmp = multi[i].get_set();
std::vector<std::vector<Address>> tmp = get_set(multi[i]);
file << "[" << i << "]";
for(int j = 0; j < tmp.size(); j++) {
......
......@@ -3,30 +3,64 @@
#include <otawa/otawa.h>
#include <vector>
#include <multiset.h>
namespace otawa {
namespace initialize_RMB_LMB {
template <typename T>
T vector_union(T v1, T v2) {
T v3;
for(auto iter_v = v1.begin(); iter_v != v1.end(); iter_v++) {
v3.push_back(*iter_v);
}
for(auto iter_v = v2.begin(); iter_v != v2.end(); iter_v++) {
v3.push_back(*iter_v);
}
return v3;
}
template <typename T>
T get_set(T v1) {
T v2;
for(auto iter_v = v1.begin(); iter_v != v1.end(); iter_v++) {
bool already_in = false;
for(auto iter_v2 = v2.begin(); iter_v2 != v2.end(); iter_v2++) {
if(*iter_v2 == *iter_v) {
already_in = true;
break;
}
}
if(!already_in) {
v2.push_back(*iter_v);
}
}
return v2;
}
struct Memory_block {
int block_id;
int nb_index;
int nb_way;
BasicBlock* bb_ptr;
std::vector<struct Memory_block*> pred;
std::vector<struct Memory_block*> suc;
std::vector<Address> *lmb_gen;
std::vector<Address> *rmb_gen;
Mathset::Multiset<std::vector<Address>> *rmb_in;
Mathset::Multiset<std::vector<Address>> *rmb_out;
Mathset::Multiset<std::vector<Address>> *lmb_in;
Mathset::Multiset<std::vector<Address>> *lmb_out;
std::vector<std::vector<Address>> *rmb_in;
std::vector<std::vector<Address>> *rmb_out;
std::vector<std::vector<Address>> *lmb_in;
std::vector<std::vector<Address>> *lmb_out;
Memory_block(int nb_index, int nb_way) {
Memory_block(int nb_index, int nb_way, BasicBlock* bb) {
this->bb_ptr = bb;
this->nb_index = nb_index;
this->nb_way = nb_way;
this->rmb_in = new Mathset::Multiset<std::vector<Address>>[nb_index];
this->rmb_out = new Mathset::Multiset<std::vector<Address>>[nb_index];
this->lmb_in = new Mathset::Multiset<std::vector<Address>>[nb_index];
this->lmb_out = new Mathset::Multiset<std::vector<Address>>[nb_index];
this->rmb_in = new std::vector<std::vector<Address>>[nb_index];
this->rmb_out = new std::vector<std::vector<Address>>[nb_index];
this->lmb_in = new std::vector<std::vector<Address>>[nb_index];
this->lmb_out = new std::vector<std::vector<Address>>[nb_index];
this->lmb_gen = new std::vector<Address>[nb_index];
this->rmb_gen = new std::vector<Address>[nb_index];
}
......
......@@ -16,9 +16,9 @@
#include <otawa/flowfact/features.h>
#include <multiset.h>
//#include <multiset.h>
using namespace Mathset;
namespace otawa
{
......@@ -66,13 +66,15 @@ namespace otawa
}
void print_memory_block(struct Memory_block *mb, int nb_index) {
//std::cout << "-----------------------" << std::endl;
//std::cout << "Block:" << mb->block_id << std::endl;
//std::cout << "RMB_IN" << std::endl;
for(int i = 0; i < nb_index; i++) {
//std::cout <<"[" << i << "]" << " ";
std::vector<std::vector<Address>> tmp_set = mb->rmb_in[i].get_set();
std::vector<std::vector<Address>> tmp_set = get_set(mb->rmb_in[i]);
for(int j = 0; j < tmp_set.size(); j++) {
//std::cout << "{";
for(int k = 0; k < tmp_set[j].size(); k++) {
......@@ -86,7 +88,7 @@ namespace otawa
//std::cout << "RMB_OUT" << std::endl;
for(int i = 0; i < nb_index; i++) {
//std::cout <<"[" << i << "]" << " ";
std::vector<std::vector<Address>> tmp_set = mb->rmb_out[i].get_set();
std::vector<std::vector<Address>> tmp_set = get_set(mb->rmb_out[i]);
for(int j = 0; j < tmp_set.size(); j++) {
//std::cout << "{";
for(int k = 0; k < tmp_set[j].size(); k++) {
......@@ -429,71 +431,65 @@ namespace otawa
void print_true_gen(struct Memory_block *mb, int nb_index) {
// std::cout << "-----------------------" << std::endl;
// std::cout << "id=" << mb->block_id << std::endl;
//std::cout << "suc: ";
for(int i = 0; i < mb->suc.size(); i++) {
//std::cout << mb->suc[i]->block_id << " ";
}
//std::cout << std::endl << "--lmb_gen--";
for (int i = 0; i < nb_index;i++)
{
//std::cout << std::endl << "[" << i << "]=";
for(int j = 0; j < mb->lmb_gen[i].size(); j++) {
//std::cout << " " << mb->lmb_gen[i][j].page() << ":" << mb->lmb_gen[i][j].offset();
}
}
// //std::cout << "suc: ";
// for(int i = 0; i < mb->suc.size(); i++) {
// //std::cout << mb->suc[i]->block_id << " ";
// }
// //std::cout << std::endl << "--lmb_gen--";
// // for (int i = 0; i < nb_index;i++)
// // {
// // std::cout << std::endl << "[" << i << "]=";
// // for(int j = 0; j < mb->lmb_gen[i].size(); j++) {
// // std::cout << " " << mb->lmb_gen[i][j].page() << ":" << mb->lmb_gen[i][j].offset();
// // }
// // }
// std::cout << std::endl << "--rmb_gen--";
for (int i = 0; i < nb_index;i++)
{
// for (int i = 0; i < nb_index;i++) {
// std::cout << std::endl << "[" << i << "]=";
for(int j = 0; j < mb->rmb_gen[i].size(); j++) {
// for(int j = 0; j < mb->rmb_gen[i].size(); j++) {
// std::cout << " " << mb->rmb_gen[i][j].page() << ":" << mb->rmb_gen[i][j].offset();
}
}
// }
// }
// std::cout << std::endl << "-----------------------" << std::endl;
}
void init_gen(BasicBlock *bb, int nb_index, int nb_way, const otawa::hard::Cache *cache)
{
void init_gen(BasicBlock *bb, int nb_index, int nb_way, const otawa::hard::Cache *cache) {
Memory_block *mb = MB_STRUCT(bb);
std::vector<Address> vect[nb_index];
AllocArray<LBlock *> *lblock_array = BB_LBLOCKS(bb);
for (int i = 0; i < lblock_array->count(); i++)
{
for (int i = 0; i < lblock_array->count(); i++) {
LBlock *lb = (*lblock_array)[i];
otawa::Address lb_id = cache->round(lb->address());
vect[cache->line(lb->address())].push_back(lb_id);
}
//std::cout << "--------------------VECTORS--------------------" << std::endl;
for(int i = 0; i < nb_index; i++) {
for(int j = 0; j < vect[i].size(); j++) {
// for(int i = 0; i < nb_index; i++) {
// for(int j = 0; j < vect[i].size(); j++) {
// std::cout << vect[i][j].offset() << " ";
}
// }
// std::cout << std::endl;
}
for (int index_tmp = 0; index_tmp < nb_index; index_tmp++)
{
for (int i = 0; i < nb_way; i++)
{
if (i < vect[index_tmp].size())
{
// }
for (int index_tmp = 0; index_tmp < nb_index; index_tmp++) {
for (int i = 0; i < nb_way; i++) {
if (i < vect[index_tmp].size()) {
mb->lmb_gen[index_tmp].push_back(vect[index_tmp][i]);
}
int j = vect[index_tmp].size() - 1 - i;
if (j >= 0)
{
if (j >= 0) {
mb->rmb_gen[index_tmp].insert(mb->rmb_gen[index_tmp].begin(), vect[index_tmp][j]);
}
}
mb->lmb_in[index_tmp].add_elem(mb->lmb_gen[index_tmp]);
mb->rmb_out[index_tmp].add_elem(mb->rmb_gen[index_tmp]);
if(mb->lmb_gen[index_tmp].size() != 0)
mb->lmb_in[index_tmp].push_back(mb->lmb_gen[index_tmp]);
if(mb->rmb_gen[index_tmp].size() != 0)
mb->rmb_out[index_tmp].push_back(mb->rmb_gen[index_tmp]);
}
print_true_gen(mb, nb_index);
}
......@@ -503,51 +499,52 @@ namespace otawa
{
// std::cout << "-----------------------" << std::endl;
// std::cout << "id=" << mb->block_id << std::endl;
for (int i = 0; i < nb_index;i++)
{
//std::cout << "size lmb_gen[" << i << "]=" << mb->lmb_gen[i].size() << std::endl;
}
for (int i = 0; i < nb_index; i++)
{
// std::cout << "--RMB--" << std::endl;
// for (int i = 0; i < nb_index; i++) {
// std::cout << "size rmb_gen[" << i << "]=" << mb->rmb_gen[i].size() << std::endl;
}
// }
for (int i = 0; i < nb_index; i++)
{
// for (int i = 0; i < nb_index; i++) {
// std::cout << "size rmb_in[" << i << "]=" << mb->rmb_in[i].size() << std::endl;
std::vector<std::vector<Address>> tmp = mb->rmb_in[i].get_set();
for (int j = 0; j < tmp.size(); j++)
{
// std::vector<std::vector<Address>> tmp = get_set(mb->rmb_in[i]);
// for (int j = 0; j < tmp.size(); j++) {
// std::cout << "size rmb_in[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
}
}
for (int i = 0; i < nb_index; i++)
{
// }
// }
// for (int i = 0; i < nb_index; i++) {
// std::cout << "size rmb_out[" << i << "]=" << mb->rmb_out[i].size() << std::endl;
std::vector<std::vector<Address>> tmp = mb->rmb_out[i].get_set();
for (int j = 0; j < tmp.size(); j++)
{
// std::vector<std::vector<Address>> tmp = get_set(mb->rmb_out[i]);
// for (int j = 0; j < tmp.size(); j++) {
// std::cout << "size rmb_out[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
}
}
for (int i = 0; i < nb_index; i++)
{
// }
// }
// std::cout << "--LMB--" << std::endl;
// for (int i = 0; i < nb_index; i++) {
// std::cout << "size lmb_gen[" << i << "]=" << mb->lmb_gen[i].size() << std::endl;
// }
// for (int i = 0; i < nb_index; i++) {
// std::cout << "size lmb_in[" << i << "]=" << mb->lmb_in[i].size() << std::endl;
std::vector<std::vector<Address>> tmp = mb->lmb_in[i].get_set();
for (int j = 0; j < tmp.size(); j++)
{
// std::vector<std::vector<Address>> tmp = get_set(mb->lmb_in[i]);
// for (int j = 0; j < tmp.size(); j++) {
// std::cout << "size lmb_in[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
}
}
for (int i = 0; i < nb_index; i++)
{
// for(int k = 0; k < tmp[j].size(); k++) {
// std::cout << "--" << tmp[j][k].offset() << std::endl;
// }
// }
// }
// for (int i = 0; i < nb_index; i++) {
// std::cout << "size lmb_out[" << i << "]=" << mb->lmb_out[i].size() << std::endl;
std::vector<std::vector<Address>> tmp = mb->lmb_out[i].get_set();
for (int j = 0; j < tmp.size(); j++)
{
// std::vector<std::vector<Address>> tmp = get_set(mb->lmb_out[i]);
// for (int j = 0; j < tmp.size(); j++) {
// std::cout << "size lmb_out[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
}
}
// for(int k = 0; k < tmp[j].size(); k++) {
// std::cout << "--" << tmp[j][k].offset() << std::endl;
// }
// }
// }
// std::cout << "-----------------------" << std::endl;
}
......@@ -564,7 +561,7 @@ namespace otawa
if (block_iter->isBasic())
{
BasicBlock *bb = block_iter->toBasic();
MB_STRUCT(bb) = new Memory_block(nb_index, nb_way);
MB_STRUCT(bb) = new Memory_block(nb_index, nb_way, bb);
}
}
}
......@@ -611,7 +608,6 @@ namespace otawa
init_gen(bb, nb_index, nb_way, cache);
print_true_gen(mb, nb_index);
}
}
}
......@@ -619,56 +615,54 @@ namespace otawa
void compute_rmb(const CFGCollection *coll, int nb_way, int nb_index) {
bool change = true;
while (change)
{
while(change) {
change = false;
for (CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++)
{
for (CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++)
{
if (block_iter->isBasic())
{
for(CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++) {
for(CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++) {
// ----- for each BB -----
if(block_iter->isBasic()) {
BasicBlock *bb = block_iter->toBasic();
Memory_block *mb = MB_STRUCT(bb);
print_memory_block(mb, nb_index);
//print_gen(mb,nb_index, nb_way);
for (int index = 0; index < nb_index; index++)
{
//IN
mb->rmb_in[index].clear();
// ----- for each row -----
for (int index = 0; index < nb_index; index++) {
for (int pred_mb = 0; pred_mb < mb->pred.size(); pred_mb++)
{
mb->rmb_in[index] = math_set_union(
mb->rmb_in[index],
mb->pred[pred_mb]->rmb_out[index]);
// RMB IN
mb->rmb_in[index].clear();
for (int pred_mb = 0; pred_mb < mb->pred.size(); pred_mb++) {
mb->rmb_in[index] =
get_set(vector_union(mb->rmb_in[index],
mb->pred[pred_mb]->rmb_out[index]));
}
//OUT
Multiset<std::vector<Address>> oldout(mb->rmb_out[index].get_multiset());
// RMB OUT
std::vector<std::vector<Address>> oldout(mb->rmb_out[index]);
mb->rmb_out[index].clear();
std::vector<std::vector<Address>> rmb_in = mb->rmb_in[index].get_set();
std::vector<std::vector<Address>> rmb_in = mb->rmb_in[index];
if(rmb_in.size() == 0) {
mb->rmb_out[index].add_elem(mb->rmb_gen[index]);
}
for (int tmp_rmb = 0; tmp_rmb < rmb_in.size(); tmp_rmb++)
{
// TODO: Need to modify this part to take into account empty gen
//if(mb->rmb_gen[index].size() != 0) {
mb->rmb_out[index].push_back(mb->rmb_gen[index]);
//}
} else {
for (int tmp_rmb = 0; tmp_rmb < rmb_in.size(); tmp_rmb++) {
std::vector<Address> tmp_vect = mb->rmb_gen[index];
rmb_in[tmp_rmb] = rmb_LRU(tmp_vect, rmb_in[tmp_rmb], nb_way);
mb->rmb_out[index].add_elem(rmb_in[tmp_rmb]);
rmb_in[tmp_rmb] = get_set(rmb_LRU(tmp_vect, rmb_in[tmp_rmb], nb_way));
mb->rmb_out[index].push_back(rmb_in[tmp_rmb]);
}
}
if (oldout != mb->rmb_out[index])
{
mb->rmb_out[index] = get_set(mb->rmb_out[index]);
// UPDATE END CONDITION
if (oldout != mb->rmb_out[index]) {
change = true;
}
}
}
}
......@@ -678,52 +672,52 @@ namespace otawa
void compute_lmb(const CFGCollection *coll, int nb_way, int nb_index) {
bool change = true;
while (change)
{
while (change) {
change = false;
for (CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++)
{
for (CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++)
{
if (block_iter->isBasic())
{
for (CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++) {
for (CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++) {
// ----- for each BB -----
if (block_iter->isBasic()) {
BasicBlock *bb = block_iter->toBasic();
Memory_block *mb = MB_STRUCT(bb);
for (int index = 0; index < nb_index; index++)
{
//OUT
mb->lmb_out[index].clear();
// ----- for each row -----
for (int suc_mb = 0; suc_mb < mb->suc.size(); suc_mb++)
{
mb->lmb_out[index] = math_set_union(
mb->lmb_out[index],
mb->suc[suc_mb]->lmb_in[index]);
}
for (int index = 0; index < nb_index; index++) {
//IN
// LMB OUT
mb->lmb_out[index].clear();
for (int suc_mb = 0; suc_mb < mb->suc.size(); suc_mb++) {
mb->lmb_out[index] =
get_set(vector_union(mb->lmb_out[index],
mb->suc[suc_mb]->lmb_in[index]));
}
Multiset<std::vector<Address>> oldout(mb->lmb_in[index].get_multiset());
// LMB IN
std::vector<std::vector<Address>> oldout(mb->lmb_in[index]);
mb->lmb_in[index].clear();
std::vector<std::vector<Address>> lmb_out = mb->lmb_out[index].get_set();
std::vector<std::vector<Address>> lmb_out = get_set(mb->lmb_out[index]);
if(lmb_out.size() == 0) {
mb->lmb_in[index].add_elem(mb->lmb_gen[index]);
}
for (int tmp_lmb = 0; tmp_lmb < lmb_out.size(); tmp_lmb++)
{
// TODO: Need to modify this part to take into account empty gen
//if(mb->lmb_gen[index].size() != 0) {
mb->lmb_in[index].push_back(mb->lmb_gen[index]);
//}
} else {
for (int tmp_lmb = 0; tmp_lmb < lmb_out.size(); tmp_lmb++) {
std::vector<Address> tmp_vect = mb->lmb_gen[index];
lmb_out[tmp_lmb] = lmb_LRU(tmp_vect, lmb_out[tmp_lmb], nb_way);
mb->lmb_in[index].add_elem(lmb_out[tmp_lmb]);
lmb_out[tmp_lmb] = get_set(lmb_LRU(tmp_vect, lmb_out[tmp_lmb], nb_way));
mb->lmb_in[index].push_back(lmb_out[tmp_lmb]);
}
}
if (oldout != mb->lmb_in[index])
{
mb->lmb_in[index] = get_set(mb->lmb_in[index]);
// UPDATE END CONDITION
if (oldout != mb->lmb_in[index]) {
change = true;
}
}
......@@ -737,7 +731,6 @@ namespace otawa
void Initialize_RMB_LMBProcessor::processWorkSpace(WorkSpace *ws)
{
//std::cout << "####################################################################################### START ################################################################################" << std::endl;
const CFGCollection *coll = INVOLVED_CFGS(ws);
const otawa::hard::CacheConfiguration *cf = otawa::hard::CACHE_CONFIGURATION_FEATURE.get(ws);
......@@ -746,30 +739,34 @@ namespace otawa
int nb_index = cache->rowCount();
int nb_way = cache->wayCount();
//std::cout << "Create structure" << std::endl;
// create structures
create_structure(coll, nb_index, nb_way);
//std::cout << "Link structure" << std::endl;
// links structures
link_structure(coll, nb_way, nb_index);
//std::cout << "initialize structure" << std::endl;
// Initialize all structures
initialize_structure(coll, nb_way, nb_index, cache);
//std::cout << "COMPUTE LMB and RMB" << std::endl;
// RMB
compute_rmb(coll, nb_way, nb_index);
// LMB
compute_lmb(coll, nb_way, nb_index);
for (CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++) {
for (CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++) {
if (block_iter->isBasic()) {
BasicBlock *bb = block_iter->toBasic();
Memory_block *mb = MB_STRUCT(bb);
print_gen(mb,nb_index, nb_way);
}
}
}
}
// definition propriete
......@@ -780,5 +777,3 @@ namespace otawa
} // namespace initialize_RMB_LMB
} // namespace otawa
///----------------------------------------------- IMPORTANT
#define CATCH_CONFIG_MAIN
//#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <otawa/app/Application.h>
......@@ -38,7 +38,7 @@ TEST_CASE("gen","[Memory Block]") {
elm::io::OutFileStream s(buf.toString());
elm::io::Output out(s);
conf.print(out);
ws = manager.load("large_code", conf);
ws = manager.load("large_loop", conf);
ws->require(DynFeature("otawa::initialize_RMB_LMB::INITIALIZE_RMB_LMB_FEATURE"), conf);
......@@ -51,28 +51,65 @@ TEST_CASE("gen","[Memory Block]") {
BasicBlock *bb = block_iter->toBasic();
struct Memory_block *mb = MB_STRUCT(bb);
if(mb->block_id == 1) {
REQUIRE(mb->lmb_gen[0].size() == 1);
if(mb->lmb_gen[0].size() == 1) {
REQUIRE(mb->lmb_gen[0][0].offset() == 32768);
}
REQUIRE(mb->lmb_gen[1].size() == 0);
REQUIRE(mb->rmb_gen[0].size() == 1);
if(mb->rmb_gen[0].size() == 1) {
REQUIRE(mb->rmb_gen[0][0].offset() == 32768);
}
REQUIRE(mb->rmb_gen[1].size() == 0);
}
if(mb->block_id == 2) {
REQUIRE(mb->lmb_gen[0].size() == 0);
REQUIRE(mb->lmb_gen[1].size() == 1);
if(mb->lmb_gen[1].size() == 1) {
REQUIRE(mb->lmb_gen[1][0].offset() == 32960);
}
REQUIRE(mb->rmb_gen[0].size() == 0);
REQUIRE(mb->rmb_gen[1].size() == 1);
if(mb->rmb_gen[1].size() == 1) {
REQUIRE(mb->rmb_gen[1][0].offset() == 32960);
}
}
if(mb->block_id == 3) {
REQUIRE(mb->lmb_gen[0].size() == 2);
if(mb->lmb_gen[0].size() == 2) {
REQUIRE(mb->lmb_gen[0][0].offset() == 32768);
REQUIRE(mb->lmb_gen[0][1].offset() == 32896);
}
REQUIRE(mb->lmb_gen[1].size() == 2);
if(mb->lmb_gen[1].size() == 2) {
REQUIRE(mb->lmb_gen[1][0].offset() == 32832);
REQUIRE(mb->lmb_gen[1][1].offset() == 32960);
}
REQUIRE(mb->rmb_gen[0].size() == 2);
if(mb->rmb_gen[0].size() == 2) {
REQUIRE(mb->rmb_gen[0][0].offset() == 33152);
REQUIRE(mb->rmb_gen[0][1].offset() == 33280);
REQUIRE(mb->rmb_gen[0][0].offset() == 32768);
REQUIRE(mb->rmb_gen[0][1].offset() == 32896);
}
REQUIRE(mb->rmb_gen[1].size() == 2);
if(mb->rmb_gen[1].size() == 2) {
REQUIRE(mb->rmb_gen[1][0].offset() == 33088);
REQUIRE(mb->rmb_gen[1][1].offset() == 33216);
REQUIRE(mb->rmb_gen[1][0].offset() == 32832);
REQUIRE(mb->rmb_gen[1][1].offset() == 32960);
}
}
if(mb->block_id == 4) {
REQUIRE(mb->lmb_gen[0].size() == 0);
REQUIRE(mb->lmb_gen[1].size() == 1);
if(mb->lmb_gen[1].size() == 1) {
REQUIRE(mb->lmb_gen[1][0].offset() == 32960);
}
REQUIRE(mb->rmb_gen[0].size() == 0);
REQUIRE(mb->rmb_gen[1].size() == 1);
if(mb->rmb_gen[1].size() == 1) {
REQUIRE(mb->rmb_gen[1][0].offset() == 32960);
}
}
}
......@@ -83,6 +120,7 @@ TEST_CASE("gen","[Memory Block]") {
TEST_CASE("RMB","[Memory Block]") {
WorkSpace *ws = NULL;
......@@ -104,6 +142,7 @@ TEST_CASE("RMB","[Memory Block]") {
const CFGCollection *coll = INVOLVED_CFGS(ws);
for(CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++) {
for(CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++) {
......@@ -111,17 +150,14 @@ TEST_CASE("RMB","[Memory Block]") {
BasicBlock *bb = block_iter->toBasic();
struct Memory_block *mb = MB_STRUCT(bb);
// Block 1
if(mb->block_id == 1) {
std::vector<std::vector<Address>> RMB_IN_0 = mb->rmb_in[0].get_set();
std::vector<std::vector<Address>> RMB_IN_1 = mb->rmb_in[1].get_set();
std::vector<std::vector<Address>> RMB_OUT_0 = mb->rmb_out[0].get_set();
std::vector<std::vector<Address>> RMB_OUT_1 = mb->rmb_out[1].get_set();
std::vector<std::vector<Address>> RMB_IN_0 = mb->rmb_in[0];
std::vector<std::vector<Address>> RMB_IN_1 = mb->rmb_in[1];
std::vector<std::vector<Address>> RMB_OUT_0 = mb->rmb_out[0];
std::vector<std::vector<Address>> RMB_OUT_1 = mb->rmb_out[1];
// Index 0
REQUIRE(RMB_IN_0.size() == 0);
if(RMB_IN_0.size() == 0) {
}
REQUIRE(RMB_IN_1.size() == 0);
if(RMB_IN_1.size() == 0) {
}
REQUIRE(RMB_OUT_0.size() == 1);
if(RMB_OUT_0.size() == 1) {
REQUIRE(RMB_OUT_0[0].size() == 1);
......@@ -129,18 +165,22 @@ TEST_CASE("RMB","[Memory Block]") {
REQUIRE(RMB_OUT_0[0][0].offset() == 32768);
}
}
// Index 1
REQUIRE(RMB_IN_1.size() == 0);
REQUIRE(RMB_OUT_1.size() == 1);
if(RMB_OUT_1.size() == 1) {
REQUIRE(RMB_OUT_1[0].size() == 0);
RMB_OUT_1[0].size() == 0;
}
}
// Block 2
if(mb->block_id == 2) {
std::vector<std::vector<Address>> RMB_IN_0 = mb->rmb_in[0].get_set();
std::vector<std::vector<Address>> RMB_IN_1 = mb->rmb_in[1].get_set();
std::vector<std::vector<Address>> RMB_OUT_0 = mb->rmb_out[0].get_set();
std::vector<std::vector<Address>> RMB_OUT_1 = mb->rmb_out[1].get_set();
std::vector<std::vector<Address>> RMB_IN_0 = mb->rmb_in[0];
std::vector<std::vector<Address>> RMB_IN_1 = mb->rmb_in[1];
std::vector<std::vector<Address>> RMB_OUT_0 = mb->rmb_out[0];
std::vector<std::vector<Address>> RMB_OUT_1 = mb->rmb_out[1];
//RMB_IN_0
// Index 0
REQUIRE(RMB_IN_0.size() == 2);
if(RMB_IN_0.size() == 2) {
REQUIRE(RMB_IN_0[0].size() == 1);
......@@ -153,19 +193,6 @@ TEST_CASE("RMB","[Memory Block]") {
REQUIRE(RMB_IN_0[1][1].offset() == 32896);
}
}
//RMB_IN_1
REQUIRE(RMB_IN_1.size() == 2);
if(RMB_IN_1.size() == 2) {
REQUIRE(RMB_IN_1[0].size() == 0);
REQUIRE(RMB_IN_1[1].size() == 2);
if(RMB_IN_1[1].size() == 2) {
REQUIRE(RMB_IN_1[1][0].offset() == 32832);
REQUIRE(RMB_IN_1[1][1].offset() == 32960);
}
}
//RMB_OUT_0
REQUIRE(RMB_OUT_0.size() == 2);
if(RMB_OUT_0.size() == 2) {
REQUIRE(RMB_OUT_0[0].size() == 1);
......@@ -178,29 +205,39 @@ TEST_CASE("RMB","[Memory Block]") {
REQUIRE(RMB_OUT_0[1][1].offset() == 32896);
}
}
// Index 1
REQUIRE(RMB_IN_1.size() == 2);
if(RMB_IN_1.size() == 2) {
REQUIRE(RMB_IN_1[0].size() == 0);
REQUIRE(RMB_IN_1[1].size() == 2);
if(RMB_IN_1[1].size() == 2) {
REQUIRE(RMB_IN_1[1][0].offset() == 32832);
REQUIRE(RMB_IN_1[1][1].offset() == 32960);
}
//RMB_OUT_1
}
REQUIRE(RMB_OUT_1.size() == 2);
if(RMB_OUT_1.size() == 2) {
REQUIRE(RMB_OUT_1[0].size() == 1);
if(RMB_OUT_1[0].size() == 1) {
REQUIRE(RMB_OUT_1[0][0].offset() == 32960);
}
REQUIRE(RMB_OUT_1[1].size() == 2);
if(RMB_OUT_1[1].size() == 2) {
REQUIRE(RMB_OUT_1[1][0].offset() == 32832);
REQUIRE(RMB_OUT_1[1][1].offset() == 32960);
}
REQUIRE(RMB_OUT_1[0].size() == 1);
if(RMB_OUT_1[0].size() == 1) {
REQUIRE(RMB_OUT_1[0][0].offset() == 32960);
}
}
}
// Block 3
if(mb->block_id == 3) {
std::vector<std::vector<Address>> RMB_IN_0 = mb->rmb_in[0].get_set();
std::vector<std::vector<Address>> RMB_IN_1 = mb->rmb_in[1].get_set();
std::vector<std::vector<Address>> RMB_OUT_0 = mb->rmb_out[0].get_set();
std::vector<std::vector<Address>> RMB_OUT_1 = mb->rmb_out[1].get_set();
std::vector<std::vector<Address>> RMB_IN_0 = mb->rmb_in[0];
std::vector<std::vector<Address>> RMB_IN_1 = mb->rmb_in[1];
std::vector<std::vector<Address>> RMB_OUT_0 = mb->rmb_out[0];
std::vector<std::vector<Address>> RMB_OUT_1 = mb->rmb_out[1];
//RMB_IN_0
// Index 0
REQUIRE(RMB_IN_0.size() == 2);
if(RMB_IN_0.size() == 2) {
REQUIRE(RMB_IN_0[0].size() == 1);
......@@ -213,32 +250,27 @@ TEST_CASE("RMB","[Memory Block]") {
REQUIRE(RMB_IN_0[1][1].offset() == 32896);
}
}
//RMB_IN_1
REQUIRE(RMB_OUT_0.size() == 1);
if(RMB_OUT_0.size() == 1) {
REQUIRE(RMB_OUT_0[0].size() == 2);
if(RMB_OUT_0[0].size() == 2) {
REQUIRE(RMB_OUT_0[0][0].offset() == 32768);
REQUIRE(RMB_OUT_0[0][1].offset() == 32896);
}
}
// Index 1
REQUIRE(RMB_IN_1.size() == 2);
if(RMB_IN_1.size() == 2) {
REQUIRE(RMB_IN_1[0].size() == 1);
if(RMB_IN_1[0].size() == 1) {
REQUIRE(RMB_IN_1[0][0].offset() == 32960);
}
REQUIRE(RMB_IN_1[1].size() == 2);
if(RMB_IN_1[1].size() == 2) {
REQUIRE(RMB_IN_1[1][0].offset() == 32832);
REQUIRE(RMB_IN_1[1][1].offset() == 32960);
}
}
//RMB_OUT_0
REQUIRE(RMB_OUT_0.size() == 1);
if(RMB_OUT_0.size() == 1) {
REQUIRE(RMB_OUT_0[0].size() == 2);
if(RMB_OUT_0[0].size() == 2) {
REQUIRE(RMB_OUT_0[0][0].offset() == 32768);
REQUIRE(RMB_OUT_0[0][1].offset() == 32896);
REQUIRE(RMB_IN_1[0].size() == 1);
if(RMB_IN_1[0].size() == 2) {
REQUIRE(RMB_IN_1[0][0].offset() == 32960);
}
}
//RMB_OUT_1
REQUIRE(RMB_OUT_1.size() == 1);
if(RMB_OUT_1.size() == 1) {
REQUIRE(RMB_OUT_1[0].size() == 2);
......@@ -248,13 +280,14 @@ TEST_CASE("RMB","[Memory Block]") {
}
}
}
// Block 4
if(mb->block_id == 4) {
std::vector<std::vector<Address>> RMB_IN_0 = mb->rmb_in[0].get_set();
std::vector<std::vector<Address>> RMB_IN_1 = mb->rmb_in[1].get_set();
std::vector<std::vector<Address>> RMB_OUT_0 = mb->rmb_out[0].get_set();
std::vector<std::vector<Address>> RMB_OUT_1 = mb->rmb_out[1].get_set();
std::vector<std::vector<Address>> RMB_IN_0 = mb->rmb_in[0];
std::vector<std::vector<Address>> RMB_IN_1 = mb->rmb_in[1];
std::vector<std::vector<Address>> RMB_OUT_0 = mb->rmb_out[0];
std::vector<std::vector<Address>> RMB_OUT_1 = mb->rmb_out[1];
//RMB_IN_0
// Index 0
REQUIRE(RMB_IN_0.size() == 2);
if(RMB_IN_0.size() == 2) {
REQUIRE(RMB_IN_0[0].size() == 1);
......@@ -267,22 +300,6 @@ TEST_CASE("RMB","[Memory Block]") {
REQUIRE(RMB_IN_0[1][1].offset() == 32896);
}
}
//RMB_IN_1
REQUIRE(RMB_IN_1.size() == 2);
if(RMB_IN_1.size() == 2) {
REQUIRE(RMB_IN_1[0].size() == 1);
if(RMB_IN_1[0].size() == 1) {
REQUIRE(RMB_IN_1[0][0].offset() == 32960);
}
REQUIRE(RMB_IN_1[1].size() == 2);
if(RMB_IN_1[1].size() == 2) {
REQUIRE(RMB_IN_1[1][0].offset() == 32832);
REQUIRE(RMB_IN_1[1][1].offset() == 32960);
}
}
//RMB_OUT_0
REQUIRE(RMB_OUT_0.size() == 2);
if(RMB_OUT_0.size() == 2) {
REQUIRE(RMB_OUT_0[0].size() == 1);
......@@ -295,21 +312,262 @@ TEST_CASE("RMB","[Memory Block]") {
REQUIRE(RMB_OUT_0[1][1].offset() == 32896);
}
}
//RMB_OUT_1
// Index 1
REQUIRE(RMB_IN_1.size() == 2);
if(RMB_IN_1.size() == 2) {
REQUIRE(RMB_IN_1[1].size() == 2);
if(RMB_IN_1[1].size() == 2) {
REQUIRE(RMB_IN_1[1][0].offset() == 32832);
REQUIRE(RMB_IN_1[1][1].offset() == 32960);
}
REQUIRE(RMB_IN_1[0].size() == 1);
if(RMB_IN_1[0].size() == 1) {
REQUIRE(RMB_IN_1[0][0].offset() == 32960);
}
}
REQUIRE(RMB_OUT_1.size() == 2);
if(RMB_OUT_1.size() == 2) {
REQUIRE(RMB_OUT_1[0].size() == 1);
if(RMB_OUT_1[0].size() == 1) {
REQUIRE(RMB_OUT_1[0][0].offset() == 32960);
}
REQUIRE(RMB_OUT_1[1].size() == 2);
if(RMB_OUT_1[1].size() == 2) {
REQUIRE(RMB_OUT_1[1][0].offset() == 32832);
REQUIRE(RMB_OUT_1[1][1].offset() == 32960);
}
REQUIRE(RMB_OUT_1[0].size() == 1);
if(RMB_OUT_1[0].size() == 1) {
REQUIRE(RMB_OUT_1[0][0].offset() == 32960);
}
}
}
}
}
}
}
TEST_CASE("LMB","[Memory Block]") {
WorkSpace *ws = NULL;
PropList conf;
Manager manager;
NO_SYSTEM(conf) = true;
TASK_ENTRY(conf) = "main";
VERBOSE(conf) = true;
CACHE_CONFIG_PATH(conf) = "./cache_large_code.xml";
StringBuffer buf;
buf << "test_condition-decomp.c";
elm::io::OutFileStream s(buf.toString());
elm::io::Output out(s);
conf.print(out);
ws = manager.load("large_loop", conf);
ws->require(DynFeature("otawa::initialize_RMB_LMB::INITIALIZE_RMB_LMB_FEATURE"), conf);
const CFGCollection *coll = INVOLVED_CFGS(ws);
for(CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++) {
for(CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++) {
if(block_iter->isBasic()) {
BasicBlock *bb = block_iter->toBasic();
struct Memory_block *mb = MB_STRUCT(bb);
//Block 1
if(mb->block_id == 1) {
std::cout << "BB1" << std::endl;
std::vector<std::vector<Address>> LMB_IN_0 = mb->lmb_in[0];
std::vector<std::vector<Address>> LMB_IN_1 = mb->lmb_in[1];
std::vector<std::vector<Address>> LMB_OUT_0 = mb->lmb_out[0];
std::vector<std::vector<Address>> LMB_OUT_1 = mb->lmb_out[1];
// Index 0
REQUIRE(LMB_IN_0.size() == 2);
if(LMB_IN_0.size() == 2) {
REQUIRE(LMB_IN_0[0].size() == 2);
if(LMB_IN_0[0].size() == 2) {
REQUIRE(LMB_IN_0[0][0].offset() == 32768);
REQUIRE(LMB_IN_0[0][1].offset() == 32896);
}
REQUIRE(LMB_IN_0[1].size() == 1);
if(LMB_IN_0[1].size() == 1) {
REQUIRE(LMB_IN_0[1][0].offset() == 32768);
}
}
REQUIRE(LMB_OUT_0.size() == 2);
if(LMB_OUT_0.size() == 2) {
REQUIRE(LMB_OUT_0[0].size() == 2);
if(LMB_OUT_0[0].size() == 2) {
REQUIRE(LMB_OUT_0[0][0].offset() == 32768);
REQUIRE(LMB_OUT_0[0][1].offset() == 32896);
}
REQUIRE(LMB_OUT_0[1].size() == 0);
}
// Index 1
REQUIRE(LMB_IN_1.size() == 2);
if(LMB_IN_1.size() == 2) {
REQUIRE(LMB_IN_1[0].size() == 2);
if(LMB_IN_1[0].size() == 2) {
REQUIRE(LMB_IN_1[0][0].offset() == 32960);
REQUIRE(LMB_IN_1[0][1].offset() == 32832);
}
REQUIRE(LMB_IN_1[1].size() == 1);
if(LMB_IN_1[1].size() == 1) {
REQUIRE(LMB_IN_1[1][0].offset() == 32960);
}
}
REQUIRE(LMB_OUT_1.size() == 2);
if(LMB_OUT_1.size() == 2) {
REQUIRE(LMB_OUT_1[0].size() == 2);
if(LMB_OUT_1[0].size() == 2) {
REQUIRE(LMB_OUT_1[0][0].offset() == 32960);
REQUIRE(LMB_OUT_1[0][1].offset() == 32832);
}
REQUIRE(LMB_OUT_1[1].size() == 1);
if(LMB_OUT_1[1].size() == 1) {
REQUIRE(LMB_OUT_1[1][0].offset() == 32960);
}
}
}
// Block 2
if(mb->block_id == 2) {
std::cout << "BB2" << std::endl;
std::vector<std::vector<Address>> LMB_IN_0 = mb->lmb_in[0];
std::vector<std::vector<Address>> LMB_IN_1 = mb->lmb_in[1];
std::vector<std::vector<Address>> LMB_OUT_0 = mb->lmb_out[0];
std::vector<std::vector<Address>> LMB_OUT_1 = mb->lmb_out[1];
// Index 0
REQUIRE(LMB_IN_0.size() == 2);
if(LMB_IN_0.size() == 2) {
REQUIRE(LMB_IN_0[0].size() == 2);
if(LMB_IN_0[0].size() == 2) {
REQUIRE(LMB_IN_0[0][0].offset() == 32768);
REQUIRE(LMB_IN_0[0][1].offset() == 32896);
}
REQUIRE(LMB_IN_0[1].size() == 0);
}
REQUIRE(LMB_OUT_0.size() == 2);
if(LMB_OUT_0.size() == 2) {
REQUIRE(LMB_OUT_0[0].size() == 2);
if(LMB_OUT_0[0].size() == 2) {
REQUIRE(LMB_OUT_0[0][0].offset() == 32768);
REQUIRE(LMB_OUT_0[0][1].offset() == 32896);
}
REQUIRE(LMB_OUT_0[1].size() == 0);
}
// Index 1
REQUIRE(LMB_IN_1.size() == 2);
if(LMB_IN_1.size() == 2) {
REQUIRE(LMB_IN_1[0].size() == 2);
if(LMB_IN_1[0].size() == 2) {
REQUIRE(LMB_IN_1[0][0].offset() == 32960);
REQUIRE(LMB_IN_1[0][1].offset() == 32832);
}
REQUIRE(LMB_IN_1[1].size() == 1);
if(LMB_IN_1[1].size() == 1) {
REQUIRE(LMB_IN_1[1][0].offset() == 32960);
}
}
REQUIRE(LMB_OUT_1.size() == 2);
if(LMB_OUT_1.size() == 2) {
REQUIRE(LMB_OUT_1[0].size() == 2);
if(LMB_OUT_1[0].size() == 2) {
REQUIRE(LMB_OUT_1[0][0].offset() == 32832);
REQUIRE(LMB_OUT_1[0][1].offset() == 32960);
}
REQUIRE(LMB_OUT_1[1].size() == 1);
if(LMB_OUT_1[1].size() == 1) {
REQUIRE(LMB_OUT_1[1][0].offset() == 32960);
}
}
}
// Block 3
if(mb->block_id == 3) {
std::cout << "BB3" << std::endl;
std::vector<std::vector<Address>> LMB_IN_0 = mb->lmb_in[0];
std::vector<std::vector<Address>> LMB_IN_1 = mb->lmb_in[1];
std::vector<std::vector<Address>> LMB_OUT_0 = mb->lmb_out[0];
std::vector<std::vector<Address>> LMB_OUT_1 = mb->lmb_out[1];
// Index 0
REQUIRE(LMB_IN_0.size() == 1);
if(LMB_IN_0.size() == 1) {
REQUIRE(LMB_IN_0[0].size() == 2);
if(LMB_IN_0[0].size() == 2) {
REQUIRE(LMB_IN_0[0][0].offset() == 32768);
REQUIRE(LMB_IN_0[0][1].offset() == 32896);
}
}
REQUIRE(LMB_OUT_0.size() == 2);
if(LMB_OUT_0.size() == 2) {
REQUIRE(LMB_OUT_0[0].size() == 2);
if(LMB_OUT_0[0].size() == 2) {
REQUIRE(LMB_OUT_0[0][0].offset() == 32768);
REQUIRE(LMB_OUT_0[0][1].offset() == 32896);
}
REQUIRE(LMB_OUT_0[1].size() == 0);
}
// Index 1
REQUIRE(LMB_IN_1.size() == 1);
if(LMB_IN_1.size() == 1) {
REQUIRE(LMB_IN_1[0].size() == 2);
if(LMB_IN_1[0].size() == 2) {
REQUIRE(LMB_IN_1[0][0].offset() == 32832);
REQUIRE(LMB_IN_1[0][1].offset() == 32960);
}
}
REQUIRE(LMB_OUT_1.size() == 2);
if(LMB_OUT_1.size() == 2) {
REQUIRE(LMB_OUT_1[0].size() == 2);
if(LMB_OUT_1[0].size() == 2) {
REQUIRE(LMB_OUT_1[0][0].offset() == 32960);
REQUIRE(LMB_OUT_1[0][1].offset() == 32832);
}
REQUIRE(LMB_OUT_1[1].size() == 1);
if(LMB_OUT_1[1].size() == 1) {
REQUIRE(LMB_OUT_1[1][0].offset() == 32960);
}
}
}
// Block 4
if(mb->block_id == 4) {
std::cout << "BB4" << std::endl;
std::vector<std::vector<Address>> LMB_IN_0 = mb->lmb_in[0];
std::vector<std::vector<Address>> LMB_IN_1 = mb->lmb_in[1];
std::vector<std::vector<Address>> LMB_OUT_0 = mb->lmb_out[0];
std::vector<std::vector<Address>> LMB_OUT_1 = mb->lmb_out[1];
// Index 0
REQUIRE(LMB_IN_0.size() == 1);
if(LMB_IN_0.size() == 1) {
REQUIRE(LMB_IN_0[0].size() == 0);
}
REQUIRE(LMB_OUT_0.size() == 0);
// Index 1
REQUIRE(LMB_IN_1.size() == 1);
if(LMB_IN_1.size() == 1) {
REQUIRE(LMB_IN_1[0].size() == 1);
if(LMB_IN_1[0].size() == 1) {
REQUIRE(LMB_IN_1[0][0].offset() == 32960);
}
}
REQUIRE(LMB_OUT_1.size() == 0);
std::cout << "BB4_bis" << std::endl;
//LMB_OUT_0
REQUIRE(LMB_OUT_0.size() == 0);
std::cout << "BB4_bis2" << std::endl;
//LMB_OUT_1
REQUIRE(LMB_OUT_1.size() == 0);
std::cout << "BB4_bis3" << std::endl;
}
}
}
}
......
......@@ -5,27 +5,22 @@ CXXFLAGS=`otawa-config otawa/display --cflags`
LDLIBS=`otawa-config otawa/display --libs`
#ldlibs pour compiler la application
LDLIBS2=`otawa-config otawa/display otawa/classic_ecb --libs`
LDLIBS2=`otawa-config otawa/display otawa/classic_ecb otawa/ucb_otawa --libs`
ARMCC=arm-none-eabi-gcc
CXXFLAGS += -std=c++11 -O0 -g -I /home/fabien/cristal/otawa/include/ -I ../otawa-core2-build/otawa/include/elm/ -I ../include -I ../classic_ecb/include/
all: test_1 test_ecb
all: test_1 test_main
test_1: test_1.c
$(ARMCC) -nostdlib -nostdinc -static -o test_1 test_1.c
test_main.o: test_main.cpp
$(CXX) $(CXXFLAGS) -c test_main.cpp
test_main: test_main.cpp
$(CXX) $(CXXFLAGS) -o test_main test_main.cpp $(LDLIBS2)
test_ecb.o: test_ecb.cpp
$(CXX) $(CXXFLAGS) -c test_ecb.cpp
test_ecb: test_main.o test_ecb.o
$(CXX) $(CXXFLAGS) -o test_ecb test_main.o test_ecb.o $(LDLIBS2)
clean:
rm *.o
rm test_1
rm test_ecb
rm test_main
......@@ -2,8 +2,8 @@
<cache-config>
<icache>
<block_bits>5</block_bits>
<way_bits>2</way_bits>
<row_bits>5</row_bits>
<way_bits>1</way_bits>
<row_bits>7</row_bits>
<miss_penalty>70</miss_penalty>
</icache>
</cache-config>
int function_1() {
void fct1() {
int i = 0;
i++;
i++;
......@@ -8,36 +8,45 @@ int function_1() {
i++;
i++;
i++;
if(i > 5) {
i++;
i++;
i++;
i++;
}
int main() {
for(int i = 0; i < 100; i++) {
if(i == 5) {
function_1();
} else {
int j = 0;
j++;
j++;
j++;
j++;
j++;
j++;
j++;
i++;
i++;
i++;
i++;
i++;
i++;
}
i++;
i++;
i++;
i++;
}
int k = 0;
k++;
k++;
k++;
k++;
k++;
k++;
k++;
k++;
int main() {
int i = 0;
i++;
i++;
i++;
i++;
i++;
fct1();
i++;
i++;
i++;
for(i = 0; i < 10; i++) {
int hello = 0;
hello++;
fct1();
hello *= i;
}
i++;
i++;
i++;
i++;
}
// Function main
loop "main" + 0xfc max 10 total 10;
\ No newline at end of file
loop "main" + 0xb8 max 10 total 10;
\ No newline at end of file
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <otawa/app/Application.h>
#include <otawa/cfg/features.h>
#include <otawa/script/Script.h>
#include <otawa/prog/WorkSpace.h>
#include <otawa/proc/DynProcessor.h>
#include <otawa/cfg/Dominance.h>
#include <otawa/proc/DynFeature.h>
//includes pour l'affichage du CFG
#include <otawa/display/CFGOutput.h>
#include <elm/io/OutFileStream.h>
#include "../ucb_otawa/include/ucb_otawa.h"
#include <multiset.h>
using namespace otawa; //comme import
using namespace otawa::ucb_otawa;
using namespace Mathset;
TEST_CASE("test_1", "[UCB]") {
WorkSpace *ws = NULL;
PropList conf;
Manager manager;
NO_SYSTEM(conf) = true;
TASK_ENTRY(conf) = "main";
VERBOSE(conf) = true;
CACHE_CONFIG_PATH(conf) = "./cache.xml";
StringBuffer buf;
ws = manager.load("test_1", conf);
ws->require(DynFeature("otawa::ucb_otawa::UCB_OTAWA_FEATURE"), conf);
Multiset<Multiset<int>> ucb = UCB_OTAWA(ws);
std::vector<struct Element<Multiset<int>>> vect = ucb.get_multiset();
for(int i = 0; i < vect.size(); i++) {
for(int k = 0; k < vect[i].counter; k++) {
for(int j = 0; j < vect[i].elem.size(); j++) {
std::cout << vect[i].elem[j] << " ";
}
std::cout << endl;
}
}
REQUIRE(vect.size() == 27);
}
......@@ -9,7 +9,7 @@ LDLIBS2=`otawa-config otawa/display otawa/ucb_otawa --libs`
ARMCC=arm-none-eabi-gcc
CXXFLAGS += -std=c++11 -O0 -g -I ../otawa-core2-build/otawa/include/ -I ../otawa-core2-build/elm/include/ -I ../include/
CXXFLAGS += -std=c++11 -O0 -g -I ../include/
all: clean ucb_otawa.so install application binaire
......
......@@ -103,14 +103,18 @@ namespace otawa {
//pred
for(int j = 0; j < pred.size(); j++) {
pred[j]->succ.push_back(entry);
entry->pred.push_back(pred[j]);
for(int k = 0; k < entry->succ.size(); k++) {
pred[j]->succ.push_back(entry->succ[k]);
entry->succ[k]->pred.push_back(pred[j]);
}
}
//succ
for(int j = 0; j < succ.size(); j++) {
exit->succ.push_back(succ[j]);
succ[j]->pred.push_back(exit);
for(int k = 0; k < exit->pred.size(); k++) {
exit->pred[k]->succ.push_back(succ[j]);
succ[j]->pred.push_back(exit->pred[k]);
}
}
//remove link to synth block
......@@ -297,16 +301,41 @@ namespace otawa {
bool mark_always(struct preemption_node* node, int lb_id, Address cb_id, std::vector<int> visited) {
//If not visited yet
for(int i = 0; i < visited.size(); i++) {
if(visited[i] == node->id) {
Address bug_add(0, 33056);
if(cb_id == bug_add) {
// std::cout << "node id:" << node->id << std::endl;
}
if(cb_id == bug_add) {
// std::cout << "already visit" << std::endl;
}
//we return false because we do not encounter any block from the same CBL on this path
return false;
}
}
if(node->id == 0) {
// std::cout <<"############################################## HERE ##############" << std::endl;
}
Address bug_add(0, 33056);
if(cb_id == bug_add) {
// std::cout << node->id << " " << node->cb_id.offset() << " " << cb_id.offset() << std::endl;
}
if(node->cb_id == cb_id) {
Address bug_add(0, 33056);
if(cb_id == bug_add) {
// std::cout << "node id:" << node->id << std::endl;
}
if(cb_id == bug_add) {
//std::cout << "the node is the same" << std::endl;
}
//If the node is from the same CBL we return true
//It is the first block from this CBL encounter
return true;
......@@ -323,11 +352,21 @@ namespace otawa {
not_reach = false;
}
}
Address bug_add(0, 33056);
if(cb_id == bug_add) {
// std::cout << "node id:" << node->id << std::endl;
}
//if this block is contains in a hit path then we cachedthe CBL in it
if(not_reach) {
if(cb_id == bug_add) {
// std::cout << "not reach" << std::endl;
}
return false;
} else {
if(cb_id == bug_add) {
// std::cout << "reached" << std::endl;
}
node->cached.push_back(cb_id);
return true;
}
......@@ -336,6 +375,7 @@ namespace otawa {
bool mark_hit(struct preemption_node* node, int lb_id, Address cb_id, std::vector<int> visited, int loop_id) {
// if the node is not in the loop then it can't be in path that provoke an hit
if(is_in_loop(node, loop_id)) {
return false;
......@@ -426,6 +466,7 @@ namespace otawa {
node->cached.push_back(node->cb_id);
std::vector<int> visited;
visited.clear();
switch(node->status) {
case ALWAYS_HIT:
......@@ -492,9 +533,12 @@ namespace otawa {
void compute_line_useful_cache_blocks(struct preemption_graph* graph, const hard::Cache *cache, Multiset<Multiset<int>> &l) {
for(int i = 0; i < graph->nodes.size(); i++) {
if(graph->nodes[i]->lb) {
std::cout << "LB(" << graph->nodes[i]->id << ") ";
for(int j = 0; j < graph->nodes[i]->cached.size(); j++) {
graph->nodes[i]->useful.push_back(cache->line(graph->nodes[i]->cached[j]));
std::cout << graph->nodes[i]->useful[j] << " ";
}
std::cout << std::endl;
Multiset<int> tmp_m;
for(int k = 0; k < graph->nodes[i]->useful.size(); k++) {
tmp_m.add_elem(graph->nodes[i]->useful[k]);
......@@ -510,25 +554,27 @@ namespace otawa {
void explo(struct preemption_graph* graph) {
std::cout << "---------------------------START-------------------------" <<std::endl;
for(int i = 0; i < graph->nodes.size(); i++) {
std:: cout << "----" << std::endl;
if(graph->nodes[i]->bb) {
std::cout << "BB(" << graph->nodes[i]->id_b << ")" << std::endl;
//std::cout << "BB(" << graph->nodes[i]->id_b << ")" << std::endl;
} else {
if(graph->nodes[i]->synth) {
std::cout << "S(" << graph->nodes[i]->id_b << ")" << std::endl;
// std::cout << "S(" << graph->nodes[i]->id_b << ")" << std::endl;
explo(graph->nodes[i]->fct);
} else {
if(graph->nodes[i]->lb) {
std::cout << "LB(" << graph->nodes[i]->id << ")" << std::endl;
std::cout << "LB(" << graph->nodes[i]->id << ") " << graph->nodes[i]->cb_id.offset() << std::endl;
} else {
std::cout << "V(" << graph->nodes[i]->id_b << ")" << std::endl;
// std::cout << "V(" << graph->nodes[i]->id_b << ")" << std::endl;
}
}
}
if(graph->nodes[i]->lb) {
std::cout << "pred: ";
for(int j = 0; j < graph->nodes[i]->pred.size(); j++) {
if(graph->nodes[i]->pred[j]->lb) {
......@@ -564,14 +610,17 @@ namespace otawa {
}
}
std::cout << std::endl;
}
std::cout << "----" << std::endl;
}
std::cout << "---------------------------END-------------------------" <<std::endl;
}
void Ucb_otawaProcessor::processWorkSpace(WorkSpace *ws) {
const CFGCollection *coll = INVOLVED_CFGS(ws);
struct preemption_graph *graph = new struct preemption_graph;
......@@ -604,6 +653,7 @@ namespace otawa {
TOTAL_UCB(ws) = l_t;
// explo(graph);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment