-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmem.hpp
More file actions
51 lines (39 loc) · 712 Bytes
/
mem.hpp
File metadata and controls
51 lines (39 loc) · 712 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef MEM_HPP
#define MEM_HPP
#include "gates.hpp"
#include "mux.hpp"
#include <vector>
using namespace std;
class D_Latch
{
private:
bit q_bar;
bit q;
public:
D_Latch(bit start);
void run(bit data, bit write_enable);
bit get_q();
bit get_q_bar();
};
class D_Flip_Flop
{
private:
D_Latch master;
D_Latch slave;
public:
D_Flip_Flop(bit start);
void run(bit data, bit clk);
bit output();
bit complement();
};
class Parallel_Load_Register
{
private:
std::vector<D_Flip_Flop *> reggie;
public:
Parallel_Load_Register(bit start, int length);
void run(bit load, reg data, bit clk);
reg get_output();
~Parallel_Load_Register();
};
#endif