diff options
author | Yuchen Pei <me@ypei.me> | 2017-12-15 16:09:35 +0100 |
---|---|---|
committer | Yuchen Pei <me@ypei.me> | 2017-12-15 16:09:35 +0100 |
commit | a564e06beb41a73fb635fac9aef4ca50bc8843b9 (patch) | |
tree | d2ee4b1d20f431b9026762fa3b207b48461a0c28 | |
parent | ec61018d15ba4ad0a41e1ab44d7e1ecb5f2870d2 (diff) |
finished memory.hdl in project 5
-rw-r--r-- | projects/05/Memory.hdl | 17 | ||||
-rw-r--r-- | projects/05/Memory.out | 54 |
2 files changed, 70 insertions, 1 deletions
diff --git a/projects/05/Memory.hdl b/projects/05/Memory.hdl index 62a4fd2..8d3d47c 100644 --- a/projects/05/Memory.hdl +++ b/projects/05/Memory.hdl @@ -28,4 +28,19 @@ CHIP Memory { PARTS:
// Put your code here:
-}
\ No newline at end of file + DMux(in=load, sel=address[14], a=mload, b=load1);
+ DMux(in=load1, sel=address[13], a=sload, b=kload);
+ RAM16K(in=in, load=mload, address=address[0..13], out=mout);
+ Screen(in=in, load=sload, address=address[0..12], out=sout);
+
+ Or8Way(in=address[0..7], out=or1);
+ Or8Way(in=address[5..12], out=or2);
+ Or(a=or1, b=or2, out=ksel);
+
+ Keyboard(out=out1);
+ Mux16(a=out1, b=in, sel=kload, out=kout);
+
+ Mux16(a=kout, b=false, sel=ksel, out=fout1);
+ Mux16(a=sout, b=fout1, sel=address[13], out=fout2);
+ Mux16(a=mout, b=fout2, sel=address[14], out=out);
+}
diff --git a/projects/05/Memory.out b/projects/05/Memory.out new file mode 100644 index 0000000..1dbf7ed --- /dev/null +++ b/projects/05/Memory.out @@ -0,0 +1,54 @@ +| in |load | address | out | +| -1 | 1 | 000000000000000 | 0 | +| -1 | 1 | 000000000000000 | -1 | +| 9999 | 0 | 000000000000000 | -1 | +| 9999 | 0 | 000000000000000 | -1 | +| 9999 | 0 | 010000000000000 | 0 | +| 9999 | 0 | 100000000000000 | 0 | +| 2222 | 1 | 010000000000000 | 0 | +| 2222 | 1 | 010000000000000 | 2222 | +| 9999 | 0 | 010000000000000 | 2222 | +| 9999 | 0 | 010000000000000 | 2222 | +| 9999 | 0 | 000000000000000 | -1 | +| 9999 | 0 | 100000000000000 | 0 | +| 9999 | 0 | 000000000000001 | 0 | +| 9999 | 0 | 000000000000010 | 0 | +| 9999 | 0 | 000000000000100 | 0 | +| 9999 | 0 | 000000000001000 | 0 | +| 9999 | 0 | 000000000010000 | 0 | +| 9999 | 0 | 000000000100000 | 0 | +| 9999 | 0 | 000000001000000 | 0 | +| 9999 | 0 | 000000010000000 | 0 | +| 9999 | 0 | 000000100000000 | 0 | +| 9999 | 0 | 000001000000000 | 0 | +| 9999 | 0 | 000010000000000 | 0 | +| 9999 | 0 | 000100000000000 | 0 | +| 9999 | 0 | 001000000000000 | 0 | +| 9999 | 0 | 010000000000000 | 2222 | +| 1234 | 1 | 001001000110100 | 0 | +| 1234 | 1 | 001001000110100 | 1234 | +| 1234 | 0 | 010001000110100 | 0 | +| 1234 | 0 | 110001000110100 | 0 | +| 2345 | 1 | 010001101000101 | 0 | +| 2345 | 1 | 010001101000101 | 2345 | +| 2345 | 0 | 000001101000101 | 0 | +| 2345 | 0 | 100001101000101 | 0 | +| 2345 | 0 | 110000000000000 | 75 | +| -1 | 1 | 100111111001111 | -1 | +| -1 | 1 | 101000001001111 | -1 | +| -1 | 1 | 000111111001111 | 0 | +| -1 | 1 | 010111111001111 | 0 | +| -1 | 0 | 100111111001110 | 0 | +| -1 | 0 | 100111111001101 | 0 | +| -1 | 0 | 100111111001011 | 0 | +| -1 | 0 | 100111111000111 | 0 | +| -1 | 0 | 100111111011111 | 0 | +| -1 | 0 | 100111111101111 | 0 | +| -1 | 0 | 100111110001111 | 0 | +| -1 | 0 | 100111101001111 | 0 | +| -1 | 0 | 100111011001111 | 0 | +| -1 | 0 | 100110111001111 | 0 | +| -1 | 0 | 100101111001111 | 0 | +| -1 | 0 | 100011111001111 | 0 | +| -1 | 0 | 101111111001111 | 0 | +| -1 | 0 | 110000000000000 | 89 | |