aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2017-12-06 16:32:34 +0100
committerYuchen Pei <me@ypei.me>2017-12-06 16:32:34 +0100
commit317270a4daf0bfa6ee1f287a3150f3f752d28391 (patch)
tree5add14d5147aacfb41a21c144adec79cc0b61abe
parentd4e7065850203ff97a1046615644f9a6f73eb523 (diff)
working through project 3
- reached RAM8
-rw-r--r--projects/03/a/Bit.hdl3
-rw-r--r--projects/03/a/Bit.out215
-rw-r--r--projects/03/a/RAM8.hdl12
-rw-r--r--projects/03/a/Register.hdl16
-rw-r--r--projects/03/a/Register.out149
5 files changed, 394 insertions, 1 deletions
diff --git a/projects/03/a/Bit.hdl b/projects/03/a/Bit.hdl
index 3064198..52e0539 100644
--- a/projects/03/a/Bit.hdl
+++ b/projects/03/a/Bit.hdl
@@ -15,4 +15,7 @@ CHIP Bit {
PARTS:
// Put your code here:
+ Mux (a=dffout, b=in, sel=load, out=muxout);
+ DFF (in=muxout, out=dffout);
+ Or (a=dffout, b=dffout, out=out);
}
diff --git a/projects/03/a/Bit.out b/projects/03/a/Bit.out
new file mode 100644
index 0000000..165c66d
--- /dev/null
+++ b/projects/03/a/Bit.out
@@ -0,0 +1,215 @@
+| time | in |load | out |
+| 0+ | 0 | 0 | 0 |
+| 1 | 0 | 0 | 0 |
+| 1+ | 0 | 1 | 0 |
+| 2 | 0 | 1 | 0 |
+| 2+ | 1 | 0 | 0 |
+| 3 | 1 | 0 | 0 |
+| 3+ | 1 | 1 | 0 |
+| 4 | 1 | 1 | 1 |
+| 4+ | 0 | 0 | 1 |
+| 5 | 0 | 0 | 1 |
+| 5+ | 1 | 0 | 1 |
+| 6 | 1 | 0 | 1 |
+| 6+ | 0 | 1 | 1 |
+| 7 | 0 | 1 | 0 |
+| 7+ | 1 | 1 | 0 |
+| 8 | 1 | 1 | 1 |
+| 8+ | 0 | 0 | 1 |
+| 9 | 0 | 0 | 1 |
+| 9+ | 0 | 0 | 1 |
+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0 | 0 |
+| 89 | 1 | 0 | 0 |
+| 89+ | 1 | 0 | 0 |
+| 90 | 1 | 0 | 0 |
+| 90+ | 1 | 0 | 0 |
+| 91 | 1 | 0 | 0 |
+| 91+ | 1 | 0 | 0 |
+| 92 | 1 | 0 | 0 |
+| 92+ | 1 | 0 | 0 |
+| 93 | 1 | 0 | 0 |
+| 93+ | 1 | 0 | 0 |
+| 94 | 1 | 0 | 0 |
+| 94+ | 1 | 0 | 0 |
+| 95 | 1 | 0 | 0 |
+| 95+ | 1 | 0 | 0 |
+| 96 | 1 | 0 | 0 |
+| 96+ | 1 | 0 | 0 |
+| 97 | 1 | 0 | 0 |
+| 97+ | 1 | 0 | 0 |
+| 98 | 1 | 0 | 0 |
+| 98+ | 1 | 0 | 0 |
+| 99 | 1 | 0 | 0 |
+| 99+ | 1 | 0 | 0 |
+| 100 | 1 | 0 | 0 |
+| 100+ | 1 | 0 | 0 |
+| 101 | 1 | 0 | 0 |
+| 101+ | 1 | 0 | 0 |
+| 102 | 1 | 0 | 0 |
+| 102+ | 1 | 0 | 0 |
+| 103 | 1 | 0 | 0 |
+| 103+ | 1 | 0 | 0 |
+| 104 | 1 | 0 | 0 |
+| 104+ | 1 | 0 | 0 |
+| 105 | 1 | 0 | 0 |
+| 105+ | 1 | 0 | 0 |
+| 106 | 1 | 0 | 0 |
+| 106+ | 1 | 0 | 0 |
+| 107 | 1 | 0 | 0 |
diff --git a/projects/03/a/RAM8.hdl b/projects/03/a/RAM8.hdl
index 4c0e070..8b25522 100644
--- a/projects/03/a/RAM8.hdl
+++ b/projects/03/a/RAM8.hdl
@@ -16,4 +16,14 @@ CHIP RAM8 {
PARTS:
// Put your code here:
-} \ No newline at end of file
+ DMux8Way (in=load, sel=address, out=loads);
+ Register (in=in, load=loads[0], out=outs[0]);
+ Register (in=in, load=loads[1], out=outs[1]);
+ Register (in=in, load=loads[2], out=outs[2]);
+ Register (in=in, load=loads[3], out=outs[3]);
+ Register (in=in, load=loads[4], out=outs[4]);
+ Register (in=in, load=loads[5], out=outs[5]);
+ Register (in=in, load=loads[6], out=outs[6]);
+ Register (in=in, load=loads[7], out=outs[7]);
+ Mux8Way(in=outs, sel=address, out=out);
+}
diff --git a/projects/03/a/Register.hdl b/projects/03/a/Register.hdl
index 926b99f..f4ec7ee 100644
--- a/projects/03/a/Register.hdl
+++ b/projects/03/a/Register.hdl
@@ -15,4 +15,20 @@ CHIP Register {
PARTS:
// Put your code here:
+ Bit (in=in[0], load=load, out=out[0]);
+ Bit (in=in[1], load=load, out=out[1]);
+ Bit (in=in[2], load=load, out=out[2]);
+ Bit (in=in[3], load=load, out=out[3]);
+ Bit (in=in[4], load=load, out=out[4]);
+ Bit (in=in[5], load=load, out=out[5]);
+ Bit (in=in[6], load=load, out=out[6]);
+ Bit (in=in[7], load=load, out=out[7]);
+ Bit (in=in[8], load=load, out=out[8]);
+ Bit (in=in[9], load=load, out=out[9]);
+ Bit (in=in[10], load=load, out=out[10]);
+ Bit (in=in[11], load=load, out=out[11]);
+ Bit (in=in[12], load=load, out=out[12]);
+ Bit (in=in[13], load=load, out=out[13]);
+ Bit (in=in[14], load=load, out=out[14]);
+ Bit (in=in[15], load=load, out=out[15]);
}
diff --git a/projects/03/a/Register.out b/projects/03/a/Register.out
new file mode 100644
index 0000000..2719604
--- /dev/null
+++ b/projects/03/a/Register.out
@@ -0,0 +1,149 @@
+| time | in |load | out |
+| 0+ | 0 | 0 | 0 |
+| 1 | 0 | 0 | 0 |
+| 1+ | 0 | 1 | 0 |
+| 2 | 0 | 1 | 0 |
+| 2+ | -32123 | 0 | 0 |
+| 3 | -32123 | 0 | 0 |
+| 3+ | 11111 | 0 | 0 |
+| 4 | 11111 | 0 | 0 |
+| 4+ | -32123 | 1 | 0 |
+| 5 | -32123 | 1 | -32123 |
+| 5+ | -32123 | 1 | -32123 |
+| 6 | -32123 | 1 | -32123 |
+| 6+ | -32123 | 0 | -32123 |
+| 7 | -32123 | 0 | -32123 |
+| 7+ | 12345 | 1 | -32123 |
+| 8 | 12345 | 1 | 12345 |
+| 8+ | 0 | 0 | 12345 |
+| 9 | 0 | 0 | 12345 |
+| 9+ | 0 | 1 | 12345 |
+| 10 | 0 | 1 | 0 |
+| 10+ | 1 | 0 | 0 |
+| 11 | 1 | 0 | 0 |
+| 11+ | 1 | 1 | 0 |
+| 12 | 1 | 1 | 1 |
+| 12+ | 2 | 0 | 1 |
+| 13 | 2 | 0 | 1 |
+| 13+ | 2 | 1 | 1 |
+| 14 | 2 | 1 | 2 |
+| 14+ | 4 | 0 | 2 |
+| 15 | 4 | 0 | 2 |
+| 15+ | 4 | 1 | 2 |
+| 16 | 4 | 1 | 4 |
+| 16+ | 8 | 0 | 4 |
+| 17 | 8 | 0 | 4 |
+| 17+ | 8 | 1 | 4 |
+| 18 | 8 | 1 | 8 |
+| 18+ | 16 | 0 | 8 |
+| 19 | 16 | 0 | 8 |
+| 19+ | 16 | 1 | 8 |
+| 20 | 16 | 1 | 16 |
+| 20+ | 32 | 0 | 16 |
+| 21 | 32 | 0 | 16 |
+| 21+ | 32 | 1 | 16 |
+| 22 | 32 | 1 | 32 |
+| 22+ | 64 | 0 | 32 |
+| 23 | 64 | 0 | 32 |
+| 23+ | 64 | 1 | 32 |
+| 24 | 64 | 1 | 64 |
+| 24+ | 128 | 0 | 64 |
+| 25 | 128 | 0 | 64 |
+| 25+ | 128 | 1 | 64 |
+| 26 | 128 | 1 | 128 |
+| 26+ | 256 | 0 | 128 |
+| 27 | 256 | 0 | 128 |
+| 27+ | 256 | 1 | 128 |
+| 28 | 256 | 1 | 256 |
+| 28+ | 512 | 0 | 256 |
+| 29 | 512 | 0 | 256 |
+| 29+ | 512 | 1 | 256 |
+| 30 | 512 | 1 | 512 |
+| 30+ | 1024 | 0 | 512 |
+| 31 | 1024 | 0 | 512 |
+| 31+ | 1024 | 1 | 512 |
+| 32 | 1024 | 1 | 1024 |
+| 32+ | 2048 | 0 | 1024 |
+| 33 | 2048 | 0 | 1024 |
+| 33+ | 2048 | 1 | 1024 |
+| 34 | 2048 | 1 | 2048 |
+| 34+ | 4096 | 0 | 2048 |
+| 35 | 4096 | 0 | 2048 |
+| 35+ | 4096 | 1 | 2048 |
+| 36 | 4096 | 1 | 4096 |
+| 36+ | 8192 | 0 | 4096 |
+| 37 | 8192 | 0 | 4096 |
+| 37+ | 8192 | 1 | 4096 |
+| 38 | 8192 | 1 | 8192 |
+| 38+ | 16384 | 0 | 8192 |
+| 39 | 16384 | 0 | 8192 |
+| 39+ | 16384 | 1 | 8192 |
+| 40 | 16384 | 1 | 16384 |
+| 40+ | -32768 | 0 | 16384 |
+| 41 | -32768 | 0 | 16384 |
+| 41+ | -32768 | 1 | 16384 |
+| 42 | -32768 | 1 | -32768 |
+| 42+ | -2 | 0 | -32768 |
+| 43 | -2 | 0 | -32768 |
+| 43+ | -2 | 1 | -32768 |
+| 44 | -2 | 1 | -2 |
+| 44+ | -3 | 0 | -2 |
+| 45 | -3 | 0 | -2 |
+| 45+ | -3 | 1 | -2 |
+| 46 | -3 | 1 | -3 |
+| 46+ | -5 | 0 | -3 |
+| 47 | -5 | 0 | -3 |
+| 47+ | -5 | 1 | -3 |
+| 48 | -5 | 1 | -5 |
+| 48+ | -9 | 0 | -5 |
+| 49 | -9 | 0 | -5 |
+| 49+ | -9 | 1 | -5 |
+| 50 | -9 | 1 | -9 |
+| 50+ | -17 | 0 | -9 |
+| 51 | -17 | 0 | -9 |
+| 51+ | -17 | 1 | -9 |
+| 52 | -17 | 1 | -17 |
+| 52+ | -33 | 0 | -17 |
+| 53 | -33 | 0 | -17 |
+| 53+ | -33 | 1 | -17 |
+| 54 | -33 | 1 | -33 |
+| 54+ | -65 | 0 | -33 |
+| 55 | -65 | 0 | -33 |
+| 55+ | -65 | 1 | -33 |
+| 56 | -65 | 1 | -65 |
+| 56+ | -129 | 0 | -65 |
+| 57 | -129 | 0 | -65 |
+| 57+ | -129 | 1 | -65 |
+| 58 | -129 | 1 | -129 |
+| 58+ | -257 | 0 | -129 |
+| 59 | -257 | 0 | -129 |
+| 59+ | -257 | 1 | -129 |
+| 60 | -257 | 1 | -257 |
+| 60+ | -513 | 0 | -257 |
+| 61 | -513 | 0 | -257 |
+| 61+ | -513 | 1 | -257 |
+| 62 | -513 | 1 | -513 |
+| 62+ | -1025 | 0 | -513 |
+| 63 | -1025 | 0 | -513 |
+| 63+ | -1025 | 1 | -513 |
+| 64 | -1025 | 1 | -1025 |
+| 64+ | -2049 | 0 | -1025 |
+| 65 | -2049 | 0 | -1025 |
+| 65+ | -2049 | 1 | -1025 |
+| 66 | -2049 | 1 | -2049 |
+| 66+ | -4097 | 0 | -2049 |
+| 67 | -4097 | 0 | -2049 |
+| 67+ | -4097 | 1 | -2049 |
+| 68 | -4097 | 1 | -4097 |
+| 68+ | -8193 | 0 | -4097 |
+| 69 | -8193 | 0 | -4097 |
+| 69+ | -8193 | 1 | -4097 |
+| 70 | -8193 | 1 | -8193 |
+| 70+ | -16385 | 0 | -8193 |
+| 71 | -16385 | 0 | -8193 |
+| 71+ | -16385 | 1 | -8193 |
+| 72 | -16385 | 1 | -16385 |
+| 72+ | 32767 | 0 | -16385 |
+| 73 | 32767 | 0 | -16385 |
+| 73+ | 32767 | 1 | -16385 |
+| 74 | 32767 | 1 | 32767 |