mirror of
https://github.com/soconnor0919/eceg431.git
synced 2025-12-11 06:34:43 -05:00
Initial commit: Project 0 completed, Project 1 skeleton files
This commit is contained in:
5
00/Off.cmp
Executable file
5
00/Off.cmp
Executable file
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 |
|
||||
| 1 | 0 | 0 |
|
||||
| 1 | 1 | 0 |
|
||||
19
00/Off.hdl
Executable file
19
00/Off.hdl
Executable file
@@ -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/00/Off.hdl
|
||||
|
||||
/**
|
||||
* Off gate:
|
||||
* out = false (off)
|
||||
*/
|
||||
|
||||
CHIP Off {
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
// Put your code here:
|
||||
// Nand(a=true, b=false, out=out); // old
|
||||
Nand(a=true, b=true, out=out);
|
||||
}
|
||||
2
00/Off.out
Normal file
2
00/Off.out
Normal file
@@ -0,0 +1,2 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 1 |
|
||||
29
00/Off.tst
Executable file
29
00/Off.tst
Executable file
@@ -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/00/Off.tst
|
||||
|
||||
load Off.hdl,
|
||||
output-file Off.out,
|
||||
compare-to Off.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;
|
||||
74
00/index.html
Normal file
74
00/index.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
||||
<title></title>
|
||||
<base target="_self">
|
||||
<meta name="generator" content="LibreOffice 7.3.7.2 (Linux)"/>
|
||||
<meta name="created" content="00:00:00"/>
|
||||
<meta name="changed" content="2024-01-14T22:17:21.659128863"/>
|
||||
<meta name="Originator" content="Microsoft Word 15"/>
|
||||
<meta name="ProgId" content="Word.Document"/>
|
||||
<meta name="created" content="00:00:00">
|
||||
<style type="text/css">
|
||||
@page { size: 8.5in 11in; margin-left: 0.79in; margin-right: 0.39in; margin-top: 0.39in; margin-bottom: 0.39in }
|
||||
p { color: #000000; line-height: 115%; margin-bottom: 0.1in; background: transparent }
|
||||
a:link { color: #0000ff; text-decoration: underline }
|
||||
a:visited { color: #0000ff; text-decoration: underline }
|
||||
strong { font-weight: bold }
|
||||
</style>
|
||||
</head>
|
||||
<body lang="en-US" text="#000000" link="#0000ff" vlink="#0000ff" dir="ltr"><p class="msonormal">
|
||||
<font color="#004080"><i>The Elements of Computing Systems </i></font><font color="#004080">/
|
||||
</font><font color="#004080"><i>Nisan & Schocken</i></font><font color="#004080">
|
||||
/ www.idc.ac.il/tecs </font><font color="#004080"><font face="Arial, sans-serif"><b><br/>
|
||||
<br/>
|
||||
</b></font></font><strong><font color="#004080"><font face="Arial, sans-serif"><font size="5" style="font-size: 18pt">Project
|
||||
0: Getting Started</font></font></font></strong></p>
|
||||
<p><b>Objective:</b> Get the tools downloaded, experiment with the
|
||||
hardware simulator environment, and upload a file to the gradescope
|
||||
autograder.</p>
|
||||
<p><b>Contract:</b> This "project" is a self-study
|
||||
exercise. You are not actually required to build or hand-in anything,
|
||||
but rather this is built to let you get setup for the course.
|
||||
Download all the files, edit a file with a text editor, and upload a
|
||||
solution to gradescope.
|
||||
</p>
|
||||
<p><strong><font color="#004080"><font face="Arial, sans-serif">Steps</font></font></strong>
|
||||
</p>
|
||||
<p>0: Download and install the nand2tetris software suite (see
|
||||
<a href="https://www.nand2tetris.org/software">https://www.nand2tetris.org/software</a>)
|
||||
on your computer or a lab computer. On the Bucknell campus computers,
|
||||
you will need to install a java runtime and edit your path variable.
|
||||
Prof Thomas will gladly help you, but checkout the files placed in
|
||||
Moodle first. I haven’t tested this with the newest image. It is
|
||||
possible to point to the matlab java environment and run that. I also
|
||||
have a script setup to add a folder to your path which will come in
|
||||
handy why you want to use the command line later in the course.</p>
|
||||
<p>1: Chapter 1 of the book. This is available online at:
|
||||
<a href="https://www.nand2tetris.org/course">https://www.nand2tetris.org/course</a>.</p>
|
||||
<p>2. Go through parts I-II-III of the Hardware Simulator Tutorial
|
||||
(available in the see the <a href="https://www.nand2tetris.org/software">https://www.nand2tetris.org/software</a>
|
||||
Software Section of the nand2tetris web site).</p>
|
||||
<p>3. Create a directory named <font face="Courier New"><font size="2" style="font-size: 10pt">projects/00
|
||||
</font></font>on your computer, and extract “<a href="../project%2000.zip">project
|
||||
00.zip</a>” [I don’t think this link works, but the zip file is
|
||||
available on moodle] into it.</p>
|
||||
<p>4. Invoke the hardware simulator (which is now installed on your
|
||||
computer), load one of the <font face="Courier New"><font size="2" style="font-size: 10pt">.tst</font></font>
|
||||
test scripts listed below, and run/experiment with the chip.</p>
|
||||
<p><strong><font color="#004080"><font face="Arial, sans-serif">Upload
|
||||
a solution</font></font></strong></p>
|
||||
<p>The “goal” of this less is to make a two-input OFF chip. This
|
||||
chip should always output 0, or false, no matter the input
|
||||
combination. The tools are there to help you test your chip and play
|
||||
with inputs, etc. You can upload the provided (incorrect) chip as is
|
||||
to gradescope and see the results. Then, try fixing the problem, and
|
||||
uploading to see the correct results. We will make heavy use of this
|
||||
autograding feature of gradescope in the course. I’ve written quite
|
||||
a few of these testing schemes, so start early in attempting things,
|
||||
and PLEASE talk with me if you think something is weird. These have
|
||||
been refined over a few semesters and are becoming more stable
|
||||
though.</p>
|
||||
</body>
|
||||
</html>
|
||||
5
01/And.cmp
Normal file
5
01/And.cmp
Normal file
@@ -0,0 +1,5 @@
|
||||
| a | b |out|
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 |
|
||||
| 1 | 0 | 0 |
|
||||
| 1 | 1 | 1 |
|
||||
15
01/And.hdl
Normal file
15
01/And.hdl
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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/1/And.hdl
|
||||
/**
|
||||
* And gate:
|
||||
* if (a and b) out = 1, else out = 0
|
||||
*/
|
||||
CHIP And {
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
29
01/And.tst
Normal file
29
01/And.tst
Normal file
@@ -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/1/And.tst
|
||||
|
||||
load And.hdl,
|
||||
output-file And.out,
|
||||
compare-to And.cmp,
|
||||
output-list a b out;
|
||||
|
||||
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;
|
||||
7
01/And16.cmp
Normal file
7
01/And16.cmp
Normal file
@@ -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 |
|
||||
16
01/And16.hdl
Normal file
16
01/And16.hdl
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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/1/And16.hdl
|
||||
/**
|
||||
* 16-bit And gate:
|
||||
* for i = 0, ..., 15:
|
||||
* out[i] = a[i] And b[i]
|
||||
*/
|
||||
CHIP And16 {
|
||||
IN a[16], b[16];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
39
01/And16.tst
Normal file
39
01/And16.tst
Normal file
@@ -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/1/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;
|
||||
5
01/DMux.cmp
Normal file
5
01/DMux.cmp
Normal file
@@ -0,0 +1,5 @@
|
||||
|in |sel| a | b |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 | 0 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
16
01/DMux.hdl
Normal file
16
01/DMux.hdl
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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/1/DMux.hdl
|
||||
/**
|
||||
* Demultiplexor:
|
||||
* [a, b] = [in, 0] if sel = 0
|
||||
* [0, in] if sel = 1
|
||||
*/
|
||||
CHIP DMux {
|
||||
IN in, sel;
|
||||
OUT a, b;
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
27
01/DMux.tst
Normal file
27
01/DMux.tst
Normal file
@@ -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/1/DMux.tst
|
||||
|
||||
load DMux.hdl,
|
||||
output-file DMux.out,
|
||||
compare-to DMux.cmp,
|
||||
output-list in sel a b;
|
||||
|
||||
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;
|
||||
9
01/DMux4Way.cmp
Normal file
9
01/DMux4Way.cmp
Normal file
@@ -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 |
|
||||
18
01/DMux4Way.hdl
Normal file
18
01/DMux4Way.hdl
Normal file
@@ -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/1/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:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
43
01/DMux4Way.tst
Normal file
43
01/DMux4Way.tst
Normal file
@@ -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/1/DMux4Way.tst
|
||||
|
||||
load DMux4Way.hdl,
|
||||
output-file DMux4Way.out,
|
||||
compare-to DMux4Way.cmp,
|
||||
output-list in sel%B2.2.2 a b c d;
|
||||
|
||||
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;
|
||||
17
01/DMux8Way.cmp
Normal file
17
01/DMux8Way.cmp
Normal file
@@ -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 |
|
||||
22
01/DMux8Way.hdl
Normal file
22
01/DMux8Way.hdl
Normal file
@@ -0,0 +1,22 @@
|
||||
// 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/1/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
|
||||
* [0, 0, in, 0, 0, 0, 0, 0] if sel = 010
|
||||
* [0, 0, 0, in, 0, 0, 0, 0] if sel = 011
|
||||
* [0, 0, 0, 0, in, 0, 0, 0] if sel = 100
|
||||
* [0, 0, 0, 0, 0, in, 0, 0] if sel = 101
|
||||
* [0, 0, 0, 0, 0, 0, in, 0] if sel = 110
|
||||
* [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:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
75
01/DMux8Way.tst
Normal file
75
01/DMux8Way.tst
Normal file
@@ -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/1/DMux8Way.tst
|
||||
|
||||
load DMux8Way.hdl,
|
||||
output-file DMux8Way.out,
|
||||
compare-to DMux8Way.cmp,
|
||||
output-list in sel%B2.3.2 a b c d e f g h;
|
||||
|
||||
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;
|
||||
9
01/Mux.cmp
Normal file
9
01/Mux.cmp
Normal file
@@ -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 |
|
||||
15
01/Mux.hdl
Normal file
15
01/Mux.hdl
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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/1/Mux.hdl
|
||||
/**
|
||||
* Multiplexor:
|
||||
* if (sel = 0) out = a, else out = b
|
||||
*/
|
||||
CHIP Mux {
|
||||
IN a, b, sel;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
49
01/Mux.tst
Normal file
49
01/Mux.tst
Normal file
@@ -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/1/Mux.tst
|
||||
|
||||
load Mux.hdl,
|
||||
output-file Mux.out,
|
||||
compare-to Mux.cmp,
|
||||
output-list a b sel out;
|
||||
|
||||
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;
|
||||
9
01/Mux16.cmp
Normal file
9
01/Mux16.cmp
Normal file
@@ -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 |
|
||||
16
01/Mux16.hdl
Normal file
16
01/Mux16.hdl
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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/1/Mux16.hdl
|
||||
/**
|
||||
* 16-bit multiplexor:
|
||||
* for i = 0, ..., 15:
|
||||
* if (sel = 0) out[i] = a[i], else out[i] = b[i]
|
||||
*/
|
||||
CHIP Mux16 {
|
||||
IN a[16], b[16], sel;
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
49
01/Mux16.tst
Normal file
49
01/Mux16.tst
Normal file
@@ -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/1/Mux16.tst
|
||||
|
||||
load Mux16.hdl,
|
||||
output-file Mux16.out,
|
||||
compare-to Mux16.cmp,
|
||||
output-list a%B1.16.1 b%B1.16.1 sel 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;
|
||||
9
01/Mux4Way16.cmp
Normal file
9
01/Mux4Way16.cmp
Normal file
@@ -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 |
|
||||
18
01/Mux4Way16.hdl
Normal file
18
01/Mux4Way16.hdl
Normal file
@@ -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/1/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:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
49
01/Mux4Way16.tst
Normal file
49
01/Mux4Way16.tst
Normal file
@@ -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/1/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;
|
||||
17
01/Mux8Way16.cmp
Normal file
17
01/Mux8Way16.cmp
Normal file
@@ -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 |
|
||||
24
01/Mux8Way16.hdl
Normal file
24
01/Mux8Way16.hdl
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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/1/Mux8Way16.hdl
|
||||
/**
|
||||
* 8-way 16-bit multiplexor:
|
||||
* out = a if sel = 000
|
||||
* b if sel = 001
|
||||
* c if sel = 010
|
||||
* d if sel = 011
|
||||
* e if sel = 100
|
||||
* f if sel = 101
|
||||
* g if sel = 110
|
||||
* 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:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
89
01/Mux8Way16.tst
Normal file
89
01/Mux8Way16.tst
Normal file
@@ -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/1/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;
|
||||
3
01/Not.cmp
Normal file
3
01/Not.cmp
Normal file
@@ -0,0 +1,3 @@
|
||||
|in |out|
|
||||
| 0 | 1 |
|
||||
| 1 | 0 |
|
||||
15
01/Not.hdl
Normal file
15
01/Not.hdl
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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/1/Not.hdl
|
||||
/**
|
||||
* Not gate:
|
||||
* if (in) out = 0, else out = 1
|
||||
*/
|
||||
CHIP Not {
|
||||
IN in;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
17
01/Not.tst
Normal file
17
01/Not.tst
Normal file
@@ -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/1/Not.tst
|
||||
|
||||
load Not.hdl,
|
||||
output-file Not.out,
|
||||
compare-to Not.cmp,
|
||||
output-list in out;
|
||||
|
||||
set in 0,
|
||||
eval,
|
||||
output;
|
||||
|
||||
set in 1,
|
||||
eval,
|
||||
output;
|
||||
6
01/Not16.cmp
Normal file
6
01/Not16.cmp
Normal file
@@ -0,0 +1,6 @@
|
||||
| in | out |
|
||||
| 0000000000000000 | 1111111111111111 |
|
||||
| 1111111111111111 | 0000000000000000 |
|
||||
| 1010101010101010 | 0101010101010101 |
|
||||
| 0011110011000011 | 1100001100111100 |
|
||||
| 0001001000110100 | 1110110111001011 |
|
||||
16
01/Not16.hdl
Normal file
16
01/Not16.hdl
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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/1/Not16.hdl
|
||||
/**
|
||||
* 16-bit Not gate:
|
||||
* for i = 0, ..., 15:
|
||||
* out[i] = Not(a[i])
|
||||
*/
|
||||
CHIP Not16 {
|
||||
IN in[16];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
29
01/Not16.tst
Normal file
29
01/Not16.tst
Normal file
@@ -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/1/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;
|
||||
5
01/Or.cmp
Normal file
5
01/Or.cmp
Normal file
@@ -0,0 +1,5 @@
|
||||
| a | b |out|
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 |
|
||||
| 1 | 0 | 1 |
|
||||
| 1 | 1 | 1 |
|
||||
15
01/Or.hdl
Normal file
15
01/Or.hdl
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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/1/Or.hdl
|
||||
/**
|
||||
* Or gate:
|
||||
* if (a or b) out = 1, else out = 0
|
||||
*/
|
||||
CHIP Or {
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
29
01/Or.tst
Normal file
29
01/Or.tst
Normal file
@@ -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/1/Or.tst
|
||||
|
||||
load Or.hdl,
|
||||
output-file Or.out,
|
||||
compare-to Or.cmp,
|
||||
output-list a b out;
|
||||
|
||||
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;
|
||||
7
01/Or16.cmp
Normal file
7
01/Or16.cmp
Normal file
@@ -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 |
|
||||
16
01/Or16.hdl
Normal file
16
01/Or16.hdl
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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/1/Or16.hdl
|
||||
/**
|
||||
* 16-bit Or gate:
|
||||
* for i = 0, ..., 15:
|
||||
* out[i] = a[i] Or b[i]
|
||||
*/
|
||||
CHIP Or16 {
|
||||
IN a[16], b[16];
|
||||
OUT out[16];
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
39
01/Or16.tst
Normal file
39
01/Or16.tst
Normal file
@@ -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/1/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;
|
||||
6
01/Or8Way.cmp
Normal file
6
01/Or8Way.cmp
Normal file
@@ -0,0 +1,6 @@
|
||||
| in |out|
|
||||
| 00000000 | 0 |
|
||||
| 11111111 | 1 |
|
||||
| 00010000 | 1 |
|
||||
| 00000001 | 1 |
|
||||
| 00100110 | 1 |
|
||||
15
01/Or8Way.hdl
Normal file
15
01/Or8Way.hdl
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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/1/Or8Way.hdl
|
||||
/**
|
||||
* 8-way Or gate:
|
||||
* out = in[0] Or in[1] Or ... Or in[7]
|
||||
*/
|
||||
CHIP Or8Way {
|
||||
IN in[8];
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
29
01/Or8Way.tst
Normal file
29
01/Or8Way.tst
Normal file
@@ -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/1/Or8Way.tst
|
||||
|
||||
load Or8Way.hdl,
|
||||
output-file Or8Way.out,
|
||||
compare-to Or8Way.cmp,
|
||||
output-list in%B2.8.2 out;
|
||||
|
||||
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;
|
||||
17
01/Readme.txt
Normal file
17
01/Readme.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
Project 1: Elementary Logic Gates
|
||||
|
||||
The description for this project is found at:
|
||||
|
||||
https://www.nand2tetris.org/project01
|
||||
|
||||
You may _not_ work as pairs on this project. Please work individually.
|
||||
|
||||
NOTES:
|
||||
|
||||
1) Be careful not to make a recursive part declaration. The most common way is accidentally listing the chip that is being implemented in the PARTS list. The second most common way is by using PartA, which uses PartB, which in-turn uses PartA. Oops. Implementing the chips in the recommend order will help ensure this doesn't happen.
|
||||
|
||||
2) The HDL language and format is described in Appendix A. One thing to note early on is that this HDL is case-sensitive.
|
||||
|
||||
3) There is also a HDL survival guide posted at https://www.nand2tetris.org/hdl-survival-guide
|
||||
|
||||
4) The book authors have a distinction between multi-bit and multi-way. Watch out that you are implementing the correct specification for these items.
|
||||
5
01/Xor.cmp
Normal file
5
01/Xor.cmp
Normal file
@@ -0,0 +1,5 @@
|
||||
| a | b |out|
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 |
|
||||
| 1 | 0 | 1 |
|
||||
| 1 | 1 | 0 |
|
||||
15
01/Xor.hdl
Normal file
15
01/Xor.hdl
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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/1/Xor.hdl
|
||||
/**
|
||||
* Exclusive-or gate:
|
||||
* if ((a and Not(b)) or (Not(a) and b)) out = 1, else out = 0
|
||||
*/
|
||||
CHIP Xor {
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
//// Replace this comment with your code.
|
||||
}
|
||||
29
01/Xor.tst
Normal file
29
01/Xor.tst
Normal file
@@ -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/1/Xor.tst
|
||||
|
||||
load Xor.hdl,
|
||||
output-file Xor.out,
|
||||
compare-to Xor.cmp,
|
||||
output-list a b out;
|
||||
|
||||
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;
|
||||
BIN
01/chapter1lecture.pdf
Normal file
BIN
01/chapter1lecture.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user