-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRam.h
40 lines (32 loc) · 937 Bytes
/
Ram.h
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
31
32
33
34
35
36
37
38
39
//
// Created by conrad on 11/7/17.
//
/* This is the RAM class which is controlled by an MMU object. No one but the MMU can manage this.
* read: returns a string at a specific address.
* write: writes a data to a specific address.
* write: writes a vector of strings to a specific address
* SIZE: The total number of RAM locations
* Ram(): The basic constructor for RAM
* ~RAM(): Deletes the RAM object; no other cleanup required
*/
#ifndef PHASE_2_RAM_H
#define PHASE_2_RAM_H
#include <mutex>
#include <vector>
#include <string>
#include <cstdlib>
class Ram
{
public:
std::string read(int address);
void write(int address, std::string data);
void write(int address, std::vector<std::string> s);
const static int SIZE = 1024;
Ram();
~Ram();
static void testRam();
private:
std::string ram_data[SIZE];
int ram_used;
};
#endif //PHASE_2_RAM_H