Bug fix: check if vm exists
[avr-sim.git] / Instruction.h
blob0910047c94a6d6a9629bfea618921d4fd7c54e20
1 #ifndef INSTRUCTION_H
2 #define INSTRUCTION_H
4 #include "Exception.h"
5 #include "Format.h"
6 #include "Types.h"
8 namespace avr {
10 class Core;
12 class IllegalInstruction : public util::Exception {
13 public:
14 IllegalInstruction(word opcode)
15 : Exception( util::format("Illegal Instruction: %x") % opcode ) {}
18 /**
19 * \author Tom Haber
20 * \date 21 April 2008
22 * An interface for all Instructions on the chip.
24 class Instruction {
25 public:
26 Instruction() {}
27 virtual ~Instruction() {}
29 public:
30 virtual int operator()(Core *core) = 0;
31 virtual int trace(Core *core, std::ostream & ostr) = 0;
32 virtual bool is2Word() const { return false; }
37 #endif /*INSTRUCTION_H*/