Download the "Nand2tetris Software Suite" nand2tetris.zip from the website.
Figure out how to run the HardwareSimulator. The Software page and the Project 1 page on the Nand2tetris website have more details and links to the relevant documentation. If you are stuck, ask on Piazza, or—in the worst case—come to my office.
For this and the following projects, you may find the HDL Survival Guide useful.
A logician walks into a restaurant and tells the owner:
Each of the three conditions is a Boolean function of the three variables potatoes, noodles, and bread. It is true if the condition holds.
Design a circuit Food that has three inputs potatoes, noodles, and bread, and three outputs cond1, cond2, cond3 for the three conditions.
Start with the following template:
// Project #1-a // // Design a circuit to check the three conditions // about serving potatoes, noodles, or bread. // // Use built-in gates Not, And, Or, Nand, Xor. // CHIP Food { IN potatoes, noodles, bread; OUT cond1, cond2, cond3; PARTS: // Put your code here: }You can use the built-in gates Not, And, Or, Nand, and Xor.
Use the script Food.tst to load the circuit and evaluate it for all possible outputs. The script will write an output file Food.out.
Here are a few lines from Food.out:
|potatoe|noodles| bread | cond1 | cond2 | cond3 | | 0 | 0 | 0 | 0 | 1 | 1 | | 1 | 0 | 1 | 1 | 0 | 1 | | 1 | 1 | 1 | 0 | 0 | 0 |(The other lines are missing to make the project more interesting...)
As you can see, if neither potatoes, noodles, or bread are served, then only the first condition is violated. If potatoes and bread are served, then the second condition is violated. And if all three are served, then all three conditions are violated.
Your output file should tell you what the restaurant owner must do.
You need to upload your file Food.hdl to the submission server.
You have to register with your student id the first time you use the server.
When you register, you have to choose an alias. This alias will be used when I post your homework and exam scores.
You must remember your password. There is currently no way to retrieve or change your password. (In the worst case I can delete your registration so you can register again.)
The logician doesn't want to stay thirsty, so he tells the restaurant owner:
Design a circuit Drinks with the three inputs wine, water, and juice, and the three outputs cond1, cond2, cond3.
Start with the following template:
// Project #1-b // // Design a circuit to check the three conditions // about serving wine, water, or juice. // // Use built-in gates Not, And, Or, Nand, Xor. // CHIP Drinks { IN wine, water, juice; OUT cond1, cond2, cond3; PARTS: // Put your code here: }
Again there is a test file Drinks.tst, and a few lines from Drinks.out:
| wine | water | juice | cond1 | cond2 | cond3 | | 0 | 0 | 0 | 0 | 1 | 1 | | 1 | 0 | 0 | 1 | 1 | 0 |What are all the ways of satisfying the logician?
Again, upload your file Drinks.hdl on the submission server.