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

ajout ucb_otawa

parent 31667bbd
Branches
No related tags found
No related merge requests found
Showing
with 1683 additions and 245 deletions
......@@ -47,9 +47,6 @@ namespace otawa {
if(lmb_vect[j].size() != 0) {
for(int k = 0; k < true_rmb_vect.size(); k++) {
std::vector<Address> rmb_vect = true_rmb_vect[k];
if(rmb_vect.size() != 0) {
// for each different rmb set
int nb_hit = 0;
......@@ -77,7 +74,6 @@ namespace otawa {
} //for l
if(nb_hit > nb_hit_max) {
nb_hit_max = nb_hit;
}
......@@ -122,7 +118,6 @@ namespace otawa {
// COMPUTATION OF THE TOTAL UCB MULTISET
Mathset::Multiset<int> total_ucb;
for (CFGCollection::Iter cfg_iter(*coll); cfg_iter(); cfg_iter++)
{
for (CFG::BlockIter block_iter = cfg_iter->blocks(); block_iter(); block_iter++)
......@@ -136,7 +131,6 @@ namespace otawa {
Mathset::Multiset<int> tmp_ucb_out = UCB_LOCAL_OUT(bb);
total_ucb = math_multiset_fusion(total_ucb, tmp_ucb_in);
total_ucb = math_multiset_fusion(total_ucb, tmp_ucb_out);
}
}
}
......
......@@ -3,7 +3,7 @@ CXXFLAGS += -std=c++11 -O0 -g -I /home/fabien/cristal/otawa/include/ -I ../otawa
ARMCC=arm-none-eabi-gcc
all: application test basic big_function
all: application basic big_function
application: application.o
$(CXX) -o application application.o $(LDLIBS2)
......@@ -17,5 +17,4 @@ big_function: big_function.c
$(ARMCC) -nostdlib -nostdinc -static -o big_function big_function.c
test: test.sh big_function
./test.sh
No preview for this file type
......@@ -37,59 +37,62 @@ int main(int argc, char **argv) {
TASK_ENTRY(conf) = "main";
VERBOSE(conf) = true;
if (argc < 5) {
fprintf(stderr, "usage: %s <binary> <flow fact> <cache> <sortie>\n", argv[0]);
StringBuffer buf;
buf << argv[1] << "-decomp.c";
elm::io::OutFileStream s(buf.toString());
elm::io::Output out(s);
conf.print(out);
std::cout << "#### chargement tache ####" << std::endl;
ws = manager.load(argv[1], conf);
ws->require(otawa::ipet::FLOW_FACTS_FEATURE,conf);
if (argc < 4) {
fprintf(stderr, "usage: %s <binary> <cache> <sortie>\n", argv[0]);
exit(1);
}
std::cout << "#### chargement cache ####" << std::endl;
CACHE_CONFIG_PATH(conf) = argv[3];
std::cout << "#### chargement flow fact ####" << std::endl;
FLOW_FACTS_PATH(conf) = argv[2];
CACHE_CONFIG_PATH(conf) = argv[2];
StringBuffer buf;
buf << argv[1] << "-decomp.c";
elm::io::OutFileStream s(buf.toString());
elm::io::Output out(s);
conf.print(out);
std::cout << "#### chargement tache ####" << std::endl;
ws = manager.load(argv[1], conf);
std::cout << "#### execution plugin ####" << std::endl;
ws->require(otawa::ipet::FLOW_FACTS_FEATURE,conf);
ws->require(DynFeature("otawa::UCB_local::UCB_LOCAL_FEATURE"), conf);
ws->require(DynFeature("otawa::classic_ecb::CLASSIC_ECB_PROCESSOR"), conf);
ws->require(otawa::ipet::ILP_SYSTEM_FEATURE, conf);
ws->require(otawa::ipet::WCET_FEATURE, conf);
long wcet = ipet::WCET(ws);
std::cout << "#### result ####" << std::endl;
long wcet = 0;
Multiset<int> ucbs = TOTAL_UCB(ws);
// for(auto iter = (*ucbs).begin(); iter != (*ucbs).end(); iter++) {
// (*iter)->print_vector();
// }
Multiset<int> *ecbs = ECBS(ws);
std::cout << "---------WCET: " << wcet << "--------------" << std::endl;
std::ofstream f(argv[4]);
f << "Task t(" << wcet << ", 10, 10 ,{";
std::ofstream f(argv[3]);
f << argv[1] <<"(" << wcet << ", 10, 10 ," << std::endl << "{";
ecbs->to_string(f);
f << "},{";
f << "}," << std::endl << "{";
ucbs.to_string(f);
f << "}," << std::endl << "{";
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();
Mathset::Multiset<int> ucb_in = UCB_LOCAL_IN(bb);
Mathset::Multiset<int> ucb_out = UCB_LOCAL_OUT(bb) ;
if(ucb_in.size() != 0) {
f << "{";
ucb_in.to_string(f);
f << "}";
}
if(ucb_out.size() != 0) {
f << "{";
ucb_out.to_string(f);
f << "}";
}
}
}
}
f << "})" << endl;
f.close();
......
......@@ -3,8 +3,8 @@
<icache>
<block_bits>6</block_bits>
<way_bits>1</way_bits>
<row_bits>4</row_bits>
<way_bits>2</way_bits>
<row_bits>6</row_bits>
<miss_penalty>70</miss_penalty>
</icache>
</cache-config>
......@@ -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/
all: clean explo.so install application binaire one_function loop condition large_code large_loop
all: clean explo.so install application binaire one_function loop condition large_code large_loop test_new_graph
binaire: binaire.c
$(ARMCC) -nostdlib -nostdinc -static -o binaire binaire.c
......@@ -34,6 +34,9 @@ one_function: one_function.c
large_code: large_code.c
$(ARMCC) -nostdlib -nostdinc -static -o large_code large_code.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)
......
No preview for this file type
......@@ -27,7 +27,7 @@ int main(int argc, char **argv) {
TASK_ENTRY(conf) = "main";
VERBOSE(conf) = true;
CACHE_CONFIG_PATH(conf) = "./cache_simple.xml";
CACHE_CONFIG_PATH(conf) = "./cache.xml";
StringBuffer buf;
buf << argv[1] << "-decomp.c";
elm::io::OutFileStream s(buf.toString());
......
No preview for this file type
{ ID(otawa::CACHE_CONFIG_PATH) = ./cache_simple.xml, ID(otawa::VERBOSE) = true, ID(otawa::TASK_ENTRY) = main, ID(otawa::NO_SYSTEM) = true }
\ No newline at end of file
{ ID(otawa::CACHE_CONFIG_PATH) = ./cache.xml, ID(otawa::VERBOSE) = true, ID(otawa::TASK_ENTRY) = main, ID(otawa::NO_SYSTEM) = true }
\ No newline at end of file
void foo() {
int i;
if (i) {
int main() {
int i = 0;
i++;
i++;
i++;
for(int j = 0; j < 10; j++) {
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
}
}
void bar() {
int i;
for (i = 0; i < 10; i++) {
}
}
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
int main(void) {
int i;
for (i = 0; i < 10; i++) {
if (i % 2) {
foo();
} else {
bar();
}
if (i % 3) {
continue;
}
i += 2;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
}
}
......@@ -3,7 +3,7 @@
<icache>
<block_bits>2</block_bits>
<way_bits>1</way_bits>
<row_bits>4</row_bits>
<row_bits>1</row_bits>
<miss_penalty>70</miss_penalty>
</icache>
</cache-config>
......@@ -97,7 +97,7 @@ namespace otawa {
std::cout << "-------------------" << std::endl;
std::cout << "Block: " << b->id() << " ";
if(b->isBasic()) {
std::cout << "Basic ";
std::cout << "Basic " << std::endl;
AllocArray<LBlock *> *lblock_array = BB_LBLOCKS(b->toBasic());
if (lblock_array != NULL)
......@@ -107,18 +107,37 @@ namespace otawa {
{
LBlock *lb = (*lblock_array)[i];
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::endl;;
std::cout << cache->line(lb_id) << ":" <<lb_id.page() << ":" << lb_id.offset() << " " ;
switch(status) {
case FIRST_HIT:
std::cout << "FIRST_HIT" << std::endl;
break;
case FIRST_MISS:
std::cout << "FIRST_MISS" << std::endl;
break;
case ALWAYS_HIT:
std::cout << "ALWAYS_HIT" << std::endl;
break;
case ALWAYS_MISS:
std::cout << "ALWAYS_MISS" << std::endl;
break;
default:
break;
}
}
}
} else {
if(b->isSynth()) {
std::cout << "Synth ";
std::cout << "Synth " << std::endl;
}
else {
std::cout << std::endl;
}
}
for(Block::EdgeIter iter_suc(b->outs());
iter_suc();
iter_suc++) {
......@@ -128,6 +147,15 @@ namespace otawa {
std::cout << "B" << target->id() << " ";
}
std::cout << std::endl;
for(Block::EdgeIter iter_suc(b->ins());
iter_suc();
iter_suc++) {
Edge *edge = *iter_suc;
Block *target = edge->target();
std::cout << "B" << target->id() << " ";
}
std::cout << std::endl;
std::cout << "-------------------" << std::endl;
}
......
......@@ -67,37 +67,37 @@ 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;
//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::cout <<"[" << i << "]" << " ";
std::vector<std::vector<Address>> tmp_set = mb->rmb_in[i].get_set();
for(int j = 0; j < tmp_set.size(); j++) {
std::cout << "{";
//std::cout << "{";
for(int k = 0; k < tmp_set[j].size(); k++) {
std::cout << tmp_set[j][k].offset() << " ";
//std::cout << tmp_set[j][k].offset() << " ";
}
std::cout << "}";
//std::cout << "}";
}
std::cout << std::endl;
//std::cout << std::endl;
}
std::cout << std::endl;
std::cout << "RMB_OUT" << std::endl;
//std::cout << std::endl;
//std::cout << "RMB_OUT" << std::endl;
for(int i = 0; i < nb_index; i++) {
std::cout <<"[" << i << "]" << " ";
//std::cout <<"[" << i << "]" << " ";
std::vector<std::vector<Address>> tmp_set = mb->rmb_out[i].get_set();
for(int j = 0; j < tmp_set.size(); j++) {
std::cout << "{";
//std::cout << "{";
for(int k = 0; k < tmp_set[j].size(); k++) {
std::cout << tmp_set[j][k].offset() << " ";
//std::cout << tmp_set[j][k].offset() << " ";
}
std::cout << "}";
//std::cout << "}";
}
std::cout << std::endl;
//std::cout << std::endl;
}
std::cout << std::endl;
std::cout << "-----------------------" << std::endl;
//std::cout << std::endl;
//std::cout << "-----------------------" << std::endl;
}
const otawa::hard::Cache *get_cache(WorkSpace *ws)
......@@ -237,11 +237,11 @@ namespace otawa
void mark_last_bb_bis(Block *b_fct_exit, struct Memory_block *mb, std::vector<Block *> visited)
{
visited.push_back(b_fct_exit);
std::cout << "Block: " << b_fct_exit->id() << std::endl;
//std::cout << "Block: " << b_fct_exit->id() << std::endl;
if (b_fct_exit->isBasic())
{
struct Memory_block *mb_pred = MB_STRUCT(b_fct_exit);
std::cout << "----------------------------- FOUND pred" << std::endl;
//std::cout << "----------------------------- FOUND pred" << std::endl;
mb_pred->suc.push_back(mb);
mb->pred.push_back(mb_pred);
}
......@@ -249,7 +249,7 @@ namespace otawa
{
if (b_fct_exit->isSynth())
{
std::cout << "is synth" << std::endl;
//std::cout << "is synth" << std::endl;
std::vector<Block *> v_tmp;
mark_last_bb_bis(b_fct_exit->toSynth()->callee()->exit(), mb, v_tmp);
}
......@@ -260,18 +260,18 @@ namespace otawa
iter_pred();
iter_pred++)
{
std::cout << "here" << std::endl;
//std::cout << "here" << std::endl;
Edge *edge = *iter_pred;
Block *target = edge->target();
std::cout << "Block: " << target->id() << std::endl;
//std::cout << "Block: " << target->id() << std::endl;
if (not_present_in_vect(visited, target))
{
std::cout << "not present" << std::endl;
//std::cout << "not present" << std::endl;
mark_last_bb_bis(target, mb, visited);
}
else
{
std::cout << "present in list" << std::endl;
//std::cout << "present in list" << std::endl;
}
}
}
......@@ -285,7 +285,7 @@ namespace otawa
{
struct Memory_block *mb = MB_STRUCT(main_suc);
std::vector<Block *> v_tmp;
std::cout << "----------------------------- FOUND suc" << std::endl;
//std::cout << "----------------------------- FOUND suc" << std::endl;
mark_last_bb_bis(b_fct_exit, mb, v_tmp);
}
else
......@@ -459,31 +459,31 @@ namespace otawa
// return gen;
// }
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: ";
//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 << mb->suc[i]->block_id << " ";
}
std::cout << std::endl << "--lmb_gen--";
//std::cout << std::endl << "--lmb_gen--";
for (int i = 0; i < nb_index;i++)
{
std::cout << std::endl << "[" << 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 << " " << mb->lmb_gen[i][j].page() << ":" << mb->lmb_gen[i][j].offset();
}
}
std::cout << std::endl << "--rmb_gen--";
//std::cout << std::endl << "--rmb_gen--";
for (int i = 0; i < nb_index;i++)
{
std::cout << std::endl << "[" << i << "]=";
//std::cout << std::endl << "[" << i << "]=";
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 << " " << mb->rmb_gen[i][j].page() << ":" << mb->rmb_gen[i][j].offset();
}
}
std::cout << std::endl << "-----------------------" << std::endl;
//std::cout << std::endl << "-----------------------" << std::endl;
}
......@@ -502,12 +502,12 @@ namespace otawa
vect[cache->line(lb->address())].push_back(lb_id);
}
std::cout << "--------------------VECTORS--------------------" << std::endl;
//std::cout << "--------------------VECTORS--------------------" << std::endl;
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 << vect[i][j].offset() << " ";
}
std::cout << std::endl;
//std::cout << std::endl;
}
for (int index_tmp = 0; index_tmp < nb_index; index_tmp++)
{
......@@ -533,54 +533,54 @@ namespace otawa
void print_gen(struct Memory_block *mb,int nb_index ,int nb_way)
{
std::cout << "-----------------------" << std::endl;
std::cout << "id=" << mb->block_id << std::endl;
//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;
//std::cout << "size lmb_gen[" << i << "]=" << mb->lmb_gen[i].size() << std::endl;
}
for (int i = 0; i < nb_index; i++)
{
std::cout << "size rmb_gen[" << i << "]=" << mb->rmb_gen[i].size() << std::endl;
//std::cout << "size rmb_gen[" << i << "]=" << mb->rmb_gen[i].size() << std::endl;
}
for (int i = 0; i < nb_index; i++)
{
std::cout << "size rmb_in[" << i << "]=" << mb->rmb_in[i].size() << std::endl;
//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::cout << "size rmb_in[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
//std::cout << "size rmb_in[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
}
}
for (int i = 0; i < nb_index; i++)
{
std::cout << "size rmb_out[" << i << "]=" << mb->rmb_out[i].size() << std::endl;
//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::cout << "size rmb_out[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
//std::cout << "size rmb_out[" << i << "][" << j << "]=" << tmp[j].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::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::cout << "size lmb_in[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
//std::cout << "size lmb_in[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
}
}
for (int i = 0; i < nb_index; i++)
{
std::cout << "size lmb_out[" << i << "]=" << mb->lmb_out[i].size() << std::endl;
//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::cout << "size lmb_out[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
//std::cout << "size lmb_out[" << i << "][" << j << "]=" << tmp[j].size() << std::endl;
}
}
std::cout << "-----------------------" << std::endl;
//std::cout << "-----------------------" << std::endl;
}
//////////////////////////////////////////////////////////
......@@ -769,7 +769,7 @@ namespace otawa
void Initialize_RMB_LMBProcessor::processWorkSpace(WorkSpace *ws)
{
std::cout << "####################################################################################### START ################################################################################" << std::endl;
//std::cout << "####################################################################################### START ################################################################################" << std::endl;
const CFGCollection *coll = INVOLVED_CFGS(ws);
const otawa::hard::Cache *cache = get_cache(ws);
......@@ -777,22 +777,22 @@ namespace otawa
int nb_index = cache->rowCount();
int nb_way = cache->wayCount();
std::cout << "Create structure" << std::endl;
//std::cout << "Create structure" << std::endl;
// create structures
create_structure(coll, nb_index, nb_way);
std::cout << "Link structure" << std::endl;
//std::cout << "Link structure" << std::endl;
// links structures
link_structure(coll, nb_way, nb_index);
std::cout << "initialize structure" << std::endl;
//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;
//std::cout << "COMPUTE LMB and RMB" << std::endl;
// RMB
......
int main() {
int i = 0;
i++;
i++;
i++;
for(int j = 0; j < 10; j++) {
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
}
}
#cflags pour tout compiler
CXXFLAGS=`otawa-config otawa/display --cflags`
#ldlibs pour compiler le plugin
LDLIBS=`otawa-config otawa/display otawa/cache_block_id --libs`
#ldlibs pour compiler la application
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/
all: clean ucb_otawa.so install application binaire
binaire: binaire.c
$(ARMCC) -nostdlib -nostdinc -static -o binaire binaire.c
##debut
application: application.o
$(CXX) -o application application.o $(LDLIBS2)
application.o: application.cpp
ucb_otawa.so: ucb_otawa.cpp include/ucb_otawa.h
$(CXX) -fPIC -shared $(CXXFLAGS) -o ucb_otawa.so ucb_otawa.cpp $(LDLIBS)
##fin
clean:
rm -f *.o application binaire *~ *.dot *.ps *.so
install: ucb_otawa.so
mkdir -p $(HOME)/.otawa/proc/otawa
cp ucb_otawa.eld $(HOME)/.otawa/proc/otawa/
cp ucb_otawa.so $(HOME)/.otawa/proc/otawa/
.PHONY: all test clean graph
File added
#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 "include/ucb_otawa.h"
#include <multiset.h>
using namespace otawa; //comme import
using namespace otawa::ucb_otawa;
using namespace Mathset;
int main(int argc, char **argv) {
if (argc != 2) {
fprintf(stderr, "usage: %s <binary> ", argv[0]);
exit(1);
}
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;
buf << argv[1] << "-decomp.c";
elm::io::OutFileStream s(buf.toString());
elm::io::Output out(s);
conf.print(out);
ws = manager.load(argv[1], conf);
ws->require(DynFeature("otawa::ucb_otawa::UCB_OTAWA_FEATURE"), conf);
Multiset<std::vector<int>> ucb = UCB_OTAWA(ws);
std::vector<std::vector<int>> vect = ucb.get_set();
for(int i = 0; i < vect.size(); i++) {
for(int j = 0; j < vect[i].size(); j++) {
std::cout << vect[i][j] << " ";
}
std::cout << endl;
}
}
File added
{ ID(otawa::CACHE_CONFIG_PATH) = ./cache.xml, ID(otawa::VERBOSE) = true, ID(otawa::TASK_ENTRY) = main, ID(otawa::NO_SYSTEM) = true }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment