aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/programmemory.h
blob: 14187c5201926b6bfde8a439151450c79f37e865 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef PROGRAMMEMORY_H
#define PROGRAMMEMORY_H

#include <vector>
#include "programloader.h"
#include "memory.h"
#include "instruction.h"

class ProgramMemory {
public:
    ProgramMemory(MemoryAccess *memory);

    void load(ProgramLoader *l);
    Instruction *at(std::uint32_t address); // return instruction isntance for given address

private:
    MemoryAccess *memory;
    Instruction *decode_r(std::uint32_t dt);
    Instruction *decode_j(std::uint32_t dt, std::uint8_t opcode);
    Instruction *decode_i(std::uint32_t dt, std::uint8_t opcode);
};

#endif // PROGRAMMEMORY_H