Readings
- CPU:
- N2T: Chapter 5 Intro, 5.1.4, 5.2.1, 5.2.2, 5.3.1, (slides 27-48, 78-81)
- N2T: Chapter 4 Intro, 4.1.2, 4.2.1, 4.2.2, 4.2.3, (slides 7-16, 19-23, 33-37, 41-47)
Description
This assignment will focus on the following tasks:
Build the
CPU circuit described in Project 5:
N2T: Project 5
Chapter 5 provides the contract for each circuit, i.e. description of its behavior, names and number inputs, names and state of outputs. The API is available here:
The Hack Chipset
What to turn in
Zip folder
cpu2 in file named
cpu2.zip and upload it to the Moodle dropbox. When
cpu2.zip is unzipped it should produce folder
cpu2 with the required subfolders and files inside.
Design in Logisim
Note the following requirements:
- arrange the circuits vertically in the given order (each below the previous one, *not* in a grid)
- label the input pins as specified in the contract
Here are additional specific requirements:
- save the Logisim files in folder
computer/cpu2/circ
Loader [not in the book, combinational gate]:
Chip name: Loader
Inputs: d1, d2, d3, // same meaning as Figure 4.4, p.68
ctype // is this ctype instruction
Outputs: loadA, loadD, loadM // set to 1 if inputs indicate a value
// should be loaded in respective destination
// any subset of these may be 1
This is similar to the Jumper and allows us to decide whether A, D, or M should load a new value:
- save in Loader.circ
- moderate use of basic gates; this is a very simple circuit
- start new Logisim project and save in file named CPU.circ; then complete either "CPU Setup (1)" or "CPU Setup (2)"
CPU Setup (1): if your chips from earlier assignments worked, follow this setup:
- the
CPU needs ALU, PC, Loader, Jumper; the goal of this step is to add these chips as subcircuits of CPU
- after this setup is completed you will be able to drag your own chips as boxed components onto the CPU Canvas; it essentially creates a small library similar to Wiring, Arithmetic, etc
- from project CPU.circ include your own chips as subcircuits of
CPU as follows:
- do this separately for each circuit:
ALU.circ, Jumper.circ, PC.circ, Loader.circ
- from Menu Bar: "Project=>Add Circuit..."
- use "Open..." or cut and paste the circuit
CPU Setup (2): if your chips from earlier assignments did not work, follow this setup:
- from Menu Bar: "Project=>Load Library=>Jar Library..."
- find the file that you downloaded: nand2tetris.jar
- should see a new library at the bottom called
nand2tetris that contains ALU, PC
- you will still need to add
Jumper, Loader as subcircuits of CPU
CPU:
- follow the diagram in Figure 5.8 on page 20
- consider immediately splitting the instruction into appropriate groups of bits
- for testing need to attach a clock
- minimal use of basic gates
CPU Testing - short test session is available here:
CPU Testing
Design in HDL
Here are additional specific requirements:
- Implement one circuit at a time. For circuit X copy X.hdl, X.cmp, X.tst to folder computer/cpu2/hdl/X
Loader:
- see description above
- save in Loader.hdl
- moderate use of basic gates
- Test
Loader:
- download test files: Loader.tst | Loader.cmp (fill in missing values)
- test in Hardware Simulator
- in the submission include Loader.cmp
CPU:
- follow the diagram in Figure 5.8 on page 20
- use ARegister and DRegister which are specialized versions for the plain Register
- copy in the CPU folder the .hdl files for any circuits that are useful but are not in the book and we implemented ourselves
- minimal use of basic gates
The End