Otawa  0.10
Driver.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * Copyright (c) 2006, IRIT-UPS <casse@irit.fr>.
4  *
5  * otawa/sim/Driver.h -- Driver class interface.
6  */
7 #ifndef OTAWA_SIM_DRIVER_H
8 #define OTAWA_SIM_DRIVER_H
9 
10 #include <otawa/base.h>
11 
12 namespace otawa {
13 
14 // External classes
15 class Inst;
16 
17 namespace sim {
18 
19 // External classes
20 class State;
21 
22 // Driver class
23 class Driver {
24 public :
25  virtual ~Driver(void);
26 
27  // control flow
28  virtual Inst *nextInstruction(State& state, Inst *inst) = 0;
29  virtual void terminateInstruction(State& state, Inst *inst) = 0;
30 
31  // memory accesses
32  virtual Address lowerRead(void);
33  virtual Address upperRead(void);
34  virtual Address lowerWrite(void);
35  virtual Address upperWrite(void);
36 
37  // !!TODO!! remove them
38  virtual void redirect(State &state, Inst * branch, bool direction) {
39  };
40  virtual bool PredictBranch(State &state, Inst * branch, bool pred) {
41  return true; // branch correctly predicted
42  };
43 };
44 
45 } } // otawa::sim
46 
47 #endif // OTAWA_SIM_DRIVER_H
struct otawa::sem::inst inst
virtual Inst * nextInstruction(State &state, Inst *inst)=0
This method is called each time the simulator needs the next instruction to execute.
virtual ~Driver(void)
Definition: sim_Driver.cpp:22
virtual void terminateInstruction(State &state, Inst *inst)=0
This method is called when an instruction is terminated.
virtual Address upperRead(void)
Get the upper read address of the last executed instruction.
Definition: sim_Driver.cpp:58
This class is used to drive a simulator.
Definition: Driver.h:23
virtual Address upperWrite(void)
Get the upper written address of the last executed instruction.
Definition: sim_Driver.cpp:76
virtual bool PredictBranch(State &state, Inst *branch, bool pred)
Definition: Driver.h:40
The representation of an address in OTAWA.
Definition: base.h:54
virtual void redirect(State &state, Inst *branch, bool direction)
Definition: Driver.h:38
virtual Address lowerRead(void)
Get the lower read address of the last executed instruction.
Definition: sim_Driver.cpp:49
virtual Address lowerWrite(void)
Get the lower written address of the last executed instruction.
Definition: sim_Driver.cpp:67
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
This class represents a running simulator.
Definition: State.h:38
inst branch(int to)
Definition: inst.h:149