Bug fix: check if vm exists
[avr-sim.git] / MMU.h
blobda199d6542bde151a6f680c22e52bd702424ebfe
1 #ifndef AVR_MMU_H
2 #define AVR_MMU_H
4 #include "Memory.h"
6 namespace avr {
7 class Register;
8 class IORegisters;
9 class SRam;
10 class ERam;
12 class MMU {
13 public:
14 MMU(Register R[], IORegisters & regs, SRam & sram, ERam *eram = 0);
16 public:
17 /**
18 * Reads a single bytes of raw data from memory at
19 * offset \e offset.
21 * \exception AccessViolation { When the data requested is
22 * not available, this exception is thrown }
24 byte readByte(unsigned int offset) const;
26 /**
27 * Reads a word of raw data from memory starting at
28 * offset \e offset.
30 * \exception AccessViolation { When the data requested is
31 * not available, this exception is thrown }
33 word readWord(unsigned int offset) const;
35 /**
36 * Reads a single bytes of raw data from memory at
37 * offset \e offset.
39 * \exception AccessViolation { When the data requested is
40 * not available, this exception is thrown }
42 void writeByte(unsigned int offset, byte val);
44 /**
45 * Reads a word of raw data from memory starting at
46 * offset \e offset.
48 * \exception AccessViolation { When the data requested is
49 * not available, this exception is thrown }
51 void writeWord(unsigned int offset, word val);
53 private:
54 static const unsigned int registerSpaceSize = 32;
55 Register *R;
56 IORegisters & regs;
57 SRam & sram;
58 ERam *eram;
62 #endif /*AVR_MMU_H_*/