In this project, you will continue to engage metacognitively in your time-management as a student. The metacognitive part of this assignment consists of choosing a day to track how you spend your time and reflecting on the way you have spent your time that day.
The technical part of this project consists of implementing chips that support Boolean arithmetic that cumultate to building the Arithmetic Logic Unit (ALU).
Navigate to the Project 3 assignment on Canvas. Download the document template
titled Project 3.docx
. Open the document, read the instructions on the first page, and estimate the
amount of time you think it will take you to complete this project. Then, complete parts I, II, and III of the project.
First, complete the 24-hour time audit activity. Pick a typical day in which you have a number of activities going on (e.g., classes, studying, work, etc.). For 24 hours, track all activities that you are engaging in intervals of thirty minutes. Be honest and be specific. If you are studying for Math 308 and browsing Instagram, note this. If you are spending time cooking breakfast and washing dishes, note this.
Complete this activity in the document that you downloaded above for Project 3. Once you have completed your 24-hour time audit, complete the reflection questions on page three of the document.
The centerpiece of the computer's architecture is the CPU, or Central Processing Unit, and the centerpiece of the CPU is the ALU, or Arithmetic Logic Unit. In this project, you will gradually build a set of chips, culminating in the construction of the ALU chip of the computer we are building (called the "Hack" computer). The design of the ALU differs between all computers, but the rest of the chips you will build are standard and used in real computers today.
To complete this assignment, you will need to use git to access the starter materials that have been pushed to
your repository by the course staff.
First, run git status
and see if it reports any changes. If you have any, you'll need to commit them
before proceeding (git add .
followed by git commit -m "Your message here"
).
Then, run:
git pull
(Downloads commits on the GitLab server to your local repository)
After running this command, you have synchronized the local copy of your repository with the copy on the server.
In this project, you will be building another set of chips. The only building blocks you can use are any chips you've already implemented (whether in Project 2 or in this project) and the "Additional Chips" listed in Project 3 that were not assigned for credit. As before, we highly recommend you implement in the order listed here.
Chip Name | Description | Test Script | Expected Output |
---|---|---|---|
HalfAdder | Adder with 2 inputs, sum & carry outputs | HalfAdder.tst | HalfAdder.cmp |
FullAdder | Adder with 3 inputs, sum & carry outputs | FullAdder.tst | FullAdder.cmp |
Add16 | 16-bit Adder | Add16.tst | Add16.cmp |
ALU | Arithmetic Logic Unit (initial version, only needs to support the And function and doesn't
need to handle status outputs) |
ALU-nostat-noadd.tst | ALU-nostat-noadd.cmp |
ALU | Arithmetic Logic Unit (revised version, supports both And and Add but still no
handling of status outputs) |
ALU-nostat.tst | ALU-nostat.cmp |
ALU | Arithmetic Logic Unit (complete version) | ALU.tst | ALU.cmp |
When loaded into the supplied Hardware Simulator, your chip design (modified .hdl
program), tested on
the supplied
.tst
script, should produce the outputs listed in the supplied .cmp
file. If that is not
the case, the simulator
will let you know.
The relevant reading for this project is Chapter 2 and (again) Appendix A. Since you will be depending heavily on chips from Project 2, you may find this Chip Set Overview helpful to look up the chip signature (i.e., names of connections) for the chips you need. Like the previous project, you may also find this HDL Survival Guide written by Mark Armbrust helpful.
For each chip, we supply a skeletal .hdl
file with a place holder for a missing implementation part.
In addition,
for each chip we supply a .tst
script that instructs the hardware simulator how to test it, and a
.cmp
("compare
file") containing the correct output that this test should generate. Your job is to complete and test the supplied
skeleton .hdl
files. For the ALU, two additional .tst
scripts are provided to test your
intermediate
implementations. The Hardware Simulator will allow you to load the intermediate scripts and the ALU chip to test
them, even though they don't have the same name.
You will find the supplied Hardware Simulator and all the necessary project files in the tools/
directory and in the projects/p3/
directory of your repository, respectively.
Using built-in chips: The HDL programs you write will include chip parts that you've built in Project 2. However,
as long as you don't copy those .hdl
files into the projects/p3/
directory, the Hardware
Simulator will
use the built-in versions instead. We strongly recommend using the built-in versions so you don't have to depend
on a complete implementation of the previous project to complete this one (it will also speed up chip execution
slightly).
Implementation order: While we recommend building the chips in the order above, the
Hardware Simulator has built-in chips that can be used if you are stuck on one and want to move on. To use the
built-in version, simply rename or relocate the file, so the Hardware Simulator doesn't find the .hdl
at hand in the directory and try using it.
The Hack ALU produces two kinds of outputs: a "main" 16-bit output resulting from operating on the two 16-bit
inputs, and two one-bit "status outputs" named 'zr
' and 'ng
'. We recommend building
this functionality in three
stages:
And
function (ignoring the f
input bit) and ignoring the zr
and
ng
status outputs. When completed, your implementation should be able to pass the
ALU-nostat-noadd.tst
tests.
And
and Add
functions (using the
f
input bit). Your implementation should now pass the ALU-nostat.tst
tests.
ALU.tst
. Now, you have a fully functioning ALU!
By using this approach, you can better detect problems as you add code to your implementation, attributing errors seen in each new test to the incremental code that you've added in that stage. This three-stage implementation plan was initially proposed by Mark Armbrust and iterated upon by the course staff.
Remember to peruse Chapter 2 of the online textbook before you start implementing chips. It breaks down each one's interface in depth, and often describes strategies for implementation.
When you test your code by running the Hardware Simulator, loading the corresponding .tst
script and
pressing Run, it may indicate a "comparison error." When this happens, we recommend going to your file explorer
and searching for: (1) a corresponding .cmp
file that shows the inputs being tested and
expected outputs of your chip, and (2) a correspondingĀ .out
file that shows the actual
outputs of your chip when tested. Given that information, a good next step is tracing through your design with
those inputs to see why it produced the value it did.
The following additional chip (described in Chapter 2) can be used in future projects, but you are not required to implement it. Again, the goal is to give you a tool you can use to make future projects easier, but there is little to be gained by implementing this yourself.
To submit Part II, make sure you commit and push your changes, then tag them as project-3
and push
that tag as well:
git add .
(Stage all your changes)git commit -m "Finish project 3"
(Bundle those changes as a commit)git push
(Push that commit to the GitLab server)git tag project-3
(Add the project-3 tag to that last commit)git push --tags
(Push the tag to the GitLab server)Lastly, verify that the tag and all your code is uploaded correctly by checking on https://gitlab.cs.washington.edu/ .
In the document Project 3.docx
, record how long the project took you
in reality and write a short written reflection about your experience completing this project.
Make sure you have submitted your completed .hdl
files on GitLab by following the instructions in
the heading above titled "Submitting Part II." Then, save your changes from the Project 3.docx
document as a PDF and
submit the document to the assignment titled "Project 3: 24-Hour Time Audit & Boolean Arithmetic" on Gradescope. Project 3 will be considered completed once you
have followed these steps.