.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# Contents for the courses nand2tetris part one and part two.
|
||||
Important things:
|
||||
1. Project 06 cotaints an assemler which takes Assembly and translates it into machine code
|
||||
2. Project 08 contains a VMtranslator which takes VM code and translates it into Assemly
|
||||
3. Project 11 contains an language translator which takes JACK code and translates it into VM code
|
||||
4. Project 09 contains a game written in the language developed before, a.k.a JACK
|
||||
|
||||
Projects 06, 08, 11 have been writen in Python 3.9
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
The only purpose of this file is to practice submitting files
|
||||
in the Nand to Tetris course websites in Coursera.
|
||||
|
||||
There is no need to modify the contents of this file.
|
||||
All you have to do is submit it as is, following the
|
||||
Project 0 guidelines in the website.
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 |
|
||||
| 1 | 0 | 0 |
|
||||
| 1 | 1 | 1 |
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/And.hdl
|
||||
|
||||
/**
|
||||
* And gate:
|
||||
* out = 1 if (a == 1 and b == 1)
|
||||
* 0 otherwise
|
||||
*/
|
||||
|
||||
CHIP And {
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Nand(a=a,b=b,out=out1);
|
||||
Not(in=out1,out=out);
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 |
|
||||
| 1 | 0 | 0 |
|
||||
| 1 | 1 | 1 |
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/And.tst
|
||||
|
||||
load And.hdl,
|
||||
output-file And.out,
|
||||
compare-to And.cmp,
|
||||
output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;
|
||||
|
||||
set a 0,
|
||||
set b 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 0,
|
||||
set b 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
| a | b | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 0000000000000000 |
|
||||
| 1111111111111111 | 1111111111111111 | 1111111111111111 |
|
||||
| 1010101010101010 | 0101010101010101 | 0000000000000000 |
|
||||
| 0011110011000011 | 0000111111110000 | 0000110011000000 |
|
||||
| 0001001000110100 | 1001100001110110 | 0001000000110100 |
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/And16.hdl
|
||||
|
||||
/**
|
||||
* 16-bit bitwise And:
|
||||
* for i = 0..15: out[i] = (a[i] and b[i])
|
||||
*/
|
||||
|
||||
CHIP And16 {
|
||||
IN a[16], b[16];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
|
||||
And(a=a[0],b=b[0],out=out[0]);
|
||||
And(a=a[1],b=b[1],out=out[1]);
|
||||
And(a=a[2],b=b[2],out=out[2]);
|
||||
And(a=a[3],b=b[3],out=out[3]);
|
||||
And(a=a[4],b=b[4],out=out[4]);
|
||||
And(a=a[5],b=b[5],out=out[5]);
|
||||
And(a=a[6],b=b[6],out=out[6]);
|
||||
And(a=a[7],b=b[7],out=out[7]);
|
||||
And(a=a[8],b=b[8],out=out[8]);
|
||||
And(a=a[9],b=b[9],out=out[9]);
|
||||
And(a=a[10],b=b[10],out=out[10]);
|
||||
And(a=a[11],b=b[11],out=out[11]);
|
||||
And(a=a[12],b=b[12],out=out[12]);
|
||||
And(a=a[13],b=b[13],out=out[13]);
|
||||
And(a=a[14],b=b[14],out=out[14]);
|
||||
And(a=a[15],b=b[15],out=out[15]);
|
||||
|
||||
|
||||
}
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
| a | b | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 0000000000000000 |
|
||||
| 1111111111111111 | 1111111111111111 | 1111111111111111 |
|
||||
| 1010101010101010 | 0101010101010101 | 0000000000000000 |
|
||||
| 0011110011000011 | 0000111111110000 | 0000110011000000 |
|
||||
| 0001001000110100 | 1001100001110110 | 0001000000110100 |
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/And16.tst
|
||||
|
||||
load And16.hdl,
|
||||
output-file And16.out,
|
||||
compare-to And16.cmp,
|
||||
output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;
|
||||
|
||||
set a %B0000000000000000,
|
||||
set b %B0000000000000000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0000000000000000,
|
||||
set b %B1111111111111111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B1111111111111111,
|
||||
set b %B1111111111111111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B1010101010101010,
|
||||
set b %B0101010101010101,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0011110011000011,
|
||||
set b %B0000111111110000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0001001000110100,
|
||||
set b %B1001100001110110,
|
||||
eval,
|
||||
output;
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| in | sel | a | b |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 | 0 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/DMux.hdl
|
||||
|
||||
/**
|
||||
* Demultiplexor:
|
||||
* {a, b} = {in, 0} if sel == 0
|
||||
* {0, in} if sel == 1
|
||||
*/
|
||||
|
||||
CHIP DMux {
|
||||
IN in, sel;
|
||||
OUT a, b;
|
||||
|
||||
PARTS:
|
||||
Not(in=sel,out=notsel);
|
||||
And(a=in,b=notsel,out=a);
|
||||
And(a=in,b=sel,out=b);
|
||||
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| in | sel | a | b |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 | 0 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/DMux.tst
|
||||
|
||||
load DMux.hdl,
|
||||
output-file DMux.out,
|
||||
compare-to DMux.cmp,
|
||||
output-list in%B3.1.3 sel%B3.1.3 a%B3.1.3 b%B3.1.3;
|
||||
|
||||
set in 0,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| in | sel | a | b | c | d |
|
||||
| 0 | 00 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 01 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 10 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 11 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 00 | 1 | 0 | 0 | 0 |
|
||||
| 1 | 01 | 0 | 1 | 0 | 0 |
|
||||
| 1 | 10 | 0 | 0 | 1 | 0 |
|
||||
| 1 | 11 | 0 | 0 | 0 | 1 |
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/DMux4Way.hdl
|
||||
|
||||
/**
|
||||
* 4-way demultiplexor:
|
||||
* {a, b, c, d} = {in, 0, 0, 0} if sel == 00
|
||||
* {0, in, 0, 0} if sel == 01
|
||||
* {0, 0, in, 0} if sel == 10
|
||||
* {0, 0, 0, in} if sel == 11
|
||||
*/
|
||||
|
||||
CHIP DMux4Way {
|
||||
IN in, sel[2];
|
||||
OUT a, b, c, d;
|
||||
|
||||
PARTS:
|
||||
Not(in=sel[1],out=notsel1);
|
||||
Not(in=sel[0],out=notsel0);
|
||||
|
||||
And(a=notsel1,b=notsel0,out=out1);
|
||||
And(a=notsel1,b=sel[0],out=out2);
|
||||
And(a=sel[1],b=notsel0,out=out3);
|
||||
And(a=sel[1],b=sel[0],out=out4);
|
||||
|
||||
And(a=in,b=out1,out=a);
|
||||
And(a=in,b=out2,out=b);
|
||||
And(a=in,b=out3,out=c);
|
||||
And(a=in,b=out4,out=d);
|
||||
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| in | sel | a | b | c | d |
|
||||
| 0 | 00 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 01 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 10 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 11 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 00 | 1 | 0 | 0 | 0 |
|
||||
| 1 | 01 | 0 | 1 | 0 | 0 |
|
||||
| 1 | 10 | 0 | 0 | 1 | 0 |
|
||||
| 1 | 11 | 0 | 0 | 0 | 1 |
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/DMux4Way.tst
|
||||
|
||||
load DMux4Way.hdl,
|
||||
output-file DMux4Way.out,
|
||||
compare-to DMux4Way.cmp,
|
||||
output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2;
|
||||
|
||||
set in 0,
|
||||
set sel %B00,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B01,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B10,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B11,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set sel %B00,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B01,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B10,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B11,
|
||||
eval,
|
||||
output;
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
| in | sel | a | b | c | d | e | f | g | h |
|
||||
| 0 | 000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 001 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 010 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 110 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 001 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 010 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 011 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 100 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
|
||||
| 1 | 101 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
|
||||
| 1 | 110 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
|
||||
| 1 | 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/DMux8Way.hdl
|
||||
|
||||
/**
|
||||
* 8-way demultiplexor:
|
||||
* {a, b, c, d, e, f, g, h} = {in, 0, 0, 0, 0, 0, 0, 0} if sel == 000
|
||||
* {0, in, 0, 0, 0, 0, 0, 0} if sel == 001
|
||||
* etc.
|
||||
* {0, 0, 0, 0, 0, 0, 0, in} if sel == 111
|
||||
*/
|
||||
|
||||
CHIP DMux8Way {
|
||||
IN in, sel[3];
|
||||
OUT a, b, c, d, e, f, g, h;
|
||||
|
||||
PARTS:
|
||||
Not(in=sel[0],out=notsel0);
|
||||
Not(in=sel[1],out=notsel1);
|
||||
Not(in=sel[2],out=notsel2);
|
||||
|
||||
And(a=notsel2,b=notsel1,out=out1);
|
||||
And(a=out1,b=notsel0,out=outA);
|
||||
And(a=out1,b=sel[0],out=outB);
|
||||
|
||||
And(a=notsel2,b=sel[1],out=out2);
|
||||
And(a=out2,b=notsel0,out=outC);
|
||||
And(a=out2,b=sel[0],out=outD);
|
||||
|
||||
And(a=sel[2],b=notsel1,out=out3);
|
||||
And(a=out3,b=notsel0,out=outE);
|
||||
And(a=out3,b=sel[0],out=outF);
|
||||
|
||||
And(a=sel[2],b=sel[1],out=out4);
|
||||
And(a=out4,b=notsel0,out=outG);
|
||||
And(a=out4,b=sel[0],out=outH);
|
||||
|
||||
And(a=in,b=outA,out=a);
|
||||
And(a=in,b=outB,out=b);
|
||||
And(a=in,b=outC,out=c);
|
||||
And(a=in,b=outD,out=d);
|
||||
And(a=in,b=outE,out=e);
|
||||
And(a=in,b=outF,out=f);
|
||||
And(a=in,b=outG,out=g);
|
||||
And(a=in,b=outH,out=h);
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
| in | sel | a | b | c | d | e | f | g | h |
|
||||
| 0 | 000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 001 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 010 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 110 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 001 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 010 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 011 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 100 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
|
||||
| 1 | 101 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
|
||||
| 1 | 110 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
|
||||
| 1 | 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/DMux8Way.tst
|
||||
|
||||
load DMux8Way.hdl,
|
||||
output-file DMux8Way.out,
|
||||
compare-to DMux8Way.cmp,
|
||||
output-list in%B2.1.2 sel%B2.3.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2 e%B2.1.2 f%B2.1.2 g%B2.1.2 h%B2.1.2;
|
||||
|
||||
set in 0,
|
||||
set sel %B000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B001,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B010,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B011,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B100,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B101,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B110,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set sel %B000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B001,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B010,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B011,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B100,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B101,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B110,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel %B111,
|
||||
eval,
|
||||
output;
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| a | b | sel | out |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 0 | 1 | 0 |
|
||||
| 0 | 1 | 0 | 0 |
|
||||
| 0 | 1 | 1 | 1 |
|
||||
| 1 | 0 | 0 | 1 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
| 1 | 1 | 1 | 1 |
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
/**
|
||||
* Multiplexor:
|
||||
* out = a if sel == 0
|
||||
* b otherwise
|
||||
*/
|
||||
|
||||
CHIP Mux {
|
||||
IN a, b, sel;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Not(in=sel,out=notsel);
|
||||
And(a=a,b=notsel,out=out1);
|
||||
And(a=b,b=sel,out=out2);
|
||||
Or(a=out1,b=out2,out=out);
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| a | b | sel | out |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 0 | 1 | 0 |
|
||||
| 0 | 1 | 0 | 0 |
|
||||
| 0 | 1 | 1 | 1 |
|
||||
| 1 | 0 | 0 | 1 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
| 1 | 1 | 1 | 1 |
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Mux.tst
|
||||
|
||||
load Mux.hdl,
|
||||
output-file Mux.out,
|
||||
compare-to Mux.cmp,
|
||||
output-list a%B3.1.3 b%B3.1.3 sel%B3.1.3 out%B3.1.3;
|
||||
|
||||
set a 0,
|
||||
set b 0,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 0,
|
||||
set b 1,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 0,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 1,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| a | b | sel | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 1 | 0000000000000000 |
|
||||
| 0000000000000000 | 0001001000110100 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 0001001000110100 | 1 | 0001001000110100 |
|
||||
| 1001100001110110 | 0000000000000000 | 0 | 1001100001110110 |
|
||||
| 1001100001110110 | 0000000000000000 | 1 | 0000000000000000 |
|
||||
| 1010101010101010 | 0101010101010101 | 0 | 1010101010101010 |
|
||||
| 1010101010101010 | 0101010101010101 | 1 | 0101010101010101 |
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/11/Mux16.hdl
|
||||
|
||||
/**
|
||||
* 16-bit multiplexor:
|
||||
* for i = 1..15 out[i] = a[i] if sel == 1
|
||||
* b[i] if sel == 1
|
||||
*/
|
||||
|
||||
CHIP Mux16 {
|
||||
IN a[16], b[16], sel;
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
Mux(a=a[0],b=b[0],sel=sel,out=out[0]);
|
||||
Mux(a=a[1],b=b[1],sel=sel,out=out[1]);
|
||||
Mux(a=a[2],b=b[2],sel=sel,out=out[2]);
|
||||
Mux(a=a[3],b=b[3],sel=sel,out=out[3]);
|
||||
Mux(a=a[4],b=b[4],sel=sel,out=out[4]);
|
||||
Mux(a=a[5],b=b[5],sel=sel,out=out[5]);
|
||||
Mux(a=a[6],b=b[6],sel=sel,out=out[6]);
|
||||
Mux(a=a[7],b=b[7],sel=sel,out=out[7]);
|
||||
Mux(a=a[8],b=b[8],sel=sel,out=out[8]);
|
||||
Mux(a=a[9],b=b[9],sel=sel,out=out[9]);
|
||||
Mux(a=a[10],b=b[10],sel=sel,out=out[10]);
|
||||
Mux(a=a[11],b=b[11],sel=sel,out=out[11]);
|
||||
Mux(a=a[12],b=b[12],sel=sel,out=out[12]);
|
||||
Mux(a=a[13],b=b[13],sel=sel,out=out[13]);
|
||||
Mux(a=a[14],b=b[14],sel=sel,out=out[14]);
|
||||
Mux(a=a[15],b=b[15],sel=sel,out=out[15]);
|
||||
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| a | b | sel | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 1 | 0000000000000000 |
|
||||
| 0000000000000000 | 0001001000110100 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 0001001000110100 | 1 | 0001001000110100 |
|
||||
| 1001100001110110 | 0000000000000000 | 0 | 1001100001110110 |
|
||||
| 1001100001110110 | 0000000000000000 | 1 | 0000000000000000 |
|
||||
| 1010101010101010 | 0101010101010101 | 0 | 1010101010101010 |
|
||||
| 1010101010101010 | 0101010101010101 | 1 | 0101010101010101 |
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Mux16.tst
|
||||
|
||||
load Mux16.hdl,
|
||||
output-file Mux16.out,
|
||||
compare-to Mux16.cmp,
|
||||
output-list a%B1.16.1 b%B1.16.1 sel%D2.1.2 out%B1.16.1;
|
||||
|
||||
set a 0,
|
||||
set b 0,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0000000000000000,
|
||||
set b %B0001001000110100,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B1001100001110110,
|
||||
set b %B0000000000000000,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B1010101010101010,
|
||||
set b %B0101010101010101,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
CHIP Mux4Way {
|
||||
IN a, b, c, d, sel0, sel1;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Not(in=sel0,out=notsel0);
|
||||
Not(in=sel1,out=notsel1);
|
||||
|
||||
And(a=notsel0,b=notsel1,out=outA);
|
||||
And(a=sel0,b=notsel1,out=outB);
|
||||
And(a=notsel0,b=sel1,out=outC);
|
||||
And(a=sel0,b=sel1,out=outD);
|
||||
|
||||
And(a=outA,b=a,out=outA1);
|
||||
And(a=outB,b=b,out=outB1);
|
||||
And(a=outC,b=c,out=outC1);
|
||||
And(a=outD,b=d,out=outD1);
|
||||
Or(a=outA1,b=outB1,out=out1);
|
||||
Or(a=outC1,b=outD1,out=out2);
|
||||
Or(a=out1,b=out2,out=out);
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| a | b | c | d | sel | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 00 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 01 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 10 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 11 | 0000000000000000 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 00 | 0001001000110100 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 01 | 1001100001110110 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 10 | 1010101010101010 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 11 | 0101010101010101 |
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Mux4Way16.hdl
|
||||
|
||||
/**
|
||||
* 4-way 16-bit multiplexor:
|
||||
* out = a if sel == 00
|
||||
* b if sel == 01
|
||||
* c if sel == 10
|
||||
* d if sel == 11
|
||||
*/
|
||||
|
||||
CHIP Mux4Way16 {
|
||||
IN a[16], b[16], c[16], d[16], sel[2];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
|
||||
Mux4Way(a=a[0],b=b[0],c=c[0],d=d[0],sel0=sel[0],sel1=sel[1],out=out[0]);
|
||||
Mux4Way(a=a[1],b=b[1],c=c[1],d=d[1],sel0=sel[0],sel1=sel[1],out=out[1]);
|
||||
Mux4Way(a=a[2],b=b[2],c=c[2],d=d[2],sel0=sel[0],sel1=sel[1],out=out[2]);
|
||||
Mux4Way(a=a[3],b=b[3],c=c[3],d=d[3],sel0=sel[0],sel1=sel[1],out=out[3]);
|
||||
Mux4Way(a=a[4],b=b[4],c=c[4],d=d[4],sel0=sel[0],sel1=sel[1],out=out[4]);
|
||||
Mux4Way(a=a[5],b=b[5],c=c[5],d=d[5],sel0=sel[0],sel1=sel[1],out=out[5]);
|
||||
Mux4Way(a=a[6],b=b[6],c=c[6],d=d[6],sel0=sel[0],sel1=sel[1],out=out[6]);
|
||||
Mux4Way(a=a[7],b=b[7],c=c[7],d=d[7],sel0=sel[0],sel1=sel[1],out=out[7]);
|
||||
Mux4Way(a=a[8],b=b[8],c=c[8],d=d[8],sel0=sel[0],sel1=sel[1],out=out[8]);
|
||||
Mux4Way(a=a[9],b=b[9],c=c[9],d=d[9],sel0=sel[0],sel1=sel[1],out=out[9]);
|
||||
|
||||
Mux4Way(a=a[10],b=b[10],c=c[10],d=d[10],sel0=sel[0],sel1=sel[1],out=out[10]);
|
||||
Mux4Way(a=a[11],b=b[11],c=c[11],d=d[11],sel0=sel[0],sel1=sel[1],out=out[11]);
|
||||
Mux4Way(a=a[12],b=b[12],c=c[12],d=d[12],sel0=sel[0],sel1=sel[1],out=out[12]);
|
||||
Mux4Way(a=a[13],b=b[13],c=c[13],d=d[13],sel0=sel[0],sel1=sel[1],out=out[13]);
|
||||
Mux4Way(a=a[14],b=b[14],c=c[14],d=d[14],sel0=sel[0],sel1=sel[1],out=out[14]);
|
||||
Mux4Way(a=a[15],b=b[15],c=c[15],d=d[15],sel0=sel[0],sel1=sel[1],out=out[15]);
|
||||
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| a | b | c | d | sel | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 00 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 01 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 10 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 11 | 0000000000000000 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 00 | 0001001000110100 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 01 | 1001100001110110 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 10 | 1010101010101010 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 11 | 0101010101010101 |
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Mux4Way16.tst
|
||||
|
||||
load Mux4Way16.hdl,
|
||||
output-file Mux4Way16.out,
|
||||
compare-to Mux4Way16.cmp,
|
||||
output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 sel%B2.2.2 out%B1.16.1;
|
||||
|
||||
set a 0,
|
||||
set b 0,
|
||||
set c 0,
|
||||
set d 0,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 2,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 3,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0001001000110100,
|
||||
set b %B1001100001110110,
|
||||
set c %B1010101010101010,
|
||||
set d %B0101010101010101,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 2,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 3,
|
||||
eval,
|
||||
output;
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
CHIP Mux8Way {
|
||||
IN a, b, c, d, e, f, g, h, sel0, sel1, sel2;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Not(in=sel0,out=notsel0);
|
||||
Not(in=sel1,out=notsel1);
|
||||
Not(in=sel2,out=notsel2);
|
||||
|
||||
|
||||
And(a=notsel0,b=notsel1,out=outA);
|
||||
And(a=notsel0,b=sel2,out=outC);
|
||||
And(a=sel0,b=notsel1,out=outE);
|
||||
And(a=sel0,b=sel1,out=outG);
|
||||
|
||||
And(a=outA,b=notsel2,out=outA1);
|
||||
And(a=outC,b=notsel2,out=outC1);
|
||||
And(a=outE,b=notsel2,out=outE1);
|
||||
And(a=outG,b=notsel2,out=outG1);
|
||||
And(a=outA,b=sel2,out=outB1);
|
||||
And(a=outG,b=sel2,out=outH1);
|
||||
And(a=outC,b=sel2,out=outD1);
|
||||
And(a=outE,b=sel2,out=outF1);
|
||||
|
||||
And(a=outA1,b=a,out=outA2);
|
||||
And(a=outB1,b=b,out=outB2);
|
||||
And(a=outC1,b=c,out=outC2);
|
||||
And(a=outD1,b=d,out=outD2);
|
||||
And(a=outE1,b=e,out=outE2);
|
||||
And(a=outF1,b=f,out=outF2);
|
||||
And(a=outG1,b=g,out=outG2);
|
||||
And(a=outH1,b=h,out=outH2);
|
||||
|
||||
Or(a=outA2,b=outB2,out=out1);
|
||||
Or(a=outC2,b=outD2,out=out2);
|
||||
Or(a=outE2,b=outF2,out=out4);
|
||||
Or(a=outG2,b=outH2,out=out5);
|
||||
Or(a=out4,b=out5,out=out6);
|
||||
Or(a=out1,b=out2,out=out3);
|
||||
Or(a=out3,b=out6,out=out);
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
| a | b | c | d | e | f | g | h | sel | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 000 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 001 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 010 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 011 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 100 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 101 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 110 | 0000000000000000 |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 111 | 0000000000000000 |
|
||||
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 000 | 0001001000110100 |
|
||||
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 |
|
||||
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0011010001010110 |
|
||||
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 011 | 0100010101100111 |
|
||||
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 100 | 0101011001111000 |
|
||||
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 101 | 0110011110001001 |
|
||||
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 110 | 0111100010011010 |
|
||||
| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 111 | 1000100110101011 |
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Mux8Way16.hdl
|
||||
|
||||
/**
|
||||
* 8-way 16-bit multiplexor:
|
||||
* out = a if sel == 000
|
||||
* b if sel == 001
|
||||
* etc.
|
||||
* h if sel == 111
|
||||
*/
|
||||
|
||||
CHIP Mux8Way16 {
|
||||
IN a[16], b[16], c[16], d[16],
|
||||
e[16], f[16], g[16], h[16],
|
||||
sel[3];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
Mux8Way(a=a[0],b=b[0],c=c[0],d=d[0],e=e[0],f=f[0],g=g[0],h=h[0],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[0]);
|
||||
Mux8Way(a=a[1],b=b[1],c=c[1],d=d[1],e=e[1],f=f[1],g=g[1],h=h[1],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[1]);
|
||||
Mux8Way(a=a[2],b=b[2],c=c[2],d=d[2],e=e[2],f=f[2],g=g[2],h=h[2],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[2]);
|
||||
Mux8Way(a=a[3],b=b[3],c=c[3],d=d[3],e=e[3],f=f[3],g=g[3],h=h[3],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[3]);
|
||||
Mux8Way(a=a[4],b=b[4],c=c[4],d=d[4],e=e[4],f=f[4],g=g[4],h=h[4],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[4]);
|
||||
Mux8Way(a=a[5],b=b[5],c=c[5],d=d[5],e=e[5],f=f[5],g=g[5],h=h[5],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[5]);
|
||||
Mux8Way(a=a[6],b=b[6],c=c[6],d=d[6],e=e[6],f=f[6],g=g[6],h=h[6],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[6]);
|
||||
Mux8Way(a=a[7],b=b[7],c=c[7],d=d[7],e=e[7],f=f[7],g=g[7],h=h[7],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[7]);
|
||||
Mux8Way(a=a[8],b=b[8],c=c[8],d=d[8],e=e[8],f=f[8],g=g[8],h=h[8],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[8]);
|
||||
Mux8Way(a=a[9],b=b[9],c=c[9],d=d[9],e=e[9],f=f[9],g=g[9],h=h[9],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[9]);
|
||||
|
||||
Mux8Way(a=a[11],b=b[11],c=c[11],d=d[11],e=e[11],f=f[11],g=g[11],h=h[11],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[11]);
|
||||
Mux8Way(a=a[12],b=b[12],c=c[12],d=d[12],e=e[12],f=f[12],g=g[12],h=h[12],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[12]);
|
||||
Mux8Way(a=a[14],b=b[14],c=c[14],d=d[14],e=e[14],f=f[14],g=g[14],h=h[14],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[14]);
|
||||
Mux8Way(a=a[13],b=b[13],c=c[13],d=d[13],e=e[13],f=f[13],g=g[13],h=h[13],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[13]);
|
||||
Mux8Way(a=a[15],b=b[15],c=c[15],d=d[15],e=e[15],f=f[15],g=g[15],h=h[15],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[15]);
|
||||
Mux8Way(a=a[10],b=b[10],c=c[10],d=d[10],e=e[10],f=f[10],g=g[10],h=h[10],sel0=sel[0],sel1=sel[1],sel2=sel[2],out=out[10]);
|
||||
}
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Mux8Way16.tst
|
||||
|
||||
load Mux8Way16.hdl,
|
||||
output-file Mux8Way16.out,
|
||||
compare-to Mux8Way16.cmp,
|
||||
output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 e%B1.16.1 f%B1.16.1 g%B1.16.1 h%B1.16.1 sel%B2.3.2 out%B1.16.1;
|
||||
|
||||
set a 0,
|
||||
set b 0,
|
||||
set c 0,
|
||||
set d 0,
|
||||
set e 0,
|
||||
set f 0,
|
||||
set g 0,
|
||||
set h 0,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 2,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 3,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 4,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 5,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 6,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 7,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0001001000110100,
|
||||
set b %B0010001101000101,
|
||||
set c %B0011010001010110,
|
||||
set d %B0100010101100111,
|
||||
set e %B0101011001111000,
|
||||
set f %B0110011110001001,
|
||||
set g %B0111100010011010,
|
||||
set h %B1000100110101011,
|
||||
set sel 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 2,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 3,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 4,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 5,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 6,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set sel 7,
|
||||
eval,
|
||||
output;
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
| in | out |
|
||||
| 0 | 1 |
|
||||
| 1 | 0 |
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Not.hdl
|
||||
|
||||
/**
|
||||
* Not gate:
|
||||
* out = not in
|
||||
*/
|
||||
|
||||
CHIP Not {
|
||||
IN in;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Nand(a=in,b=in,out=out);
|
||||
}
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
| in | out |
|
||||
| 0 | 1 |
|
||||
| 1 | 0 |
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Not.tst
|
||||
|
||||
load Not.hdl,
|
||||
output-file Not.out,
|
||||
compare-to Not.cmp,
|
||||
output-list in%B3.1.3 out%B3.1.3;
|
||||
|
||||
set in 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
| in | out |
|
||||
| 0000000000000000 | 1111111111111111 |
|
||||
| 1111111111111111 | 0000000000000000 |
|
||||
| 1010101010101010 | 0101010101010101 |
|
||||
| 0011110011000011 | 1100001100111100 |
|
||||
| 0001001000110100 | 1110110111001011 |
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Not16.hdl
|
||||
|
||||
/**
|
||||
* 16-bit Not:
|
||||
* for i=0..15: out[i] = not in[i]
|
||||
*/
|
||||
|
||||
CHIP Not16 {
|
||||
IN in[16];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
Not(in=in[0],out=out[0]);
|
||||
Not(in=in[1],out=out[1]);
|
||||
Not(in=in[2],out=out[2]);
|
||||
Not(in=in[3],out=out[3]);
|
||||
Not(in=in[4],out=out[4]);
|
||||
Not(in=in[5],out=out[5]);
|
||||
Not(in=in[6],out=out[6]);
|
||||
Not(in=in[7],out=out[7]);
|
||||
Not(in=in[8],out=out[8]);
|
||||
Not(in=in[9],out=out[9]);
|
||||
Not(in=in[10],out=out[10]);
|
||||
Not(in=in[11],out=out[11]);
|
||||
Not(in=in[12],out=out[12]);
|
||||
Not(in=in[13],out=out[13]);
|
||||
Not(in=in[14],out=out[14]);
|
||||
Not(in=in[15],out=out[15]);
|
||||
|
||||
}
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
| in | out |
|
||||
| 0000000000000000 | 1111111111111111 |
|
||||
| 1111111111111111 | 0000000000000000 |
|
||||
| 1010101010101010 | 0101010101010101 |
|
||||
| 0011110011000011 | 1100001100111100 |
|
||||
| 0001001000110100 | 1110110111001011 |
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Not16.tst
|
||||
|
||||
load Not16.hdl,
|
||||
output-file Not16.out,
|
||||
compare-to Not16.cmp,
|
||||
output-list in%B1.16.1 out%B1.16.1;
|
||||
|
||||
set in %B0000000000000000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B1111111111111111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B1010101010101010,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B0011110011000011,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B0001001000110100,
|
||||
eval,
|
||||
output;
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 |
|
||||
| 1 | 0 | 1 |
|
||||
| 1 | 1 | 1 |
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
CHIP Or {
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Not(in=a,out=nota);
|
||||
Not(in=b,out=notb);
|
||||
Nand(a=nota,b=notb,out=out);
|
||||
}
|
||||
Executable
Executable
+29
@@ -0,0 +1,29 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Or.tst
|
||||
|
||||
load Or.hdl,
|
||||
output-file Or.out,
|
||||
compare-to Or.cmp,
|
||||
output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;
|
||||
|
||||
set a 0,
|
||||
set b 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 0,
|
||||
set b 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
| a | b | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1111111111111111 |
|
||||
| 1111111111111111 | 1111111111111111 | 1111111111111111 |
|
||||
| 1010101010101010 | 0101010101010101 | 1111111111111111 |
|
||||
| 0011110011000011 | 0000111111110000 | 0011111111110011 |
|
||||
| 0001001000110100 | 1001100001110110 | 1001101001110110 |
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/11/Or16.hdl
|
||||
|
||||
/**
|
||||
* 16-bit bitwise Or:
|
||||
* for i = 1..15 out[i] = (a[i] or b[i])
|
||||
*/
|
||||
|
||||
CHIP Or16 {
|
||||
IN a[16], b[16];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
Or(a=a[0],b=b[0],out=out[0]);
|
||||
Or(a=a[1],b=b[1],out=out[1]);
|
||||
Or(a=a[2],b=b[2],out=out[2]);
|
||||
Or(a=a[3],b=b[3],out=out[3]);
|
||||
Or(a=a[4],b=b[4],out=out[4]);
|
||||
Or(a=a[5],b=b[5],out=out[5]);
|
||||
Or(a=a[6],b=b[6],out=out[6]);
|
||||
Or(a=a[7],b=b[7],out=out[7]);
|
||||
Or(a=a[8],b=b[8],out=out[8]);
|
||||
Or(a=a[9],b=b[9],out=out[9]);
|
||||
Or(a=a[10],b=b[10],out=out[10]);
|
||||
Or(a=a[11],b=b[11],out=out[11]);
|
||||
Or(a=a[12],b=b[12],out=out[12]);
|
||||
Or(a=a[13],b=b[13],out=out[13]);
|
||||
Or(a=a[14],b=b[14],out=out[14]);
|
||||
Or(a=a[15],b=b[15],out=out[15]);
|
||||
|
||||
}
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
| a | b | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1111111111111111 |
|
||||
| 1111111111111111 | 1111111111111111 | 1111111111111111 |
|
||||
| 1010101010101010 | 0101010101010101 | 1111111111111111 |
|
||||
| 0011110011000011 | 0000111111110000 | 0011111111110011 |
|
||||
| 0001001000110100 | 1001100001110110 | 1001101001110110 |
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Or16.tst
|
||||
|
||||
load Or16.hdl,
|
||||
output-file Or16.out,
|
||||
compare-to Or16.cmp,
|
||||
output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;
|
||||
|
||||
set a %B0000000000000000,
|
||||
set b %B0000000000000000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0000000000000000,
|
||||
set b %B1111111111111111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B1111111111111111,
|
||||
set b %B1111111111111111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B1010101010101010,
|
||||
set b %B0101010101010101,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0011110011000011,
|
||||
set b %B0000111111110000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0001001000110100,
|
||||
set b %B1001100001110110,
|
||||
eval,
|
||||
output;
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
| in | out |
|
||||
| 00000000 | 0 |
|
||||
| 11111111 | 1 |
|
||||
| 00010000 | 1 |
|
||||
| 00000001 | 1 |
|
||||
| 00100110 | 1 |
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Or8Way.hdl
|
||||
|
||||
/**
|
||||
* 8-way Or:
|
||||
* out = (in[0] or in[1] or ... or in[7])
|
||||
*/
|
||||
|
||||
CHIP Or8Way {
|
||||
IN in[8];
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Or(a=in[0],b=in[1],out=out1);
|
||||
Or(a=out1,b=in[2],out=out2);
|
||||
Or(a=out2,b=in[3],out=out3);
|
||||
Or(a=out3,b=in[4],out=out4);
|
||||
Or(a=out4,b=in[5],out=out5);
|
||||
Or(a=out5,b=in[6],out=out6);
|
||||
Or(a=out6,b=in[7],out=out);
|
||||
|
||||
|
||||
}
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
| in | out |
|
||||
| 00000000 | 0 |
|
||||
| 11111111 | 1 |
|
||||
| 00010000 | 1 |
|
||||
| 00000001 | 1 |
|
||||
| 00100110 | 1 |
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Or8Way.tst
|
||||
|
||||
load Or8Way.hdl,
|
||||
output-file Or8Way.out,
|
||||
compare-to Or8Way.cmp,
|
||||
output-list in%B2.8.2 out%B2.1.2;
|
||||
|
||||
set in %B00000000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B11111111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B00010000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B00000001,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B00100110,
|
||||
eval,
|
||||
output;
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 |
|
||||
| 1 | 0 | 1 |
|
||||
| 1 | 1 | 0 |
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
CHIP Xor {
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Not(in=a,out=nota);
|
||||
Not(in=b,out=notb);
|
||||
And(a=a,b=notb,out=aAndnotb);
|
||||
And(a=nota,b=b,out=notaAndb);
|
||||
Or(a=aAndnotb,b=notaAndb,out=out);
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 |
|
||||
| 1 | 0 | 1 |
|
||||
| 1 | 1 | 0 |
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/01/Xor.tst
|
||||
|
||||
load Xor.hdl,
|
||||
output-file Xor.out,
|
||||
compare-to Xor.cmp,
|
||||
output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;
|
||||
|
||||
set a 0,set b 0,eval,output;
|
||||
set a 0,set b 1,eval,output;
|
||||
set a 1,set b 0,eval,output;
|
||||
set a 1,set b 1,eval,output;
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
| x | y |zx |nx |zy |ny | f |no | out |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 0 | 0101101110100000 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 0 | 0001111011010010 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 1 | 1010010001011111 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 1 | 1110000100101101 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 1 | 1010010001100000 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 1 | 1110000100101110 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 1 | 1 | 1 | 1 | 1 | 0101101110100001 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 1 | 1 | 1 | 0001111011010011 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 0 | 0101101110011111 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 0 | 0001111011010001 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 1 | 0 | 0111101001110010 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011110011001110 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100001100110010 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 0 | 0 | 0001101010000000 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 1 | 0 | 1 | 0101111111110010 |
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
| x | y |zx |nx |zy |ny | f |no | out |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 0 | 0101101110100000 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 0 | 0001111011010010 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 1 | 1010010001011111 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 1 | 1110000100101101 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 1 | 1010010001100000 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 1 | 1110000100101110 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 1 | 1 | 1 | 1 | 1 | 0101101110100001 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 1 | 1 | 1 | 0001111011010011 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 0 | 0101101110011111 |
|
||||
| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 0 | 0001111011010001 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 1 | 0 | 0111101001110010 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011110011001110 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100001100110010 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 0 | 0 | 0001101010000000 |
|
||||
| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 1 | 0 | 1 | 0101111111110010 |
|
||||
Executable
+353
@@ -0,0 +1,353 @@
|
||||
// This file is part of the materials accompanying the book
|
||||
// "The Elements of Computing Systems" by Nisan and Schocken,
|
||||
// MIT Press. Book site: www.idc.ac.il/tecs
|
||||
// File name: projects/02/ALU-nostat.tst
|
||||
|
||||
// ALU-nostat.tst provides a partial test of the ALU chip.
|
||||
// It IS NOT a replacement for ALU.tst.
|
||||
|
||||
// ALU-nostat.tst tests only the computation part of the ALU.
|
||||
// The 'zr' and 'ng' status outputs are ignored.
|
||||
|
||||
// This test lets you concentrate on getting the ALU computation right without the
|
||||
// additional task of handling the status outputs.
|
||||
|
||||
// Once your ALU passes ALU-nostat.tst you need to test it with ALU.tst.
|
||||
// This way, any comparison failures during ALU.tst will be caused by errors in
|
||||
// the handling of the 'zr' and 'ng' status outputs.
|
||||
|
||||
load ALU.hdl,
|
||||
output-file ALU-nostat.out,
|
||||
compare-to ALU-nostat.cmp,
|
||||
output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1
|
||||
ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1;
|
||||
|
||||
set x %B0000000000000000,
|
||||
set y %B1111111111111111,
|
||||
|
||||
set zx 1,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set x %B101101110100000,
|
||||
set y %B001111011010010,
|
||||
|
||||
set zx 1,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
| x | y |zx |nx |zy |ny | f |no | out |zr |ng |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/ALU.hdl
|
||||
|
||||
/**
|
||||
* The ALU (Arithmetic Logic Unit).
|
||||
* Computes one of the following functions:
|
||||
* x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,
|
||||
* x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs,
|
||||
* according to 6 input bits denoted zx,nx,zy,ny,f,no.
|
||||
* In addition, the ALU computes two 1-bit outputs:
|
||||
* if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;
|
||||
* if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.
|
||||
*/
|
||||
|
||||
// Implementation: the ALU logic manipulates the x and y inputs
|
||||
// and operates on the resulting values, as follows:
|
||||
// if (zx == 1) set x = 0 // 16-bit constant
|
||||
// if (nx == 1) set x = !x // bitwise not
|
||||
// if (zy == 1) set y = 0 // 16-bit constant
|
||||
// if (ny == 1) set y = !y // bitwise not
|
||||
// if (f == 1) set out = x + y // integer 2's complement addition
|
||||
// if (f == 0) set out = x & y // bitwise and
|
||||
// if (no == 1) set out = !out // bitwise not
|
||||
// if (out == 0) set zr = 1
|
||||
// if (out < 0) set ng = 1
|
||||
|
||||
CHIP ALU {
|
||||
IN
|
||||
x[16], y[16], // 16-bit inputs
|
||||
zx, // zero the x input?
|
||||
nx, // negate the x input?
|
||||
zy, // zero the y input?
|
||||
ny, // negate the y input?
|
||||
f, // compute out = x + y (if 1) or x & y (if 0)
|
||||
no; // negate the out output?
|
||||
|
||||
OUT
|
||||
out[16], // 16-bit output
|
||||
zr, // 1 if (out == 0), 0 otherwise
|
||||
ng; // 1 if (out < 0), 0 otherwise
|
||||
|
||||
PARTS:
|
||||
Mux16(a=x,b[0..15]=false,sel=zx,out=outZx);//zx +
|
||||
Mux16(a=y,b[0..15]=false,sel=zy,out=outZy);//zy +
|
||||
|
||||
Not16(in=outZx,out=outNx1);//nx1
|
||||
Not16(in=outZy,out=outNy1);//ny1
|
||||
Mux16(a=outZx,b=outNx1,sel=nx,out=outNx);//nx +
|
||||
Mux16(a=outZy,b=outNy1,sel=ny,out=outNy);//ny +
|
||||
|
||||
Add16(a=outNx,b=outNy,out=outF1);//f1 +
|
||||
And16(a=outNy,b=outNx,out=outF0);//f0 +
|
||||
Mux16(a=outF0,b=outF1,sel=f,out=outF);//f
|
||||
|
||||
Not16(in=outF,out=outNo1);//no +
|
||||
Mux16(a=outF, b=outNo1, sel=no, out=out, out[15]=ng, out[0..7]=zr1, out[8..15]=zr2); +
|
||||
|
||||
Or8Way(in=zr1,out=out2);
|
||||
Or8Way(in=zr2,out=out3);
|
||||
Not(in=out2,out=out4);
|
||||
Not(in=out3,out=out5);
|
||||
And(a=out4,b=out5,out=zr);
|
||||
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
| x | y |zx |nx |zy |ny | f |no | out |zr |ng |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |
|
||||
| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |
|
||||
Executable
+377
@@ -0,0 +1,377 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/ALU.tst
|
||||
|
||||
load ALU.hdl,
|
||||
output-file ALU.out,
|
||||
compare-to ALU.cmp,
|
||||
output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1
|
||||
ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1
|
||||
ng%B1.1.1;
|
||||
|
||||
set x %B0000000000000000, // x = 0
|
||||
set y %B1111111111111111; // y = -1
|
||||
|
||||
// Compute 0
|
||||
set zx 1,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute 1
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute -1
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute y
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute !x
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute !y
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute -x
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute -y
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x + 1
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute y + 1
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x - 1
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute y - 1
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x + y
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x - y
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute y - x
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x & y
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x | y
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set x %B000000000010001, // x = 17
|
||||
set y %B000000000000011; // y = 3
|
||||
|
||||
// Compute 0
|
||||
set zx 1,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute 1
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute -1
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute y
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute !x
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute !y
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute -x
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute -y
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x + 1
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute y + 1
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x - 1
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 1,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute y - 1
|
||||
set zx 1,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x + y
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x - y
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute y - x
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 1,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x & y
|
||||
set zx 0,
|
||||
set nx 0,
|
||||
set zy 0,
|
||||
set ny 0,
|
||||
set f 0,
|
||||
set no 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
// Compute x | y
|
||||
set zx 0,
|
||||
set nx 1,
|
||||
set zy 0,
|
||||
set ny 1,
|
||||
set f 0,
|
||||
set no 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
| a | b | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1111111111111111 |
|
||||
| 1111111111111111 | 1111111111111111 | 1111111111111110 |
|
||||
| 1010101010101010 | 0101010101010101 | 1111111111111111 |
|
||||
| 0011110011000011 | 0000111111110000 | 0100110010110011 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 |
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/Adder16.hdl
|
||||
|
||||
/**
|
||||
* Adds two 16-bit values.
|
||||
* The most significant carry bit is ignored.
|
||||
*/
|
||||
|
||||
CHIP Add16 {
|
||||
IN a[16], b[16];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
HalfAdder(a=a[0], b=b[0], sum=out[0], carry=carry1);
|
||||
FullAdder(a=a[1], b=b[1], c=carry1, sum=out[1], carry=carry2);
|
||||
FullAdder(a=a[2], b=b[2], c=carry2, sum=out[2], carry=carry3);
|
||||
FullAdder(a=a[3], b=b[3], c=carry3, sum=out[3], carry=carry4);
|
||||
FullAdder(a=a[4], b=b[4], c=carry4, sum=out[4], carry=carry5);
|
||||
FullAdder(a=a[5], b=b[5], c=carry5, sum=out[5], carry=carry6);
|
||||
FullAdder(a=a[6], b=b[6], c=carry6, sum=out[6], carry=carry7);
|
||||
FullAdder(a=a[7], b=b[7], c=carry7, sum=out[7], carry=carry8);
|
||||
FullAdder(a=a[8], b=b[8], c=carry8, sum=out[8], carry=carry9);
|
||||
FullAdder(a=a[9], b=b[9], c=carry9, sum=out[9], carry=carry10);
|
||||
|
||||
FullAdder(a=a[10],b=b[10],c=carry10,sum=out[10],carry=carry11);
|
||||
FullAdder(a=a[11],b=b[11],c=carry11,sum=out[11],carry=carry12);
|
||||
FullAdder(a=a[12],b=b[12],c=carry12,sum=out[12],carry=carry13);
|
||||
FullAdder(a=a[13],b=b[13],c=carry13,sum=out[13],carry=carry14);
|
||||
FullAdder(a=a[14],b=b[14],c=carry14,sum=out[14],carry=carry15);
|
||||
FullAdder(a=a[15],b=b[15],c=carry15,sum=out[15],carry=carry16);
|
||||
|
||||
|
||||
}
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
| a | b | out |
|
||||
| 0000000000000000 | 0000000000000000 | 0000000000000000 |
|
||||
| 0000000000000000 | 1111111111111111 | 1111111111111111 |
|
||||
| 1111111111111111 | 1111111111111111 | 1111111111111110 |
|
||||
| 1010101010101010 | 0101010101010101 | 1111111111111111 |
|
||||
| 0011110011000011 | 0000111111110000 | 0100110010110011 |
|
||||
| 0001001000110100 | 1001100001110110 | 1010101010101010 |
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/Add16.tst
|
||||
|
||||
load Add16.hdl,
|
||||
output-file Add16.out,
|
||||
compare-to Add16.cmp,
|
||||
output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;
|
||||
|
||||
set a %B0000000000000000,
|
||||
set b %B0000000000000000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0000000000000000,
|
||||
set b %B1111111111111111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B1111111111111111,
|
||||
set b %B1111111111111111,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B1010101010101010,
|
||||
set b %B0101010101010101,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0011110011000011,
|
||||
set b %B0000111111110000,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a %B0001001000110100,
|
||||
set b %B1001100001110110,
|
||||
eval,
|
||||
output;
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| a | b | c | sum | carry |
|
||||
| 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 0 | 1 | 1 | 0 |
|
||||
| 0 | 1 | 0 | 1 | 0 |
|
||||
| 0 | 1 | 1 | 0 | 1 |
|
||||
| 1 | 0 | 0 | 1 | 0 |
|
||||
| 1 | 0 | 1 | 0 | 1 |
|
||||
| 1 | 1 | 0 | 0 | 1 |
|
||||
| 1 | 1 | 1 | 1 | 1 |
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/FullAdder.hdl
|
||||
|
||||
/**
|
||||
* Computes the sum of three bits.
|
||||
*/
|
||||
|
||||
CHIP FullAdder {
|
||||
IN a, b, c; // 1-bit inputs
|
||||
OUT sum, // Right bit of a + b + c
|
||||
carry; // Left bit of a + b + c
|
||||
|
||||
PARTS:
|
||||
HalfAdder(a=b,b=c,sum=sum1,carry=carry1);
|
||||
HalfAdder(a=a,b=sum1,sum=sum,carry=carry2);
|
||||
Or(a=carry1,b=carry2,out=carry);
|
||||
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
| a | b | c | sum | carry |
|
||||
| 0 | 0 | 0 | 0 | 0 |
|
||||
| 0 | 0 | 1 | 1 | 0 |
|
||||
| 0 | 1 | 0 | 1 | 0 |
|
||||
| 0 | 1 | 1 | 0 | 1 |
|
||||
| 1 | 0 | 0 | 1 | 0 |
|
||||
| 1 | 0 | 1 | 0 | 1 |
|
||||
| 1 | 1 | 0 | 0 | 1 |
|
||||
| 1 | 1 | 1 | 1 | 1 |
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/FullAdder.tst
|
||||
|
||||
load FullAdder.hdl,
|
||||
output-file FullAdder.out,
|
||||
compare-to FullAdder.cmp,
|
||||
output-list a%B3.1.3 b%B3.1.3 c%B3.1.3 sum%B3.1.3 carry%B3.1.3;
|
||||
|
||||
set a 0,
|
||||
set b 0,
|
||||
set c 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set c 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set b 1,
|
||||
set c 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set c 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 0,
|
||||
set c 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set c 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set b 1,
|
||||
set c 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set c 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| a | b | sum | carry |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 | 0 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/HalfAdder.hdl
|
||||
|
||||
/**
|
||||
* Computes the sum of two bits.
|
||||
*/
|
||||
|
||||
CHIP HalfAdder {
|
||||
IN a, b; // 1-bit inputs
|
||||
OUT sum, // Right bit of a + b
|
||||
carry; // Left bit of a + b
|
||||
|
||||
PARTS:
|
||||
Xor(a=a,b=b,out=sum);
|
||||
And(a=a,b=b,out=carry);
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| a | b | sum | carry |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 | 0 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/HalfAdder.tst
|
||||
|
||||
load HalfAdder.hdl,
|
||||
output-file HalfAdder.out,
|
||||
compare-to HalfAdder.cmp,
|
||||
output-list a%B3.1.3 b%B3.1.3 sum%B3.1.3 carry%B3.1.3;
|
||||
|
||||
set a 0,
|
||||
set b 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 0,
|
||||
set b 1,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set a 1,
|
||||
set b 1,
|
||||
eval,
|
||||
output;
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| in | out |
|
||||
| 0000000000000000 | 0000000000000001 |
|
||||
| 1111111111111111 | 0000000000000000 |
|
||||
| 0000000000000101 | 0000000000000110 |
|
||||
| 1111111111111011 | 1111111111111100 |
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/Inc16.hdl
|
||||
|
||||
/**
|
||||
* 16-bit incrementer:
|
||||
* out = in + 1 (arithmetic addition)
|
||||
*/
|
||||
|
||||
CHIP Inc16 {
|
||||
IN in[16];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
Add16(a=in, b[1..15]=false, b[0]=true , out=out);
|
||||
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
| in | out |
|
||||
| 0000000000000000 | 0000000000000001 |
|
||||
| 1111111111111111 | 0000000000000000 |
|
||||
| 0000000000000101 | 0000000000000110 |
|
||||
| 1111111111111011 | 1111111111111100 |
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/02/Inc16.tst
|
||||
|
||||
load Inc16.hdl,
|
||||
output-file Inc16.out,
|
||||
compare-to Inc16.cmp,
|
||||
output-list in%B1.16.1 out%B1.16.1;
|
||||
|
||||
set in %B0000000000000000, // in = 0
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B1111111111111111, // in = -1
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B0000000000000101, // in = 5
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in %B1111111111111011, // in = -5
|
||||
eval,
|
||||
output;
|
||||
Executable
+215
@@ -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 |
|
||||
| 10 | 0 | 0 | 1 |
|
||||
| 10+ | 0 | 0 | 1 |
|
||||
| 11 | 0 | 0 | 1 |
|
||||
| 11+ | 0 | 0 | 1 |
|
||||
| 12 | 0 | 0 | 1 |
|
||||
| 12+ | 0 | 0 | 1 |
|
||||
| 13 | 0 | 0 | 1 |
|
||||
| 13+ | 0 | 0 | 1 |
|
||||
| 14 | 0 | 0 | 1 |
|
||||
| 14+ | 0 | 0 | 1 |
|
||||
| 15 | 0 | 0 | 1 |
|
||||
| 15+ | 0 | 0 | 1 |
|
||||
| 16 | 0 | 0 | 1 |
|
||||
| 16+ | 0 | 0 | 1 |
|
||||
| 17 | 0 | 0 | 1 |
|
||||
| 17+ | 0 | 0 | 1 |
|
||||
| 18 | 0 | 0 | 1 |
|
||||
| 18+ | 0 | 0 | 1 |
|
||||
| 19 | 0 | 0 | 1 |
|
||||
| 19+ | 0 | 0 | 1 |
|
||||
| 20 | 0 | 0 | 1 |
|
||||
| 20+ | 0 | 0 | 1 |
|
||||
| 21 | 0 | 0 | 1 |
|
||||
| 21+ | 0 | 0 | 1 |
|
||||
| 22 | 0 | 0 | 1 |
|
||||
| 22+ | 0 | 0 | 1 |
|
||||
| 23 | 0 | 0 | 1 |
|
||||
| 23+ | 0 | 0 | 1 |
|
||||
| 24 | 0 | 0 | 1 |
|
||||
| 24+ | 0 | 0 | 1 |
|
||||
| 25 | 0 | 0 | 1 |
|
||||
| 25+ | 0 | 0 | 1 |
|
||||
| 26 | 0 | 0 | 1 |
|
||||
| 26+ | 0 | 0 | 1 |
|
||||
| 27 | 0 | 0 | 1 |
|
||||
| 27+ | 0 | 0 | 1 |
|
||||
| 28 | 0 | 0 | 1 |
|
||||
| 28+ | 0 | 0 | 1 |
|
||||
| 29 | 0 | 0 | 1 |
|
||||
| 29+ | 0 | 0 | 1 |
|
||||
| 30 | 0 | 0 | 1 |
|
||||
| 30+ | 0 | 0 | 1 |
|
||||
| 31 | 0 | 0 | 1 |
|
||||
| 31+ | 0 | 0 | 1 |
|
||||
| 32 | 0 | 0 | 1 |
|
||||
| 32+ | 0 | 0 | 1 |
|
||||
| 33 | 0 | 0 | 1 |
|
||||
| 33+ | 0 | 0 | 1 |
|
||||
| 34 | 0 | 0 | 1 |
|
||||
| 34+ | 0 | 0 | 1 |
|
||||
| 35 | 0 | 0 | 1 |
|
||||
| 35+ | 0 | 0 | 1 |
|
||||
| 36 | 0 | 0 | 1 |
|
||||
| 36+ | 0 | 0 | 1 |
|
||||
| 37 | 0 | 0 | 1 |
|
||||
| 37+ | 0 | 0 | 1 |
|
||||
| 38 | 0 | 0 | 1 |
|
||||
| 38+ | 0 | 0 | 1 |
|
||||
| 39 | 0 | 0 | 1 |
|
||||
| 39+ | 0 | 0 | 1 |
|
||||
| 40 | 0 | 0 | 1 |
|
||||
| 40+ | 0 | 0 | 1 |
|
||||
| 41 | 0 | 0 | 1 |
|
||||
| 41+ | 0 | 0 | 1 |
|
||||
| 42 | 0 | 0 | 1 |
|
||||
| 42+ | 0 | 0 | 1 |
|
||||
| 43 | 0 | 0 | 1 |
|
||||
| 43+ | 0 | 0 | 1 |
|
||||
| 44 | 0 | 0 | 1 |
|
||||
| 44+ | 0 | 0 | 1 |
|
||||
| 45 | 0 | 0 | 1 |
|
||||
| 45+ | 0 | 0 | 1 |
|
||||
| 46 | 0 | 0 | 1 |
|
||||
| 46+ | 0 | 0 | 1 |
|
||||
| 47 | 0 | 0 | 1 |
|
||||
| 47+ | 0 | 0 | 1 |
|
||||
| 48 | 0 | 0 | 1 |
|
||||
| 48+ | 0 | 0 | 1 |
|
||||
| 49 | 0 | 0 | 1 |
|
||||
| 49+ | 0 | 0 | 1 |
|
||||
| 50 | 0 | 0 | 1 |
|
||||
| 50+ | 0 | 0 | 1 |
|
||||
| 51 | 0 | 0 | 1 |
|
||||
| 51+ | 0 | 0 | 1 |
|
||||
| 52 | 0 | 0 | 1 |
|
||||
| 52+ | 0 | 0 | 1 |
|
||||
| 53 | 0 | 0 | 1 |
|
||||
| 53+ | 0 | 0 | 1 |
|
||||
| 54 | 0 | 0 | 1 |
|
||||
| 54+ | 0 | 0 | 1 |
|
||||
| 55 | 0 | 0 | 1 |
|
||||
| 55+ | 0 | 0 | 1 |
|
||||
| 56 | 0 | 0 | 1 |
|
||||
| 56+ | 0 | 0 | 1 |
|
||||
| 57 | 0 | 0 | 1 |
|
||||
| 57+ | 0 | 1 | 1 |
|
||||
| 58 | 0 | 1 | 0 |
|
||||
| 58+ | 1 | 0 | 0 |
|
||||
| 59 | 1 | 0 | 0 |
|
||||
| 59+ | 1 | 0 | 0 |
|
||||
| 60 | 1 | 0 | 0 |
|
||||
| 60+ | 1 | 0 | 0 |
|
||||
| 61 | 1 | 0 | 0 |
|
||||
| 61+ | 1 | 0 | 0 |
|
||||
| 62 | 1 | 0 | 0 |
|
||||
| 62+ | 1 | 0 | 0 |
|
||||
| 63 | 1 | 0 | 0 |
|
||||
| 63+ | 1 | 0 | 0 |
|
||||
| 64 | 1 | 0 | 0 |
|
||||
| 64+ | 1 | 0 | 0 |
|
||||
| 65 | 1 | 0 | 0 |
|
||||
| 65+ | 1 | 0 | 0 |
|
||||
| 66 | 1 | 0 | 0 |
|
||||
| 66+ | 1 | 0 | 0 |
|
||||
| 67 | 1 | 0 | 0 |
|
||||
| 67+ | 1 | 0 | 0 |
|
||||
| 68 | 1 | 0 | 0 |
|
||||
| 68+ | 1 | 0 | 0 |
|
||||
| 69 | 1 | 0 | 0 |
|
||||
| 69+ | 1 | 0 | 0 |
|
||||
| 70 | 1 | 0 | 0 |
|
||||
| 70+ | 1 | 0 | 0 |
|
||||
| 71 | 1 | 0 | 0 |
|
||||
| 71+ | 1 | 0 | 0 |
|
||||
| 72 | 1 | 0 | 0 |
|
||||
| 72+ | 1 | 0 | 0 |
|
||||
| 73 | 1 | 0 | 0 |
|
||||
| 73+ | 1 | 0 | 0 |
|
||||
| 74 | 1 | 0 | 0 |
|
||||
| 74+ | 1 | 0 | 0 |
|
||||
| 75 | 1 | 0 | 0 |
|
||||
| 75+ | 1 | 0 | 0 |
|
||||
| 76 | 1 | 0 | 0 |
|
||||
| 76+ | 1 | 0 | 0 |
|
||||
| 77 | 1 | 0 | 0 |
|
||||
| 77+ | 1 | 0 | 0 |
|
||||
| 78 | 1 | 0 | 0 |
|
||||
| 78+ | 1 | 0 | 0 |
|
||||
| 79 | 1 | 0 | 0 |
|
||||
| 79+ | 1 | 0 | 0 |
|
||||
| 80 | 1 | 0 | 0 |
|
||||
| 80+ | 1 | 0 | 0 |
|
||||
| 81 | 1 | 0 | 0 |
|
||||
| 81+ | 1 | 0 | 0 |
|
||||
| 82 | 1 | 0 | 0 |
|
||||
| 82+ | 1 | 0 | 0 |
|
||||
| 83 | 1 | 0 | 0 |
|
||||
| 83+ | 1 | 0 | 0 |
|
||||
| 84 | 1 | 0 | 0 |
|
||||
| 84+ | 1 | 0 | 0 |
|
||||
| 85 | 1 | 0 | 0 |
|
||||
| 85+ | 1 | 0 | 0 |
|
||||
| 86 | 1 | 0 | 0 |
|
||||
| 86+ | 1 | 0 | 0 |
|
||||
| 87 | 1 | 0 | 0 |
|
||||
| 87+ | 1 | 0 | 0 |
|
||||
| 88 | 1 | 0 | 0 |
|
||||
| 88+ | 1 | 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 |
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/03/a/Bit.hdl
|
||||
|
||||
/**
|
||||
* 1-bit register:
|
||||
* If load[t] == 1 then out[t+1] = in[t]
|
||||
* else out does not change (out[t+1] = out[t])
|
||||
*/
|
||||
|
||||
CHIP Bit {
|
||||
IN in, load;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Mux(a=out2,b=in,sel=load,out=out1);
|
||||
DFF(in=out1,out=out2,out=out);
|
||||
}
|
||||
Executable
+215
@@ -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 |
|
||||
| 10 | 0 | 0 | 1 |
|
||||
| 10+ | 0 | 0 | 1 |
|
||||
| 11 | 0 | 0 | 1 |
|
||||
| 11+ | 0 | 0 | 1 |
|
||||
| 12 | 0 | 0 | 1 |
|
||||
| 12+ | 0 | 0 | 1 |
|
||||
| 13 | 0 | 0 | 1 |
|
||||
| 13+ | 0 | 0 | 1 |
|
||||
| 14 | 0 | 0 | 1 |
|
||||
| 14+ | 0 | 0 | 1 |
|
||||
| 15 | 0 | 0 | 1 |
|
||||
| 15+ | 0 | 0 | 1 |
|
||||
| 16 | 0 | 0 | 1 |
|
||||
| 16+ | 0 | 0 | 1 |
|
||||
| 17 | 0 | 0 | 1 |
|
||||
| 17+ | 0 | 0 | 1 |
|
||||
| 18 | 0 | 0 | 1 |
|
||||
| 18+ | 0 | 0 | 1 |
|
||||
| 19 | 0 | 0 | 1 |
|
||||
| 19+ | 0 | 0 | 1 |
|
||||
| 20 | 0 | 0 | 1 |
|
||||
| 20+ | 0 | 0 | 1 |
|
||||
| 21 | 0 | 0 | 1 |
|
||||
| 21+ | 0 | 0 | 1 |
|
||||
| 22 | 0 | 0 | 1 |
|
||||
| 22+ | 0 | 0 | 1 |
|
||||
| 23 | 0 | 0 | 1 |
|
||||
| 23+ | 0 | 0 | 1 |
|
||||
| 24 | 0 | 0 | 1 |
|
||||
| 24+ | 0 | 0 | 1 |
|
||||
| 25 | 0 | 0 | 1 |
|
||||
| 25+ | 0 | 0 | 1 |
|
||||
| 26 | 0 | 0 | 1 |
|
||||
| 26+ | 0 | 0 | 1 |
|
||||
| 27 | 0 | 0 | 1 |
|
||||
| 27+ | 0 | 0 | 1 |
|
||||
| 28 | 0 | 0 | 1 |
|
||||
| 28+ | 0 | 0 | 1 |
|
||||
| 29 | 0 | 0 | 1 |
|
||||
| 29+ | 0 | 0 | 1 |
|
||||
| 30 | 0 | 0 | 1 |
|
||||
| 30+ | 0 | 0 | 1 |
|
||||
| 31 | 0 | 0 | 1 |
|
||||
| 31+ | 0 | 0 | 1 |
|
||||
| 32 | 0 | 0 | 1 |
|
||||
| 32+ | 0 | 0 | 1 |
|
||||
| 33 | 0 | 0 | 1 |
|
||||
| 33+ | 0 | 0 | 1 |
|
||||
| 34 | 0 | 0 | 1 |
|
||||
| 34+ | 0 | 0 | 1 |
|
||||
| 35 | 0 | 0 | 1 |
|
||||
| 35+ | 0 | 0 | 1 |
|
||||
| 36 | 0 | 0 | 1 |
|
||||
| 36+ | 0 | 0 | 1 |
|
||||
| 37 | 0 | 0 | 1 |
|
||||
| 37+ | 0 | 0 | 1 |
|
||||
| 38 | 0 | 0 | 1 |
|
||||
| 38+ | 0 | 0 | 1 |
|
||||
| 39 | 0 | 0 | 1 |
|
||||
| 39+ | 0 | 0 | 1 |
|
||||
| 40 | 0 | 0 | 1 |
|
||||
| 40+ | 0 | 0 | 1 |
|
||||
| 41 | 0 | 0 | 1 |
|
||||
| 41+ | 0 | 0 | 1 |
|
||||
| 42 | 0 | 0 | 1 |
|
||||
| 42+ | 0 | 0 | 1 |
|
||||
| 43 | 0 | 0 | 1 |
|
||||
| 43+ | 0 | 0 | 1 |
|
||||
| 44 | 0 | 0 | 1 |
|
||||
| 44+ | 0 | 0 | 1 |
|
||||
| 45 | 0 | 0 | 1 |
|
||||
| 45+ | 0 | 0 | 1 |
|
||||
| 46 | 0 | 0 | 1 |
|
||||
| 46+ | 0 | 0 | 1 |
|
||||
| 47 | 0 | 0 | 1 |
|
||||
| 47+ | 0 | 0 | 1 |
|
||||
| 48 | 0 | 0 | 1 |
|
||||
| 48+ | 0 | 0 | 1 |
|
||||
| 49 | 0 | 0 | 1 |
|
||||
| 49+ | 0 | 0 | 1 |
|
||||
| 50 | 0 | 0 | 1 |
|
||||
| 50+ | 0 | 0 | 1 |
|
||||
| 51 | 0 | 0 | 1 |
|
||||
| 51+ | 0 | 0 | 1 |
|
||||
| 52 | 0 | 0 | 1 |
|
||||
| 52+ | 0 | 0 | 1 |
|
||||
| 53 | 0 | 0 | 1 |
|
||||
| 53+ | 0 | 0 | 1 |
|
||||
| 54 | 0 | 0 | 1 |
|
||||
| 54+ | 0 | 0 | 1 |
|
||||
| 55 | 0 | 0 | 1 |
|
||||
| 55+ | 0 | 0 | 1 |
|
||||
| 56 | 0 | 0 | 1 |
|
||||
| 56+ | 0 | 0 | 1 |
|
||||
| 57 | 0 | 0 | 1 |
|
||||
| 57+ | 0 | 1 | 1 |
|
||||
| 58 | 0 | 1 | 0 |
|
||||
| 58+ | 1 | 0 | 0 |
|
||||
| 59 | 1 | 0 | 0 |
|
||||
| 59+ | 1 | 0 | 0 |
|
||||
| 60 | 1 | 0 | 0 |
|
||||
| 60+ | 1 | 0 | 0 |
|
||||
| 61 | 1 | 0 | 0 |
|
||||
| 61+ | 1 | 0 | 0 |
|
||||
| 62 | 1 | 0 | 0 |
|
||||
| 62+ | 1 | 0 | 0 |
|
||||
| 63 | 1 | 0 | 0 |
|
||||
| 63+ | 1 | 0 | 0 |
|
||||
| 64 | 1 | 0 | 0 |
|
||||
| 64+ | 1 | 0 | 0 |
|
||||
| 65 | 1 | 0 | 0 |
|
||||
| 65+ | 1 | 0 | 0 |
|
||||
| 66 | 1 | 0 | 0 |
|
||||
| 66+ | 1 | 0 | 0 |
|
||||
| 67 | 1 | 0 | 0 |
|
||||
| 67+ | 1 | 0 | 0 |
|
||||
| 68 | 1 | 0 | 0 |
|
||||
| 68+ | 1 | 0 | 0 |
|
||||
| 69 | 1 | 0 | 0 |
|
||||
| 69+ | 1 | 0 | 0 |
|
||||
| 70 | 1 | 0 | 0 |
|
||||
| 70+ | 1 | 0 | 0 |
|
||||
| 71 | 1 | 0 | 0 |
|
||||
| 71+ | 1 | 0 | 0 |
|
||||
| 72 | 1 | 0 | 0 |
|
||||
| 72+ | 1 | 0 | 0 |
|
||||
| 73 | 1 | 0 | 0 |
|
||||
| 73+ | 1 | 0 | 0 |
|
||||
| 74 | 1 | 0 | 0 |
|
||||
| 74+ | 1 | 0 | 0 |
|
||||
| 75 | 1 | 0 | 0 |
|
||||
| 75+ | 1 | 0 | 0 |
|
||||
| 76 | 1 | 0 | 0 |
|
||||
| 76+ | 1 | 0 | 0 |
|
||||
| 77 | 1 | 0 | 0 |
|
||||
| 77+ | 1 | 0 | 0 |
|
||||
| 78 | 1 | 0 | 0 |
|
||||
| 78+ | 1 | 0 | 0 |
|
||||
| 79 | 1 | 0 | 0 |
|
||||
| 79+ | 1 | 0 | 0 |
|
||||
| 80 | 1 | 0 | 0 |
|
||||
| 80+ | 1 | 0 | 0 |
|
||||
| 81 | 1 | 0 | 0 |
|
||||
| 81+ | 1 | 0 | 0 |
|
||||
| 82 | 1 | 0 | 0 |
|
||||
| 82+ | 1 | 0 | 0 |
|
||||
| 83 | 1 | 0 | 0 |
|
||||
| 83+ | 1 | 0 | 0 |
|
||||
| 84 | 1 | 0 | 0 |
|
||||
| 84+ | 1 | 0 | 0 |
|
||||
| 85 | 1 | 0 | 0 |
|
||||
| 85+ | 1 | 0 | 0 |
|
||||
| 86 | 1 | 0 | 0 |
|
||||
| 86+ | 1 | 0 | 0 |
|
||||
| 87 | 1 | 0 | 0 |
|
||||
| 87+ | 1 | 0 | 0 |
|
||||
| 88 | 1 | 0 | 0 |
|
||||
| 88+ | 1 | 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 |
|
||||
Executable
+865
@@ -0,0 +1,865 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/03/a/Bit.tst
|
||||
|
||||
load Bit.hdl,
|
||||
output-file Bit.out,
|
||||
compare-to Bit.cmp,
|
||||
output-list time%S1.4.1 in%B2.1.2 load%B2.1.2 out%B2.1.2;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set load 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
CHIP DMux8Way16 {
|
||||
IN in[16], sel[3];
|
||||
OUT a[16], b[16], c[16], d[16], e[16], f[16], g[16], h[16];
|
||||
|
||||
PARTS:
|
||||
DMux8Way(a=a[0],b=b[0],c=c[0],d=d[0],e=e[0],f=f[0],g=g[0],h=h[0],sel=sel,in=in[0]);
|
||||
DMux8Way(a=a[1],b=b[1],c=c[1],d=d[1],e=e[1],f=f[1],g=g[1],h=h[1],sel=sel,in=in[1]);
|
||||
DMux8Way(a=a[2],b=b[2],c=c[2],d=d[2],e=e[2],f=f[2],g=g[2],h=h[2],sel=sel,in=in[2]);
|
||||
DMux8Way(a=a[3],b=b[3],c=c[3],d=d[3],e=e[3],f=f[3],g=g[3],h=h[3],sel=sel,in=in[3]);
|
||||
DMux8Way(a=a[4],b=b[4],c=c[4],d=d[4],e=e[4],f=f[4],g=g[4],h=h[4],sel=sel,in=in[4]);
|
||||
DMux8Way(a=a[5],b=b[5],c=c[5],d=d[5],e=e[5],f=f[5],g=g[5],h=h[5],sel=sel,in=in[5]);
|
||||
DMux8Way(a=a[6],b=b[6],c=c[6],d=d[6],e=e[6],f=f[6],g=g[6],h=h[6],sel=sel,in=in[6]);
|
||||
DMux8Way(a=a[7],b=b[7],c=c[7],d=d[7],e=e[7],f=f[7],g=g[7],h=h[7],sel=sel,in=in[7]);
|
||||
DMux8Way(a=a[8],b=b[8],c=c[8],d=d[8],e=e[8],f=f[8],g=g[8],h=h[8],sel=sel,in=in[8]);
|
||||
DMux8Way(a=a[9],b=b[9],c=c[9],d=d[9],e=e[9],f=f[9],g=g[9],h=h[9],sel=sel,in=in[9]);
|
||||
DMux8Way(a=a[10],b=b[10],c=c[10],d=d[10],e=e[10],f=f[10],g=g[10],h=h[10],sel=sel,in=in[10]);
|
||||
DMux8Way(a=a[11],b=b[11],c=c[11],d=d[11],e=e[11],f=f[11],g=g[11],h=h[11],sel=sel,in=in[11]);
|
||||
DMux8Way(a=a[12],b=b[12],c=c[12],d=d[12],e=e[12],f=f[12],g=g[12],h=h[12],sel=sel,in=in[12]);
|
||||
DMux8Way(a=a[13],b=b[13],c=c[13],d=d[13],e=e[13],f=f[13],g=g[13],h=h[13],sel=sel,in=in[13]);
|
||||
DMux8Way(a=a[14],b=b[14],c=c[14],d=d[14],e=e[14],f=f[14],g=g[14],h=h[14],sel=sel,in=in[14]);
|
||||
DMux8Way(a=a[15],b=b[15],c=c[15],d=d[15],e=e[15],f=f[15],g=g[15],h=h[15],sel=sel,in=in[15]);
|
||||
}
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
| time | in |reset|load | inc | out |
|
||||
| 0+ | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1 | 0 | 0 | 0 | 0 | 0 |
|
||||
| 1+ | 0 | 0 | 0 | 1 | 0 |
|
||||
| 2 | 0 | 0 | 0 | 1 | 1 |
|
||||
| 2+ | -32123 | 0 | 0 | 1 | 1 |
|
||||
| 3 | -32123 | 0 | 0 | 1 | 2 |
|
||||
| 3+ | -32123 | 0 | 1 | 1 | 2 |
|
||||
| 4 | -32123 | 0 | 1 | 1 | -32123 |
|
||||
| 4+ | -32123 | 0 | 0 | 1 | -32123 |
|
||||
| 5 | -32123 | 0 | 0 | 1 | -32122 |
|
||||
| 5+ | -32123 | 0 | 0 | 1 | -32122 |
|
||||
| 6 | -32123 | 0 | 0 | 1 | -32121 |
|
||||
| 6+ | 12345 | 0 | 1 | 0 | -32121 |
|
||||
| 7 | 12345 | 0 | 1 | 0 | 12345 |
|
||||
| 7+ | 12345 | 1 | 1 | 0 | 12345 |
|
||||
| 8 | 12345 | 1 | 1 | 0 | 0 |
|
||||
| 8+ | 12345 | 0 | 1 | 1 | 0 |
|
||||
| 9 | 12345 | 0 | 1 | 1 | 12345 |
|
||||
| 9+ | 12345 | 1 | 1 | 1 | 12345 |
|
||||
| 10 | 12345 | 1 | 1 | 1 | 0 |
|
||||
| 10+ | 12345 | 0 | 0 | 1 | 0 |
|
||||
| 11 | 12345 | 0 | 0 | 1 | 1 |
|
||||
| 11+ | 12345 | 1 | 0 | 1 | 1 |
|
||||
| 12 | 12345 | 1 | 0 | 1 | 0 |
|
||||
| 12+ | 0 | 0 | 1 | 1 | 0 |
|
||||
| 13 | 0 | 0 | 1 | 1 | 0 |
|
||||
| 13+ | 0 | 0 | 0 | 1 | 0 |
|
||||
| 14 | 0 | 0 | 0 | 1 | 1 |
|
||||
| 14+ | 22222 | 1 | 0 | 0 | 1 |
|
||||
| 15 | 22222 | 1 | 0 | 0 | 0 |
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/03/a/PC.hdl
|
||||
|
||||
/**
|
||||
* A 16-bit counter with load and reset control bits.
|
||||
* if (reset[t] == 1) out[t+1] = 0
|
||||
* else if (load[t] == 1) out[t+1] = in[t]
|
||||
* else if (inc[t] == 1) out[t+1] = out[t] + 1 (integer addition)
|
||||
* else out[t+1] = out[t]
|
||||
*/
|
||||
|
||||
CHIP PC {
|
||||
IN in[16],load,inc,reset;
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
DMux8Way(in=true,sel[0]=reset,sel[1]=load,sel[2]=inc,a=a,b=b,c=c,d=d,e=e,f=f,g=g,h=h);
|
||||
|
||||
DFF(in=inc,out=inct);
|
||||
And(a=inc,b=inct,out=out1);
|
||||
Mux16(a=in,b=out4,sel=out1,out=out2);
|
||||
Inc16(in=out2,out=out3);
|
||||
Register(in=out3,load=load,out=out4,out=out);
|
||||
|
||||
Not(in=a,out=notа);
|
||||
Register(in=in,load=notа,out=outA);
|
||||
|
||||
And16(a[0..15]=false,b[0..15]=false,out=outB);
|
||||
|
||||
Register(in=in,load=c,out=outC);
|
||||
|
||||
And16(a[0..15]=false,b[0..15]=false,out=outD);
|
||||
|
||||
|
||||
And16(a[0..15]=false,b[0..15]=false,out=outF);
|
||||
|
||||
Register(in=in,load=g,out=outG);
|
||||
|
||||
And16(a[0..15]=false,b[0..15]=false,out=outH);
|
||||
And16(a[0..15]=false,b[0..15]=false,out=outE);
|
||||
Mux8Way16(a=outA,b=outB,c=outC,d=outD,e=outE,f=outF,g=outG,h=outH,sel[0]=reset,sel[1]=load,sel[2]=inc,out=out67);
|
||||
}
|
||||
Executable
Executable
+125
@@ -0,0 +1,125 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/03/a/PC.tst
|
||||
|
||||
load PC.hdl,
|
||||
output-file PC.out,
|
||||
compare-to PC.cmp,
|
||||
output-list time%S1.4.1 in%D1.6.1 reset%B2.1.2 load%B2.1.2 inc%B2.1.2 out%D1.6.1;
|
||||
|
||||
set in 0,
|
||||
set reset 0,
|
||||
set load 0,
|
||||
set inc 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set inc 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in -32123,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set load 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 12345,
|
||||
set load 1,
|
||||
set inc 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set reset 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set reset 0,
|
||||
set inc 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set reset 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set reset 0,
|
||||
set load 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set reset 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 0,
|
||||
set reset 0,
|
||||
set load 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set load 0,
|
||||
set inc 1,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
|
||||
set in 22222,
|
||||
set reset 1,
|
||||
set inc 0,
|
||||
tick,
|
||||
output;
|
||||
|
||||
tock,
|
||||
output;
|
||||
Executable
+320
@@ -0,0 +1,320 @@
|
||||
| time | in |load |address| out |
|
||||
| 0+ | 0 | 0 | 0 | 0 |
|
||||
| 1 | 0 | 0 | 0 | 0 |
|
||||
| 1+ | 0 | 1 | 0 | 0 |
|
||||
| 2 | 0 | 1 | 0 | 0 |
|
||||
| 2+ | 1313 | 0 | 0 | 0 |
|
||||
| 3 | 1313 | 0 | 0 | 0 |
|
||||
| 3+ | 1313 | 1 | 13 | 0 |
|
||||
| 4 | 1313 | 1 | 13 | 1313 |
|
||||
| 4+ | 1313 | 0 | 0 | 0 |
|
||||
| 5 | 1313 | 0 | 0 | 0 |
|
||||
| 5+ | 4747 | 0 | 47 | 0 |
|
||||
| 6 | 4747 | 0 | 47 | 0 |
|
||||
| 6+ | 4747 | 1 | 47 | 0 |
|
||||
| 7 | 4747 | 1 | 47 | 4747 |
|
||||
| 7+ | 4747 | 0 | 47 | 4747 |
|
||||
| 8 | 4747 | 0 | 47 | 4747 |
|
||||
| 8 | 4747 | 0 | 13 | 1313 |
|
||||
| 8+ | 6363 | 0 | 13 | 1313 |
|
||||
| 9 | 6363 | 0 | 13 | 1313 |
|
||||
| 9+ | 6363 | 1 | 63 | 0 |
|
||||
| 10 | 6363 | 1 | 63 | 6363 |
|
||||
| 10+ | 6363 | 0 | 63 | 6363 |
|
||||
| 11 | 6363 | 0 | 63 | 6363 |
|
||||
| 11 | 6363 | 0 | 47 | 4747 |
|
||||
| 11 | 6363 | 0 | 63 | 6363 |
|
||||
| 11+ | 6363 | 0 | 40 | 0 |
|
||||
| 12 | 6363 | 0 | 40 | 0 |
|
||||
| 12 | 6363 | 0 | 41 | 0 |
|
||||
| 12 | 6363 | 0 | 42 | 0 |
|
||||
| 12 | 6363 | 0 | 43 | 0 |
|
||||
| 12 | 6363 | 0 | 44 | 0 |
|
||||
| 12 | 6363 | 0 | 45 | 0 |
|
||||
| 12 | 6363 | 0 | 46 | 0 |
|
||||
| 12 | 6363 | 0 | 47 | 4747 |
|
||||
| 12+ | 21845 | 1 | 40 | 0 |
|
||||
| 13 | 21845 | 1 | 40 | 21845 |
|
||||
| 13+ | 21845 | 1 | 41 | 0 |
|
||||
| 14 | 21845 | 1 | 41 | 21845 |
|
||||
| 14+ | 21845 | 1 | 42 | 0 |
|
||||
| 15 | 21845 | 1 | 42 | 21845 |
|
||||
| 15+ | 21845 | 1 | 43 | 0 |
|
||||
| 16 | 21845 | 1 | 43 | 21845 |
|
||||
| 16+ | 21845 | 1 | 44 | 0 |
|
||||
| 17 | 21845 | 1 | 44 | 21845 |
|
||||
| 17+ | 21845 | 1 | 45 | 0 |
|
||||
| 18 | 21845 | 1 | 45 | 21845 |
|
||||
| 18+ | 21845 | 1 | 46 | 0 |
|
||||
| 19 | 21845 | 1 | 46 | 21845 |
|
||||
| 19+ | 21845 | 1 | 47 | 4747 |
|
||||
| 20 | 21845 | 1 | 47 | 21845 |
|
||||
| 20+ | 21845 | 0 | 40 | 21845 |
|
||||
| 21 | 21845 | 0 | 40 | 21845 |
|
||||
| 21 | 21845 | 0 | 41 | 21845 |
|
||||
| 21 | 21845 | 0 | 42 | 21845 |
|
||||
| 21 | 21845 | 0 | 43 | 21845 |
|
||||
| 21 | 21845 | 0 | 44 | 21845 |
|
||||
| 21 | 21845 | 0 | 45 | 21845 |
|
||||
| 21 | 21845 | 0 | 46 | 21845 |
|
||||
| 21 | 21845 | 0 | 47 | 21845 |
|
||||
| 21+ | -21846 | 1 | 40 | 21845 |
|
||||
| 22 | -21846 | 1 | 40 | -21846 |
|
||||
| 22+ | -21846 | 0 | 40 | -21846 |
|
||||
| 23 | -21846 | 0 | 40 | -21846 |
|
||||
| 23 | -21846 | 0 | 41 | 21845 |
|
||||
| 23 | -21846 | 0 | 42 | 21845 |
|
||||
| 23 | -21846 | 0 | 43 | 21845 |
|
||||
| 23 | -21846 | 0 | 44 | 21845 |
|
||||
| 23 | -21846 | 0 | 45 | 21845 |
|
||||
| 23 | -21846 | 0 | 46 | 21845 |
|
||||
| 23 | -21846 | 0 | 47 | 21845 |
|
||||
| 23+ | 21845 | 1 | 40 | -21846 |
|
||||
| 24 | 21845 | 1 | 40 | 21845 |
|
||||
| 24+ | -21846 | 1 | 41 | 21845 |
|
||||
| 25 | -21846 | 1 | 41 | -21846 |
|
||||
| 25+ | -21846 | 0 | 40 | 21845 |
|
||||
| 26 | -21846 | 0 | 40 | 21845 |
|
||||
| 26 | -21846 | 0 | 41 | -21846 |
|
||||
| 26 | -21846 | 0 | 42 | 21845 |
|
||||
| 26 | -21846 | 0 | 43 | 21845 |
|
||||
| 26 | -21846 | 0 | 44 | 21845 |
|
||||
| 26 | -21846 | 0 | 45 | 21845 |
|
||||
| 26 | -21846 | 0 | 46 | 21845 |
|
||||
| 26 | -21846 | 0 | 47 | 21845 |
|
||||
| 26+ | 21845 | 1 | 41 | -21846 |
|
||||
| 27 | 21845 | 1 | 41 | 21845 |
|
||||
| 27+ | -21846 | 1 | 42 | 21845 |
|
||||
| 28 | -21846 | 1 | 42 | -21846 |
|
||||
| 28+ | -21846 | 0 | 40 | 21845 |
|
||||
| 29 | -21846 | 0 | 40 | 21845 |
|
||||
| 29 | -21846 | 0 | 41 | 21845 |
|
||||
| 29 | -21846 | 0 | 42 | -21846 |
|
||||
| 29 | -21846 | 0 | 43 | 21845 |
|
||||
| 29 | -21846 | 0 | 44 | 21845 |
|
||||
| 29 | -21846 | 0 | 45 | 21845 |
|
||||
| 29 | -21846 | 0 | 46 | 21845 |
|
||||
| 29 | -21846 | 0 | 47 | 21845 |
|
||||
| 29+ | 21845 | 1 | 42 | -21846 |
|
||||
| 30 | 21845 | 1 | 42 | 21845 |
|
||||
| 30+ | -21846 | 1 | 43 | 21845 |
|
||||
| 31 | -21846 | 1 | 43 | -21846 |
|
||||
| 31+ | -21846 | 0 | 40 | 21845 |
|
||||
| 32 | -21846 | 0 | 40 | 21845 |
|
||||
| 32 | -21846 | 0 | 41 | 21845 |
|
||||
| 32 | -21846 | 0 | 42 | 21845 |
|
||||
| 32 | -21846 | 0 | 43 | -21846 |
|
||||
| 32 | -21846 | 0 | 44 | 21845 |
|
||||
| 32 | -21846 | 0 | 45 | 21845 |
|
||||
| 32 | -21846 | 0 | 46 | 21845 |
|
||||
| 32 | -21846 | 0 | 47 | 21845 |
|
||||
| 32+ | 21845 | 1 | 43 | -21846 |
|
||||
| 33 | 21845 | 1 | 43 | 21845 |
|
||||
| 33+ | -21846 | 1 | 44 | 21845 |
|
||||
| 34 | -21846 | 1 | 44 | -21846 |
|
||||
| 34+ | -21846 | 0 | 40 | 21845 |
|
||||
| 35 | -21846 | 0 | 40 | 21845 |
|
||||
| 35 | -21846 | 0 | 41 | 21845 |
|
||||
| 35 | -21846 | 0 | 42 | 21845 |
|
||||
| 35 | -21846 | 0 | 43 | 21845 |
|
||||
| 35 | -21846 | 0 | 44 | -21846 |
|
||||
| 35 | -21846 | 0 | 45 | 21845 |
|
||||
| 35 | -21846 | 0 | 46 | 21845 |
|
||||
| 35 | -21846 | 0 | 47 | 21845 |
|
||||
| 35+ | 21845 | 1 | 44 | -21846 |
|
||||
| 36 | 21845 | 1 | 44 | 21845 |
|
||||
| 36+ | -21846 | 1 | 45 | 21845 |
|
||||
| 37 | -21846 | 1 | 45 | -21846 |
|
||||
| 37+ | -21846 | 0 | 40 | 21845 |
|
||||
| 38 | -21846 | 0 | 40 | 21845 |
|
||||
| 38 | -21846 | 0 | 41 | 21845 |
|
||||
| 38 | -21846 | 0 | 42 | 21845 |
|
||||
| 38 | -21846 | 0 | 43 | 21845 |
|
||||
| 38 | -21846 | 0 | 44 | 21845 |
|
||||
| 38 | -21846 | 0 | 45 | -21846 |
|
||||
| 38 | -21846 | 0 | 46 | 21845 |
|
||||
| 38 | -21846 | 0 | 47 | 21845 |
|
||||
| 38+ | 21845 | 1 | 45 | -21846 |
|
||||
| 39 | 21845 | 1 | 45 | 21845 |
|
||||
| 39+ | -21846 | 1 | 46 | 21845 |
|
||||
| 40 | -21846 | 1 | 46 | -21846 |
|
||||
| 40+ | -21846 | 0 | 40 | 21845 |
|
||||
| 41 | -21846 | 0 | 40 | 21845 |
|
||||
| 41 | -21846 | 0 | 41 | 21845 |
|
||||
| 41 | -21846 | 0 | 42 | 21845 |
|
||||
| 41 | -21846 | 0 | 43 | 21845 |
|
||||
| 41 | -21846 | 0 | 44 | 21845 |
|
||||
| 41 | -21846 | 0 | 45 | 21845 |
|
||||
| 41 | -21846 | 0 | 46 | -21846 |
|
||||
| 41 | -21846 | 0 | 47 | 21845 |
|
||||
| 41+ | 21845 | 1 | 46 | -21846 |
|
||||
| 42 | 21845 | 1 | 46 | 21845 |
|
||||
| 42+ | -21846 | 1 | 47 | 21845 |
|
||||
| 43 | -21846 | 1 | 47 | -21846 |
|
||||
| 43+ | -21846 | 0 | 40 | 21845 |
|
||||
| 44 | -21846 | 0 | 40 | 21845 |
|
||||
| 44 | -21846 | 0 | 41 | 21845 |
|
||||
| 44 | -21846 | 0 | 42 | 21845 |
|
||||
| 44 | -21846 | 0 | 43 | 21845 |
|
||||
| 44 | -21846 | 0 | 44 | 21845 |
|
||||
| 44 | -21846 | 0 | 45 | 21845 |
|
||||
| 44 | -21846 | 0 | 46 | 21845 |
|
||||
| 44 | -21846 | 0 | 47 | -21846 |
|
||||
| 44+ | 21845 | 1 | 47 | -21846 |
|
||||
| 45 | 21845 | 1 | 47 | 21845 |
|
||||
| 45+ | 21845 | 0 | 40 | 21845 |
|
||||
| 46 | 21845 | 0 | 40 | 21845 |
|
||||
| 46 | 21845 | 0 | 41 | 21845 |
|
||||
| 46 | 21845 | 0 | 42 | 21845 |
|
||||
| 46 | 21845 | 0 | 43 | 21845 |
|
||||
| 46 | 21845 | 0 | 44 | 21845 |
|
||||
| 46 | 21845 | 0 | 45 | 21845 |
|
||||
| 46 | 21845 | 0 | 46 | 21845 |
|
||||
| 46 | 21845 | 0 | 47 | 21845 |
|
||||
| 46+ | 21845 | 0 | 5 | 0 |
|
||||
| 47 | 21845 | 0 | 5 | 0 |
|
||||
| 47 | 21845 | 0 | 13 | 1313 |
|
||||
| 47 | 21845 | 0 | 21 | 0 |
|
||||
| 47 | 21845 | 0 | 29 | 0 |
|
||||
| 47 | 21845 | 0 | 37 | 0 |
|
||||
| 47 | 21845 | 0 | 45 | 21845 |
|
||||
| 47 | 21845 | 0 | 53 | 0 |
|
||||
| 47 | 21845 | 0 | 61 | 0 |
|
||||
| 47+ | 21845 | 1 | 5 | 0 |
|
||||
| 48 | 21845 | 1 | 5 | 21845 |
|
||||
| 48+ | 21845 | 1 | 13 | 1313 |
|
||||
| 49 | 21845 | 1 | 13 | 21845 |
|
||||
| 49+ | 21845 | 1 | 21 | 0 |
|
||||
| 50 | 21845 | 1 | 21 | 21845 |
|
||||
| 50+ | 21845 | 1 | 29 | 0 |
|
||||
| 51 | 21845 | 1 | 29 | 21845 |
|
||||
| 51+ | 21845 | 1 | 37 | 0 |
|
||||
| 52 | 21845 | 1 | 37 | 21845 |
|
||||
| 52+ | 21845 | 1 | 45 | 21845 |
|
||||
| 53 | 21845 | 1 | 45 | 21845 |
|
||||
| 53+ | 21845 | 1 | 53 | 0 |
|
||||
| 54 | 21845 | 1 | 53 | 21845 |
|
||||
| 54+ | 21845 | 1 | 61 | 0 |
|
||||
| 55 | 21845 | 1 | 61 | 21845 |
|
||||
| 55+ | 21845 | 0 | 5 | 21845 |
|
||||
| 56 | 21845 | 0 | 5 | 21845 |
|
||||
| 56 | 21845 | 0 | 13 | 21845 |
|
||||
| 56 | 21845 | 0 | 21 | 21845 |
|
||||
| 56 | 21845 | 0 | 29 | 21845 |
|
||||
| 56 | 21845 | 0 | 37 | 21845 |
|
||||
| 56 | 21845 | 0 | 45 | 21845 |
|
||||
| 56 | 21845 | 0 | 53 | 21845 |
|
||||
| 56 | 21845 | 0 | 61 | 21845 |
|
||||
| 56+ | -21846 | 1 | 5 | 21845 |
|
||||
| 57 | -21846 | 1 | 5 | -21846 |
|
||||
| 57+ | -21846 | 0 | 5 | -21846 |
|
||||
| 58 | -21846 | 0 | 5 | -21846 |
|
||||
| 58 | -21846 | 0 | 13 | 21845 |
|
||||
| 58 | -21846 | 0 | 21 | 21845 |
|
||||
| 58 | -21846 | 0 | 29 | 21845 |
|
||||
| 58 | -21846 | 0 | 37 | 21845 |
|
||||
| 58 | -21846 | 0 | 45 | 21845 |
|
||||
| 58 | -21846 | 0 | 53 | 21845 |
|
||||
| 58 | -21846 | 0 | 61 | 21845 |
|
||||
| 58+ | 21845 | 1 | 5 | -21846 |
|
||||
| 59 | 21845 | 1 | 5 | 21845 |
|
||||
| 59+ | -21846 | 1 | 13 | 21845 |
|
||||
| 60 | -21846 | 1 | 13 | -21846 |
|
||||
| 60+ | -21846 | 0 | 5 | 21845 |
|
||||
| 61 | -21846 | 0 | 5 | 21845 |
|
||||
| 61 | -21846 | 0 | 13 | -21846 |
|
||||
| 61 | -21846 | 0 | 21 | 21845 |
|
||||
| 61 | -21846 | 0 | 29 | 21845 |
|
||||
| 61 | -21846 | 0 | 37 | 21845 |
|
||||
| 61 | -21846 | 0 | 45 | 21845 |
|
||||
| 61 | -21846 | 0 | 53 | 21845 |
|
||||
| 61 | -21846 | 0 | 61 | 21845 |
|
||||
| 61+ | 21845 | 1 | 13 | -21846 |
|
||||
| 62 | 21845 | 1 | 13 | 21845 |
|
||||
| 62+ | -21846 | 1 | 21 | 21845 |
|
||||
| 63 | -21846 | 1 | 21 | -21846 |
|
||||
| 63+ | -21846 | 0 | 5 | 21845 |
|
||||
| 64 | -21846 | 0 | 5 | 21845 |
|
||||
| 64 | -21846 | 0 | 13 | 21845 |
|
||||
| 64 | -21846 | 0 | 21 | -21846 |
|
||||
| 64 | -21846 | 0 | 29 | 21845 |
|
||||
| 64 | -21846 | 0 | 37 | 21845 |
|
||||
| 64 | -21846 | 0 | 45 | 21845 |
|
||||
| 64 | -21846 | 0 | 53 | 21845 |
|
||||
| 64 | -21846 | 0 | 61 | 21845 |
|
||||
| 64+ | 21845 | 1 | 21 | -21846 |
|
||||
| 65 | 21845 | 1 | 21 | 21845 |
|
||||
| 65+ | -21846 | 1 | 29 | 21845 |
|
||||
| 66 | -21846 | 1 | 29 | -21846 |
|
||||
| 66+ | -21846 | 0 | 5 | 21845 |
|
||||
| 67 | -21846 | 0 | 5 | 21845 |
|
||||
| 67 | -21846 | 0 | 13 | 21845 |
|
||||
| 67 | -21846 | 0 | 21 | 21845 |
|
||||
| 67 | -21846 | 0 | 29 | -21846 |
|
||||
| 67 | -21846 | 0 | 37 | 21845 |
|
||||
| 67 | -21846 | 0 | 45 | 21845 |
|
||||
| 67 | -21846 | 0 | 53 | 21845 |
|
||||
| 67 | -21846 | 0 | 61 | 21845 |
|
||||
| 67+ | 21845 | 1 | 29 | -21846 |
|
||||
| 68 | 21845 | 1 | 29 | 21845 |
|
||||
| 68+ | -21846 | 1 | 37 | 21845 |
|
||||
| 69 | -21846 | 1 | 37 | -21846 |
|
||||
| 69+ | -21846 | 0 | 5 | 21845 |
|
||||
| 70 | -21846 | 0 | 5 | 21845 |
|
||||
| 70 | -21846 | 0 | 13 | 21845 |
|
||||
| 70 | -21846 | 0 | 21 | 21845 |
|
||||
| 70 | -21846 | 0 | 29 | 21845 |
|
||||
| 70 | -21846 | 0 | 37 | -21846 |
|
||||
| 70 | -21846 | 0 | 45 | 21845 |
|
||||
| 70 | -21846 | 0 | 53 | 21845 |
|
||||
| 70 | -21846 | 0 | 61 | 21845 |
|
||||
| 70+ | 21845 | 1 | 37 | -21846 |
|
||||
| 71 | 21845 | 1 | 37 | 21845 |
|
||||
| 71+ | -21846 | 1 | 45 | 21845 |
|
||||
| 72 | -21846 | 1 | 45 | -21846 |
|
||||
| 72+ | -21846 | 0 | 5 | 21845 |
|
||||
| 73 | -21846 | 0 | 5 | 21845 |
|
||||
| 73 | -21846 | 0 | 13 | 21845 |
|
||||
| 73 | -21846 | 0 | 21 | 21845 |
|
||||
| 73 | -21846 | 0 | 29 | 21845 |
|
||||
| 73 | -21846 | 0 | 37 | 21845 |
|
||||
| 73 | -21846 | 0 | 45 | -21846 |
|
||||
| 73 | -21846 | 0 | 53 | 21845 |
|
||||
| 73 | -21846 | 0 | 61 | 21845 |
|
||||
| 73+ | 21845 | 1 | 45 | -21846 |
|
||||
| 74 | 21845 | 1 | 45 | 21845 |
|
||||
| 74+ | -21846 | 1 | 53 | 21845 |
|
||||
| 75 | -21846 | 1 | 53 | -21846 |
|
||||
| 75+ | -21846 | 0 | 5 | 21845 |
|
||||
| 76 | -21846 | 0 | 5 | 21845 |
|
||||
| 76 | -21846 | 0 | 13 | 21845 |
|
||||
| 76 | -21846 | 0 | 21 | 21845 |
|
||||
| 76 | -21846 | 0 | 29 | 21845 |
|
||||
| 76 | -21846 | 0 | 37 | 21845 |
|
||||
| 76 | -21846 | 0 | 45 | 21845 |
|
||||
| 76 | -21846 | 0 | 53 | -21846 |
|
||||
| 76 | -21846 | 0 | 61 | 21845 |
|
||||
| 76+ | 21845 | 1 | 53 | -21846 |
|
||||
| 77 | 21845 | 1 | 53 | 21845 |
|
||||
| 77+ | -21846 | 1 | 61 | 21845 |
|
||||
| 78 | -21846 | 1 | 61 | -21846 |
|
||||
| 78+ | -21846 | 0 | 5 | 21845 |
|
||||
| 79 | -21846 | 0 | 5 | 21845 |
|
||||
| 79 | -21846 | 0 | 13 | 21845 |
|
||||
| 79 | -21846 | 0 | 21 | 21845 |
|
||||
| 79 | -21846 | 0 | 29 | 21845 |
|
||||
| 79 | -21846 | 0 | 37 | 21845 |
|
||||
| 79 | -21846 | 0 | 45 | 21845 |
|
||||
| 79 | -21846 | 0 | 53 | 21845 |
|
||||
| 79 | -21846 | 0 | 61 | -21846 |
|
||||
| 79+ | 21845 | 1 | 61 | -21846 |
|
||||
| 80 | 21845 | 1 | 61 | 21845 |
|
||||
| 80+ | 21845 | 0 | 5 | 21845 |
|
||||
| 81 | 21845 | 0 | 5 | 21845 |
|
||||
| 81 | 21845 | 0 | 13 | 21845 |
|
||||
| 81 | 21845 | 0 | 21 | 21845 |
|
||||
| 81 | 21845 | 0 | 29 | 21845 |
|
||||
| 81 | 21845 | 0 | 37 | 21845 |
|
||||
| 81 | 21845 | 0 | 45 | 21845 |
|
||||
| 81 | 21845 | 0 | 53 | 21845 |
|
||||
| 81 | 21845 | 0 | 61 | 21845 |
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/03/a/RAM64.hdl
|
||||
|
||||
/**
|
||||
* Memory of 64 registers, each 16 bit-wide. Out holds the value
|
||||
* stored at the memory location specified by address. If load==1, then
|
||||
* the in value is loaded into the memory location specified by address
|
||||
* (the loaded value will be emitted to out from the next time step onward).
|
||||
*/
|
||||
|
||||
CHIP RAM64 {
|
||||
IN in[16], load, address[6];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
DMux8Way(in=load,sel=address[0..2],a=a,b=b,c=c,d=d,e=e,f=f,g=g,h=h);
|
||||
RAM8(in=in,load=a,address=address[3..5],out=outa);
|
||||
RAM8(in=in,load=b,address=address[3..5],out=outb);
|
||||
RAM8(in=in,load=c,address=address[3..5],out=outc);
|
||||
RAM8(in=in,load=d,address=address[3..5],out=outd);
|
||||
RAM8(in=in,load=e,address=address[3..5],out=oute);
|
||||
RAM8(in=in,load=f,address=address[3..5],out=outf);
|
||||
RAM8(in=in,load=g,address=address[3..5],out=outg);
|
||||
RAM8(in=in,load=h,address=address[3..5],out=outh);
|
||||
Mux8Way16(a=outa,b=outb,c=outc,d=outd,e=oute,f=outf,g=outg,h=outh,sel=address[0..2],out=out);
|
||||
}
|
||||
Executable
+320
@@ -0,0 +1,320 @@
|
||||
| time | in |load |address| out |
|
||||
| 0+ | 0 | 0 | 0 | 0 |
|
||||
| 1 | 0 | 0 | 0 | 0 |
|
||||
| 1+ | 0 | 1 | 0 | 0 |
|
||||
| 2 | 0 | 1 | 0 | 0 |
|
||||
| 2+ | 1313 | 0 | 0 | 0 |
|
||||
| 3 | 1313 | 0 | 0 | 0 |
|
||||
| 3+ | 1313 | 1 | 13 | 0 |
|
||||
| 4 | 1313 | 1 | 13 | 1313 |
|
||||
| 4+ | 1313 | 0 | 0 | 0 |
|
||||
| 5 | 1313 | 0 | 0 | 0 |
|
||||
| 5+ | 4747 | 0 | 47 | 0 |
|
||||
| 6 | 4747 | 0 | 47 | 0 |
|
||||
| 6+ | 4747 | 1 | 47 | 0 |
|
||||
| 7 | 4747 | 1 | 47 | 4747 |
|
||||
| 7+ | 4747 | 0 | 47 | 4747 |
|
||||
| 8 | 4747 | 0 | 47 | 4747 |
|
||||
| 8 | 4747 | 0 | 13 | 1313 |
|
||||
| 8+ | 6363 | 0 | 13 | 1313 |
|
||||
| 9 | 6363 | 0 | 13 | 1313 |
|
||||
| 9+ | 6363 | 1 | 63 | 0 |
|
||||
| 10 | 6363 | 1 | 63 | 6363 |
|
||||
| 10+ | 6363 | 0 | 63 | 6363 |
|
||||
| 11 | 6363 | 0 | 63 | 6363 |
|
||||
| 11 | 6363 | 0 | 47 | 4747 |
|
||||
| 11 | 6363 | 0 | 63 | 6363 |
|
||||
| 11+ | 6363 | 0 | 40 | 0 |
|
||||
| 12 | 6363 | 0 | 40 | 0 |
|
||||
| 12 | 6363 | 0 | 41 | 0 |
|
||||
| 12 | 6363 | 0 | 42 | 0 |
|
||||
| 12 | 6363 | 0 | 43 | 0 |
|
||||
| 12 | 6363 | 0 | 44 | 0 |
|
||||
| 12 | 6363 | 0 | 45 | 0 |
|
||||
| 12 | 6363 | 0 | 46 | 0 |
|
||||
| 12 | 6363 | 0 | 47 | 4747 |
|
||||
| 12+ | 21845 | 1 | 40 | 0 |
|
||||
| 13 | 21845 | 1 | 40 | 21845 |
|
||||
| 13+ | 21845 | 1 | 41 | 0 |
|
||||
| 14 | 21845 | 1 | 41 | 21845 |
|
||||
| 14+ | 21845 | 1 | 42 | 0 |
|
||||
| 15 | 21845 | 1 | 42 | 21845 |
|
||||
| 15+ | 21845 | 1 | 43 | 0 |
|
||||
| 16 | 21845 | 1 | 43 | 21845 |
|
||||
| 16+ | 21845 | 1 | 44 | 0 |
|
||||
| 17 | 21845 | 1 | 44 | 21845 |
|
||||
| 17+ | 21845 | 1 | 45 | 0 |
|
||||
| 18 | 21845 | 1 | 45 | 21845 |
|
||||
| 18+ | 21845 | 1 | 46 | 0 |
|
||||
| 19 | 21845 | 1 | 46 | 21845 |
|
||||
| 19+ | 21845 | 1 | 47 | 4747 |
|
||||
| 20 | 21845 | 1 | 47 | 21845 |
|
||||
| 20+ | 21845 | 0 | 40 | 21845 |
|
||||
| 21 | 21845 | 0 | 40 | 21845 |
|
||||
| 21 | 21845 | 0 | 41 | 21845 |
|
||||
| 21 | 21845 | 0 | 42 | 21845 |
|
||||
| 21 | 21845 | 0 | 43 | 21845 |
|
||||
| 21 | 21845 | 0 | 44 | 21845 |
|
||||
| 21 | 21845 | 0 | 45 | 21845 |
|
||||
| 21 | 21845 | 0 | 46 | 21845 |
|
||||
| 21 | 21845 | 0 | 47 | 21845 |
|
||||
| 21+ | -21846 | 1 | 40 | 21845 |
|
||||
| 22 | -21846 | 1 | 40 | -21846 |
|
||||
| 22+ | -21846 | 0 | 40 | -21846 |
|
||||
| 23 | -21846 | 0 | 40 | -21846 |
|
||||
| 23 | -21846 | 0 | 41 | 21845 |
|
||||
| 23 | -21846 | 0 | 42 | 21845 |
|
||||
| 23 | -21846 | 0 | 43 | 21845 |
|
||||
| 23 | -21846 | 0 | 44 | 21845 |
|
||||
| 23 | -21846 | 0 | 45 | 21845 |
|
||||
| 23 | -21846 | 0 | 46 | 21845 |
|
||||
| 23 | -21846 | 0 | 47 | 21845 |
|
||||
| 23+ | 21845 | 1 | 40 | -21846 |
|
||||
| 24 | 21845 | 1 | 40 | 21845 |
|
||||
| 24+ | -21846 | 1 | 41 | 21845 |
|
||||
| 25 | -21846 | 1 | 41 | -21846 |
|
||||
| 25+ | -21846 | 0 | 40 | 21845 |
|
||||
| 26 | -21846 | 0 | 40 | 21845 |
|
||||
| 26 | -21846 | 0 | 41 | -21846 |
|
||||
| 26 | -21846 | 0 | 42 | 21845 |
|
||||
| 26 | -21846 | 0 | 43 | 21845 |
|
||||
| 26 | -21846 | 0 | 44 | 21845 |
|
||||
| 26 | -21846 | 0 | 45 | 21845 |
|
||||
| 26 | -21846 | 0 | 46 | 21845 |
|
||||
| 26 | -21846 | 0 | 47 | 21845 |
|
||||
| 26+ | 21845 | 1 | 41 | -21846 |
|
||||
| 27 | 21845 | 1 | 41 | 21845 |
|
||||
| 27+ | -21846 | 1 | 42 | 21845 |
|
||||
| 28 | -21846 | 1 | 42 | -21846 |
|
||||
| 28+ | -21846 | 0 | 40 | 21845 |
|
||||
| 29 | -21846 | 0 | 40 | 21845 |
|
||||
| 29 | -21846 | 0 | 41 | 21845 |
|
||||
| 29 | -21846 | 0 | 42 | -21846 |
|
||||
| 29 | -21846 | 0 | 43 | 21845 |
|
||||
| 29 | -21846 | 0 | 44 | 21845 |
|
||||
| 29 | -21846 | 0 | 45 | 21845 |
|
||||
| 29 | -21846 | 0 | 46 | 21845 |
|
||||
| 29 | -21846 | 0 | 47 | 21845 |
|
||||
| 29+ | 21845 | 1 | 42 | -21846 |
|
||||
| 30 | 21845 | 1 | 42 | 21845 |
|
||||
| 30+ | -21846 | 1 | 43 | 21845 |
|
||||
| 31 | -21846 | 1 | 43 | -21846 |
|
||||
| 31+ | -21846 | 0 | 40 | 21845 |
|
||||
| 32 | -21846 | 0 | 40 | 21845 |
|
||||
| 32 | -21846 | 0 | 41 | 21845 |
|
||||
| 32 | -21846 | 0 | 42 | 21845 |
|
||||
| 32 | -21846 | 0 | 43 | -21846 |
|
||||
| 32 | -21846 | 0 | 44 | 21845 |
|
||||
| 32 | -21846 | 0 | 45 | 21845 |
|
||||
| 32 | -21846 | 0 | 46 | 21845 |
|
||||
| 32 | -21846 | 0 | 47 | 21845 |
|
||||
| 32+ | 21845 | 1 | 43 | -21846 |
|
||||
| 33 | 21845 | 1 | 43 | 21845 |
|
||||
| 33+ | -21846 | 1 | 44 | 21845 |
|
||||
| 34 | -21846 | 1 | 44 | -21846 |
|
||||
| 34+ | -21846 | 0 | 40 | 21845 |
|
||||
| 35 | -21846 | 0 | 40 | 21845 |
|
||||
| 35 | -21846 | 0 | 41 | 21845 |
|
||||
| 35 | -21846 | 0 | 42 | 21845 |
|
||||
| 35 | -21846 | 0 | 43 | 21845 |
|
||||
| 35 | -21846 | 0 | 44 | -21846 |
|
||||
| 35 | -21846 | 0 | 45 | 21845 |
|
||||
| 35 | -21846 | 0 | 46 | 21845 |
|
||||
| 35 | -21846 | 0 | 47 | 21845 |
|
||||
| 35+ | 21845 | 1 | 44 | -21846 |
|
||||
| 36 | 21845 | 1 | 44 | 21845 |
|
||||
| 36+ | -21846 | 1 | 45 | 21845 |
|
||||
| 37 | -21846 | 1 | 45 | -21846 |
|
||||
| 37+ | -21846 | 0 | 40 | 21845 |
|
||||
| 38 | -21846 | 0 | 40 | 21845 |
|
||||
| 38 | -21846 | 0 | 41 | 21845 |
|
||||
| 38 | -21846 | 0 | 42 | 21845 |
|
||||
| 38 | -21846 | 0 | 43 | 21845 |
|
||||
| 38 | -21846 | 0 | 44 | 21845 |
|
||||
| 38 | -21846 | 0 | 45 | -21846 |
|
||||
| 38 | -21846 | 0 | 46 | 21845 |
|
||||
| 38 | -21846 | 0 | 47 | 21845 |
|
||||
| 38+ | 21845 | 1 | 45 | -21846 |
|
||||
| 39 | 21845 | 1 | 45 | 21845 |
|
||||
| 39+ | -21846 | 1 | 46 | 21845 |
|
||||
| 40 | -21846 | 1 | 46 | -21846 |
|
||||
| 40+ | -21846 | 0 | 40 | 21845 |
|
||||
| 41 | -21846 | 0 | 40 | 21845 |
|
||||
| 41 | -21846 | 0 | 41 | 21845 |
|
||||
| 41 | -21846 | 0 | 42 | 21845 |
|
||||
| 41 | -21846 | 0 | 43 | 21845 |
|
||||
| 41 | -21846 | 0 | 44 | 21845 |
|
||||
| 41 | -21846 | 0 | 45 | 21845 |
|
||||
| 41 | -21846 | 0 | 46 | -21846 |
|
||||
| 41 | -21846 | 0 | 47 | 21845 |
|
||||
| 41+ | 21845 | 1 | 46 | -21846 |
|
||||
| 42 | 21845 | 1 | 46 | 21845 |
|
||||
| 42+ | -21846 | 1 | 47 | 21845 |
|
||||
| 43 | -21846 | 1 | 47 | -21846 |
|
||||
| 43+ | -21846 | 0 | 40 | 21845 |
|
||||
| 44 | -21846 | 0 | 40 | 21845 |
|
||||
| 44 | -21846 | 0 | 41 | 21845 |
|
||||
| 44 | -21846 | 0 | 42 | 21845 |
|
||||
| 44 | -21846 | 0 | 43 | 21845 |
|
||||
| 44 | -21846 | 0 | 44 | 21845 |
|
||||
| 44 | -21846 | 0 | 45 | 21845 |
|
||||
| 44 | -21846 | 0 | 46 | 21845 |
|
||||
| 44 | -21846 | 0 | 47 | -21846 |
|
||||
| 44+ | 21845 | 1 | 47 | -21846 |
|
||||
| 45 | 21845 | 1 | 47 | 21845 |
|
||||
| 45+ | 21845 | 0 | 40 | 21845 |
|
||||
| 46 | 21845 | 0 | 40 | 21845 |
|
||||
| 46 | 21845 | 0 | 41 | 21845 |
|
||||
| 46 | 21845 | 0 | 42 | 21845 |
|
||||
| 46 | 21845 | 0 | 43 | 21845 |
|
||||
| 46 | 21845 | 0 | 44 | 21845 |
|
||||
| 46 | 21845 | 0 | 45 | 21845 |
|
||||
| 46 | 21845 | 0 | 46 | 21845 |
|
||||
| 46 | 21845 | 0 | 47 | 21845 |
|
||||
| 46+ | 21845 | 0 | 5 | 0 |
|
||||
| 47 | 21845 | 0 | 5 | 0 |
|
||||
| 47 | 21845 | 0 | 13 | 1313 |
|
||||
| 47 | 21845 | 0 | 21 | 0 |
|
||||
| 47 | 21845 | 0 | 29 | 0 |
|
||||
| 47 | 21845 | 0 | 37 | 0 |
|
||||
| 47 | 21845 | 0 | 45 | 21845 |
|
||||
| 47 | 21845 | 0 | 53 | 0 |
|
||||
| 47 | 21845 | 0 | 61 | 0 |
|
||||
| 47+ | 21845 | 1 | 5 | 0 |
|
||||
| 48 | 21845 | 1 | 5 | 21845 |
|
||||
| 48+ | 21845 | 1 | 13 | 1313 |
|
||||
| 49 | 21845 | 1 | 13 | 21845 |
|
||||
| 49+ | 21845 | 1 | 21 | 0 |
|
||||
| 50 | 21845 | 1 | 21 | 21845 |
|
||||
| 50+ | 21845 | 1 | 29 | 0 |
|
||||
| 51 | 21845 | 1 | 29 | 21845 |
|
||||
| 51+ | 21845 | 1 | 37 | 0 |
|
||||
| 52 | 21845 | 1 | 37 | 21845 |
|
||||
| 52+ | 21845 | 1 | 45 | 21845 |
|
||||
| 53 | 21845 | 1 | 45 | 21845 |
|
||||
| 53+ | 21845 | 1 | 53 | 0 |
|
||||
| 54 | 21845 | 1 | 53 | 21845 |
|
||||
| 54+ | 21845 | 1 | 61 | 0 |
|
||||
| 55 | 21845 | 1 | 61 | 21845 |
|
||||
| 55+ | 21845 | 0 | 5 | 21845 |
|
||||
| 56 | 21845 | 0 | 5 | 21845 |
|
||||
| 56 | 21845 | 0 | 13 | 21845 |
|
||||
| 56 | 21845 | 0 | 21 | 21845 |
|
||||
| 56 | 21845 | 0 | 29 | 21845 |
|
||||
| 56 | 21845 | 0 | 37 | 21845 |
|
||||
| 56 | 21845 | 0 | 45 | 21845 |
|
||||
| 56 | 21845 | 0 | 53 | 21845 |
|
||||
| 56 | 21845 | 0 | 61 | 21845 |
|
||||
| 56+ | -21846 | 1 | 5 | 21845 |
|
||||
| 57 | -21846 | 1 | 5 | -21846 |
|
||||
| 57+ | -21846 | 0 | 5 | -21846 |
|
||||
| 58 | -21846 | 0 | 5 | -21846 |
|
||||
| 58 | -21846 | 0 | 13 | 21845 |
|
||||
| 58 | -21846 | 0 | 21 | 21845 |
|
||||
| 58 | -21846 | 0 | 29 | 21845 |
|
||||
| 58 | -21846 | 0 | 37 | 21845 |
|
||||
| 58 | -21846 | 0 | 45 | 21845 |
|
||||
| 58 | -21846 | 0 | 53 | 21845 |
|
||||
| 58 | -21846 | 0 | 61 | 21845 |
|
||||
| 58+ | 21845 | 1 | 5 | -21846 |
|
||||
| 59 | 21845 | 1 | 5 | 21845 |
|
||||
| 59+ | -21846 | 1 | 13 | 21845 |
|
||||
| 60 | -21846 | 1 | 13 | -21846 |
|
||||
| 60+ | -21846 | 0 | 5 | 21845 |
|
||||
| 61 | -21846 | 0 | 5 | 21845 |
|
||||
| 61 | -21846 | 0 | 13 | -21846 |
|
||||
| 61 | -21846 | 0 | 21 | 21845 |
|
||||
| 61 | -21846 | 0 | 29 | 21845 |
|
||||
| 61 | -21846 | 0 | 37 | 21845 |
|
||||
| 61 | -21846 | 0 | 45 | 21845 |
|
||||
| 61 | -21846 | 0 | 53 | 21845 |
|
||||
| 61 | -21846 | 0 | 61 | 21845 |
|
||||
| 61+ | 21845 | 1 | 13 | -21846 |
|
||||
| 62 | 21845 | 1 | 13 | 21845 |
|
||||
| 62+ | -21846 | 1 | 21 | 21845 |
|
||||
| 63 | -21846 | 1 | 21 | -21846 |
|
||||
| 63+ | -21846 | 0 | 5 | 21845 |
|
||||
| 64 | -21846 | 0 | 5 | 21845 |
|
||||
| 64 | -21846 | 0 | 13 | 21845 |
|
||||
| 64 | -21846 | 0 | 21 | -21846 |
|
||||
| 64 | -21846 | 0 | 29 | 21845 |
|
||||
| 64 | -21846 | 0 | 37 | 21845 |
|
||||
| 64 | -21846 | 0 | 45 | 21845 |
|
||||
| 64 | -21846 | 0 | 53 | 21845 |
|
||||
| 64 | -21846 | 0 | 61 | 21845 |
|
||||
| 64+ | 21845 | 1 | 21 | -21846 |
|
||||
| 65 | 21845 | 1 | 21 | 21845 |
|
||||
| 65+ | -21846 | 1 | 29 | 21845 |
|
||||
| 66 | -21846 | 1 | 29 | -21846 |
|
||||
| 66+ | -21846 | 0 | 5 | 21845 |
|
||||
| 67 | -21846 | 0 | 5 | 21845 |
|
||||
| 67 | -21846 | 0 | 13 | 21845 |
|
||||
| 67 | -21846 | 0 | 21 | 21845 |
|
||||
| 67 | -21846 | 0 | 29 | -21846 |
|
||||
| 67 | -21846 | 0 | 37 | 21845 |
|
||||
| 67 | -21846 | 0 | 45 | 21845 |
|
||||
| 67 | -21846 | 0 | 53 | 21845 |
|
||||
| 67 | -21846 | 0 | 61 | 21845 |
|
||||
| 67+ | 21845 | 1 | 29 | -21846 |
|
||||
| 68 | 21845 | 1 | 29 | 21845 |
|
||||
| 68+ | -21846 | 1 | 37 | 21845 |
|
||||
| 69 | -21846 | 1 | 37 | -21846 |
|
||||
| 69+ | -21846 | 0 | 5 | 21845 |
|
||||
| 70 | -21846 | 0 | 5 | 21845 |
|
||||
| 70 | -21846 | 0 | 13 | 21845 |
|
||||
| 70 | -21846 | 0 | 21 | 21845 |
|
||||
| 70 | -21846 | 0 | 29 | 21845 |
|
||||
| 70 | -21846 | 0 | 37 | -21846 |
|
||||
| 70 | -21846 | 0 | 45 | 21845 |
|
||||
| 70 | -21846 | 0 | 53 | 21845 |
|
||||
| 70 | -21846 | 0 | 61 | 21845 |
|
||||
| 70+ | 21845 | 1 | 37 | -21846 |
|
||||
| 71 | 21845 | 1 | 37 | 21845 |
|
||||
| 71+ | -21846 | 1 | 45 | 21845 |
|
||||
| 72 | -21846 | 1 | 45 | -21846 |
|
||||
| 72+ | -21846 | 0 | 5 | 21845 |
|
||||
| 73 | -21846 | 0 | 5 | 21845 |
|
||||
| 73 | -21846 | 0 | 13 | 21845 |
|
||||
| 73 | -21846 | 0 | 21 | 21845 |
|
||||
| 73 | -21846 | 0 | 29 | 21845 |
|
||||
| 73 | -21846 | 0 | 37 | 21845 |
|
||||
| 73 | -21846 | 0 | 45 | -21846 |
|
||||
| 73 | -21846 | 0 | 53 | 21845 |
|
||||
| 73 | -21846 | 0 | 61 | 21845 |
|
||||
| 73+ | 21845 | 1 | 45 | -21846 |
|
||||
| 74 | 21845 | 1 | 45 | 21845 |
|
||||
| 74+ | -21846 | 1 | 53 | 21845 |
|
||||
| 75 | -21846 | 1 | 53 | -21846 |
|
||||
| 75+ | -21846 | 0 | 5 | 21845 |
|
||||
| 76 | -21846 | 0 | 5 | 21845 |
|
||||
| 76 | -21846 | 0 | 13 | 21845 |
|
||||
| 76 | -21846 | 0 | 21 | 21845 |
|
||||
| 76 | -21846 | 0 | 29 | 21845 |
|
||||
| 76 | -21846 | 0 | 37 | 21845 |
|
||||
| 76 | -21846 | 0 | 45 | 21845 |
|
||||
| 76 | -21846 | 0 | 53 | -21846 |
|
||||
| 76 | -21846 | 0 | 61 | 21845 |
|
||||
| 76+ | 21845 | 1 | 53 | -21846 |
|
||||
| 77 | 21845 | 1 | 53 | 21845 |
|
||||
| 77+ | -21846 | 1 | 61 | 21845 |
|
||||
| 78 | -21846 | 1 | 61 | -21846 |
|
||||
| 78+ | -21846 | 0 | 5 | 21845 |
|
||||
| 79 | -21846 | 0 | 5 | 21845 |
|
||||
| 79 | -21846 | 0 | 13 | 21845 |
|
||||
| 79 | -21846 | 0 | 21 | 21845 |
|
||||
| 79 | -21846 | 0 | 29 | 21845 |
|
||||
| 79 | -21846 | 0 | 37 | 21845 |
|
||||
| 79 | -21846 | 0 | 45 | 21845 |
|
||||
| 79 | -21846 | 0 | 53 | 21845 |
|
||||
| 79 | -21846 | 0 | 61 | -21846 |
|
||||
| 79+ | 21845 | 1 | 61 | -21846 |
|
||||
| 80 | 21845 | 1 | 61 | 21845 |
|
||||
| 80+ | 21845 | 0 | 5 | 21845 |
|
||||
| 81 | 21845 | 0 | 5 | 21845 |
|
||||
| 81 | 21845 | 0 | 13 | 21845 |
|
||||
| 81 | 21845 | 0 | 21 | 21845 |
|
||||
| 81 | 21845 | 0 | 29 | 21845 |
|
||||
| 81 | 21845 | 0 | 37 | 21845 |
|
||||
| 81 | 21845 | 0 | 45 | 21845 |
|
||||
| 81 | 21845 | 0 | 53 | 21845 |
|
||||
| 81 | 21845 | 0 | 61 | 21845 |
|
||||
Executable
+1026
File diff suppressed because it is too large
Load Diff
Executable
+173
@@ -0,0 +1,173 @@
|
||||
| time | in |load |address| out |
|
||||
| 0+ | 0 | 0 | 0 | 0 |
|
||||
| 1 | 0 | 0 | 0 | 0 |
|
||||
| 1+ | 0 | 1 | 0 | 0 |
|
||||
| 2 | 0 | 1 | 0 | 0 |
|
||||
| 2+ | 11111 | 0 | 0 | 0 |
|
||||
| 3 | 11111 | 0 | 0 | 0 |
|
||||
| 3+ | 11111 | 1 | 1 | 0 |
|
||||
| 4 | 11111 | 1 | 1 | 11111 |
|
||||
| 4+ | 11111 | 0 | 0 | 0 |
|
||||
| 5 | 11111 | 0 | 0 | 0 |
|
||||
| 5+ | 3333 | 0 | 3 | 0 |
|
||||
| 6 | 3333 | 0 | 3 | 0 |
|
||||
| 6+ | 3333 | 1 | 3 | 0 |
|
||||
| 7 | 3333 | 1 | 3 | 3333 |
|
||||
| 7+ | 3333 | 0 | 3 | 3333 |
|
||||
| 8 | 3333 | 0 | 3 | 3333 |
|
||||
| 8 | 3333 | 0 | 1 | 11111 |
|
||||
| 8+ | 7777 | 0 | 1 | 11111 |
|
||||
| 9 | 7777 | 0 | 1 | 11111 |
|
||||
| 9+ | 7777 | 1 | 7 | 0 |
|
||||
| 10 | 7777 | 1 | 7 | 7777 |
|
||||
| 10+ | 7777 | 0 | 7 | 7777 |
|
||||
| 11 | 7777 | 0 | 7 | 7777 |
|
||||
| 11 | 7777 | 0 | 3 | 3333 |
|
||||
| 11 | 7777 | 0 | 7 | 7777 |
|
||||
| 11+ | 7777 | 0 | 0 | 0 |
|
||||
| 12 | 7777 | 0 | 0 | 0 |
|
||||
| 12 | 7777 | 0 | 1 | 11111 |
|
||||
| 12 | 7777 | 0 | 2 | 0 |
|
||||
| 12 | 7777 | 0 | 3 | 3333 |
|
||||
| 12 | 7777 | 0 | 4 | 0 |
|
||||
| 12 | 7777 | 0 | 5 | 0 |
|
||||
| 12 | 7777 | 0 | 6 | 0 |
|
||||
| 12 | 7777 | 0 | 7 | 7777 |
|
||||
| 12+ | 21845 | 1 | 0 | 0 |
|
||||
| 13 | 21845 | 1 | 0 | 21845 |
|
||||
| 13+ | 21845 | 1 | 1 | 11111 |
|
||||
| 14 | 21845 | 1 | 1 | 21845 |
|
||||
| 14+ | 21845 | 1 | 2 | 0 |
|
||||
| 15 | 21845 | 1 | 2 | 21845 |
|
||||
| 15+ | 21845 | 1 | 3 | 3333 |
|
||||
| 16 | 21845 | 1 | 3 | 21845 |
|
||||
| 16+ | 21845 | 1 | 4 | 0 |
|
||||
| 17 | 21845 | 1 | 4 | 21845 |
|
||||
| 17+ | 21845 | 1 | 5 | 0 |
|
||||
| 18 | 21845 | 1 | 5 | 21845 |
|
||||
| 18+ | 21845 | 1 | 6 | 0 |
|
||||
| 19 | 21845 | 1 | 6 | 21845 |
|
||||
| 19+ | 21845 | 1 | 7 | 7777 |
|
||||
| 20 | 21845 | 1 | 7 | 21845 |
|
||||
| 20+ | 21845 | 0 | 0 | 21845 |
|
||||
| 21 | 21845 | 0 | 0 | 21845 |
|
||||
| 21 | 21845 | 0 | 1 | 21845 |
|
||||
| 21 | 21845 | 0 | 2 | 21845 |
|
||||
| 21 | 21845 | 0 | 3 | 21845 |
|
||||
| 21 | 21845 | 0 | 4 | 21845 |
|
||||
| 21 | 21845 | 0 | 5 | 21845 |
|
||||
| 21 | 21845 | 0 | 6 | 21845 |
|
||||
| 21 | 21845 | 0 | 7 | 21845 |
|
||||
| 21+ | -21846 | 1 | 0 | 21845 |
|
||||
| 22 | -21846 | 1 | 0 | -21846 |
|
||||
| 22+ | -21846 | 0 | 0 | -21846 |
|
||||
| 23 | -21846 | 0 | 0 | -21846 |
|
||||
| 23 | -21846 | 0 | 1 | 21845 |
|
||||
| 23 | -21846 | 0 | 2 | 21845 |
|
||||
| 23 | -21846 | 0 | 3 | 21845 |
|
||||
| 23 | -21846 | 0 | 4 | 21845 |
|
||||
| 23 | -21846 | 0 | 5 | 21845 |
|
||||
| 23 | -21846 | 0 | 6 | 21845 |
|
||||
| 23 | -21846 | 0 | 7 | 21845 |
|
||||
| 23+ | 21845 | 1 | 0 | -21846 |
|
||||
| 24 | 21845 | 1 | 0 | 21845 |
|
||||
| 24+ | -21846 | 1 | 1 | 21845 |
|
||||
| 25 | -21846 | 1 | 1 | -21846 |
|
||||
| 25+ | -21846 | 0 | 0 | 21845 |
|
||||
| 26 | -21846 | 0 | 0 | 21845 |
|
||||
| 26 | -21846 | 0 | 1 | -21846 |
|
||||
| 26 | -21846 | 0 | 2 | 21845 |
|
||||
| 26 | -21846 | 0 | 3 | 21845 |
|
||||
| 26 | -21846 | 0 | 4 | 21845 |
|
||||
| 26 | -21846 | 0 | 5 | 21845 |
|
||||
| 26 | -21846 | 0 | 6 | 21845 |
|
||||
| 26 | -21846 | 0 | 7 | 21845 |
|
||||
| 26+ | 21845 | 1 | 1 | -21846 |
|
||||
| 27 | 21845 | 1 | 1 | 21845 |
|
||||
| 27+ | -21846 | 1 | 2 | 21845 |
|
||||
| 28 | -21846 | 1 | 2 | -21846 |
|
||||
| 28+ | -21846 | 0 | 0 | 21845 |
|
||||
| 29 | -21846 | 0 | 0 | 21845 |
|
||||
| 29 | -21846 | 0 | 1 | 21845 |
|
||||
| 29 | -21846 | 0 | 2 | -21846 |
|
||||
| 29 | -21846 | 0 | 3 | 21845 |
|
||||
| 29 | -21846 | 0 | 4 | 21845 |
|
||||
| 29 | -21846 | 0 | 5 | 21845 |
|
||||
| 29 | -21846 | 0 | 6 | 21845 |
|
||||
| 29 | -21846 | 0 | 7 | 21845 |
|
||||
| 29+ | 21845 | 1 | 2 | -21846 |
|
||||
| 30 | 21845 | 1 | 2 | 21845 |
|
||||
| 30+ | -21846 | 1 | 3 | 21845 |
|
||||
| 31 | -21846 | 1 | 3 | -21846 |
|
||||
| 31+ | -21846 | 0 | 0 | 21845 |
|
||||
| 32 | -21846 | 0 | 0 | 21845 |
|
||||
| 32 | -21846 | 0 | 1 | 21845 |
|
||||
| 32 | -21846 | 0 | 2 | 21845 |
|
||||
| 32 | -21846 | 0 | 3 | -21846 |
|
||||
| 32 | -21846 | 0 | 4 | 21845 |
|
||||
| 32 | -21846 | 0 | 5 | 21845 |
|
||||
| 32 | -21846 | 0 | 6 | 21845 |
|
||||
| 32 | -21846 | 0 | 7 | 21845 |
|
||||
| 32+ | 21845 | 1 | 3 | -21846 |
|
||||
| 33 | 21845 | 1 | 3 | 21845 |
|
||||
| 33+ | -21846 | 1 | 4 | 21845 |
|
||||
| 34 | -21846 | 1 | 4 | -21846 |
|
||||
| 34+ | -21846 | 0 | 0 | 21845 |
|
||||
| 35 | -21846 | 0 | 0 | 21845 |
|
||||
| 35 | -21846 | 0 | 1 | 21845 |
|
||||
| 35 | -21846 | 0 | 2 | 21845 |
|
||||
| 35 | -21846 | 0 | 3 | 21845 |
|
||||
| 35 | -21846 | 0 | 4 | -21846 |
|
||||
| 35 | -21846 | 0 | 5 | 21845 |
|
||||
| 35 | -21846 | 0 | 6 | 21845 |
|
||||
| 35 | -21846 | 0 | 7 | 21845 |
|
||||
| 35+ | 21845 | 1 | 4 | -21846 |
|
||||
| 36 | 21845 | 1 | 4 | 21845 |
|
||||
| 36+ | -21846 | 1 | 5 | 21845 |
|
||||
| 37 | -21846 | 1 | 5 | -21846 |
|
||||
| 37+ | -21846 | 0 | 0 | 21845 |
|
||||
| 38 | -21846 | 0 | 0 | 21845 |
|
||||
| 38 | -21846 | 0 | 1 | 21845 |
|
||||
| 38 | -21846 | 0 | 2 | 21845 |
|
||||
| 38 | -21846 | 0 | 3 | 21845 |
|
||||
| 38 | -21846 | 0 | 4 | 21845 |
|
||||
| 38 | -21846 | 0 | 5 | -21846 |
|
||||
| 38 | -21846 | 0 | 6 | 21845 |
|
||||
| 38 | -21846 | 0 | 7 | 21845 |
|
||||
| 38+ | 21845 | 1 | 5 | -21846 |
|
||||
| 39 | 21845 | 1 | 5 | 21845 |
|
||||
| 39+ | -21846 | 1 | 6 | 21845 |
|
||||
| 40 | -21846 | 1 | 6 | -21846 |
|
||||
| 40+ | -21846 | 0 | 0 | 21845 |
|
||||
| 41 | -21846 | 0 | 0 | 21845 |
|
||||
| 41 | -21846 | 0 | 1 | 21845 |
|
||||
| 41 | -21846 | 0 | 2 | 21845 |
|
||||
| 41 | -21846 | 0 | 3 | 21845 |
|
||||
| 41 | -21846 | 0 | 4 | 21845 |
|
||||
| 41 | -21846 | 0 | 5 | 21845 |
|
||||
| 41 | -21846 | 0 | 6 | -21846 |
|
||||
| 41 | -21846 | 0 | 7 | 21845 |
|
||||
| 41+ | 21845 | 1 | 6 | -21846 |
|
||||
| 42 | 21845 | 1 | 6 | 21845 |
|
||||
| 42+ | -21846 | 1 | 7 | 21845 |
|
||||
| 43 | -21846 | 1 | 7 | -21846 |
|
||||
| 43+ | -21846 | 0 | 0 | 21845 |
|
||||
| 44 | -21846 | 0 | 0 | 21845 |
|
||||
| 44 | -21846 | 0 | 1 | 21845 |
|
||||
| 44 | -21846 | 0 | 2 | 21845 |
|
||||
| 44 | -21846 | 0 | 3 | 21845 |
|
||||
| 44 | -21846 | 0 | 4 | 21845 |
|
||||
| 44 | -21846 | 0 | 5 | 21845 |
|
||||
| 44 | -21846 | 0 | 6 | 21845 |
|
||||
| 44 | -21846 | 0 | 7 | -21846 |
|
||||
| 44+ | 21845 | 1 | 7 | -21846 |
|
||||
| 45 | 21845 | 1 | 7 | 21845 |
|
||||
| 45+ | 21845 | 0 | 0 | 21845 |
|
||||
| 46 | 21845 | 0 | 0 | 21845 |
|
||||
| 46 | 21845 | 0 | 1 | 21845 |
|
||||
| 46 | 21845 | 0 | 2 | 21845 |
|
||||
| 46 | 21845 | 0 | 3 | 21845 |
|
||||
| 46 | 21845 | 0 | 4 | 21845 |
|
||||
| 46 | 21845 | 0 | 5 | 21845 |
|
||||
| 46 | 21845 | 0 | 6 | 21845 |
|
||||
| 46 | 21845 | 0 | 7 | 21845 |
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user