-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemory.h
More file actions
31 lines (26 loc) · 698 Bytes
/
memory.h
File metadata and controls
31 lines (26 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef MEMORY_H_
#define MEMORY_H_
#include <string>
#include <vector>
#include <fstream>
#include <cstdint>
using numtype = std::uint32_t;
class Memory {
public:
Memory();
Memory(std::string file);
void load(std::string file);
Memory& operator>>(numtype& x);
void setPC(int x);
int getPC();
int getMem(int array, int pos);
std::vector<numtype> getMem(int array);
void setMem(int array, int pos, int val);
void setMem(int array, std::vector<numtype> vec);
int newArray(int size);
void clearArray(int pos);
private:
std::vector<std::vector<numtype>> ops;
int pc;
};
#endif