Sit 111-8.1P
Sit 111-8.1P
1P
Build & test the Hack Computer
Overview
In this task, you will assemble a few components together to ‘build’ the Hack Computer! In
other words, use the given implementations of the CPU and the Memory, and in-built ROM32K
chip to implement a functional Hack computer.
Task requirements
a. Go through week 9 class materials & complete the practice problems in week 9.
b. Read the given task instructions carefully.
Task Instructions
There are TWO parts to this task.
PART ONE
1. Using your knowledge gained from the learning materials and learning sessions in weeks
8 & 9, write an HDL program Computer.hdl to implement the Hack Computer.
2. Use the diagram below (source: The Elements of Computing Systems) as a blueprint in
your implementation.
1
3. Build the computer in the following order:
• Memory- Composed from three chips: RAM16K, Screen, and Keyboard. Use the
provided Memory.hdl in task resources.
• CPU - Use the provided CPU.hdl in task resources.
• Instruction Memory - Use the built-in ROM32K chip.
4. Use the following test scripts that are in the task resources to test your implementation
in the Hardware Simulator:
• ComputerAdd.tst
• ComputerMax.tst
• ComputerRect.tst
Your Computer.hdl program should pass all three tests.
PART TWO
For the Hack code given below, answer the following questions for each of the instructions.
Hack code:
0000000000000000
1111110000010000
0000000000000001
1111010011010000
0000000000001010
1110001100000001
2
Questions:
1. Is this an A-instruction or C-instruction?
2. How can this be expressed in assembly code?
3. Explain how the CPU executes the instruction (include the part played by the relevant
registers, relevant buses and the ALU where applicable).
Example:
0000000000000000
1. This is an A-instruction.
2. It can be expressed as @0 is assembly code.
3. The A-register is set to 0. This is done by setting the load bit (the control bit) in the A
register to 1. The A-register puts 0 to the address bus. This is used to access RAM [0].
The value of RAM [0] is put into the data bus and is output as the M register (M input).
Hint: You may need to look at the learning materials from week 6 onwards.
Submission checklist
Make sure your submission documents (you will submit 2 documents – one pdf file; one
code file) has the following:
• Answers to the questions for each of the 16-bit binary instruction for the given
Hack code.
If one or more of the above requirements are missing or not completed to a required
standard, your task will be considered as Incomplete.
3
Marking rubric for the task is given below:
Reference
Nisan, Noam, and Shimon Schocken. The Elements of Computing Systems : Building a Modern
Computer from First Principles MIT Press, 2005
Floyd, L., Thomas. Digital Fundamentals. Prentice-Hall International, 2003