avr: Fix documentation for Bus
[avr-sim.git] / src / Decoder.h
blob55a4ca1ae349b1718927b36fa9a088aed3d1de38
1 #ifndef AVR_DECODER_H
2 #define AVR_DECODER_H
4 #include <vector>
5 #include "Types.h"
7 namespace avr {
9 class Instruction;
11 /**
12 * @author Tom Haber
13 * @date Apr 23, 2008
14 * @brief Instruction Decoder
16 * The decoder can decode instruction opcodes and returns
17 * Instruction classes capable of executing the instruction.
19 * For performance reasons, it contains a big table with all
20 * possible opcodes and accompanying Instruction instance.
22 class Decoder {
23 public:
24 Decoder();
26 public:
27 Instruction & decode( word opcode ) const;
28 bool is2WordInstruction( word opcode ) const;
30 private:
31 Instruction *lookupOpcode( word opcode );
33 private:
34 static std::vector<Instruction *> lut;
37 inline Instruction & Decoder::decode( word opcode ) const {
38 return *lut[opcode];
43 #endif /*AVR_DECODER_H*/