nanojpeg: record trace
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1777 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -11,6 +11,7 @@ set(MY_PROTOS
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(MY_CAMPAIGN_SRCS
|
set(MY_CAMPAIGN_SRCS
|
||||||
|
experimentInfo.hpp
|
||||||
instantiateExperiment.cc
|
instantiateExperiment.cc
|
||||||
experiment.hpp
|
experiment.hpp
|
||||||
experiment.cc
|
experiment.cc
|
||||||
|
|||||||
@ -7,13 +7,14 @@
|
|||||||
#include "util/Logger.hpp"
|
#include "util/Logger.hpp"
|
||||||
|
|
||||||
#include "experiment.hpp"
|
#include "experiment.hpp"
|
||||||
//#include "experimentInfo.hpp"
|
#include "experimentInfo.hpp"
|
||||||
//#include "campaign.hpp"
|
//#include "campaign.hpp"
|
||||||
|
|
||||||
#include "sal/SALConfig.hpp"
|
#include "sal/SALConfig.hpp"
|
||||||
#include "sal/SALInst.hpp"
|
#include "sal/SALInst.hpp"
|
||||||
#include "sal/Memory.hpp"
|
#include "sal/Memory.hpp"
|
||||||
#include "sal/Listener.hpp"
|
#include "sal/Listener.hpp"
|
||||||
|
#include "sal/Register.hpp"
|
||||||
|
|
||||||
// you need to have the tracing plugin enabled for this
|
// you need to have the tracing plugin enabled for this
|
||||||
#include "../plugins/tracing/TracingPlugin.hpp"
|
#include "../plugins/tracing/TracingPlugin.hpp"
|
||||||
@ -37,14 +38,27 @@ bool NanoJPEGExperiment::run()
|
|||||||
log << "startup" << endl;
|
log << "startup" << endl;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// STEP 1: run until main starts, save state
|
// STEP 1: run until main starts, save state, record trace
|
||||||
// TODO: record trace, store golden run output
|
// TODO: store golden run output
|
||||||
IOPortListener io(0x3f8, true);
|
IOPortListener io(0x3f8, true);
|
||||||
simulator.addListenerAndResume(&io);
|
simulator.addListenerAndResume(&io);
|
||||||
|
|
||||||
log << "main() reached, saving state" << endl;
|
log << "main() reached, saving state" << endl;
|
||||||
simulator.save(statename);
|
simulator.save(statename);
|
||||||
|
|
||||||
|
// record trace
|
||||||
|
log << "restoring state" << endl;
|
||||||
|
simulator.restore(statename);
|
||||||
|
log << "EIP = " << hex << simulator.getRegisterManager().getInstructionPointer() << endl;
|
||||||
|
log << "enabling tracing" << endl;
|
||||||
|
TracingPlugin tp;
|
||||||
|
tp.setLogIPOnly(true);
|
||||||
|
ofstream of(NANOJPEG_TRACE);
|
||||||
|
tp.setTraceFile(&of);
|
||||||
|
// this must be done *after* configuring the plugin:
|
||||||
|
simulator.addFlow(&tp);
|
||||||
|
|
||||||
|
// count instructions
|
||||||
simulator.addListener(&io);
|
simulator.addListener(&io);
|
||||||
BPSingleListener step(ANY_ADDR);
|
BPSingleListener step(ANY_ADDR);
|
||||||
long counter = 0;
|
long counter = 0;
|
||||||
@ -55,7 +69,9 @@ bool NanoJPEGExperiment::run()
|
|||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
log << "golden run took " << counter << " instructions" << endl;
|
log << "golden run took " << dec << counter << " instructions" << endl;
|
||||||
|
simulator.removeFlow(&tp);
|
||||||
|
of.close();
|
||||||
#endif
|
#endif
|
||||||
// Explicitly terminate, or the simulator will continue to run.
|
// Explicitly terminate, or the simulator will continue to run.
|
||||||
simulator.terminate();
|
simulator.terminate();
|
||||||
|
|||||||
11
src/experiments/nanojpeg/experimentInfo.hpp
Normal file
11
src/experiments/nanojpeg/experimentInfo.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef __NANOJPEG_EXPERIMENT_INFO_HPP__
|
||||||
|
#define __NANOJPEG_EXPERIMENT_INFO_HPP__
|
||||||
|
|
||||||
|
#define NANOJPEG_TRACE "trace.tc"
|
||||||
|
#define NANOJPEG_ELF "system.elf"
|
||||||
|
#define NANOJPEG_BIN "system.bin"
|
||||||
|
#define NANOJPEG_BIN_OFFSET 0x100000
|
||||||
|
#define NANOJPEG_RESULTS "nanojpeg.csv"
|
||||||
|
#define NANOJPEG_INSTR_LIMIT 999999999 // currently "unlimited"
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user