Course Outline

Systems 1: Hardware Architecture and Design—From circuits to machine code

Professor Dr K Darcy Otto
Title Systems 1: Hardware Architecture and Design
Code CS 2114
Credits 4
Term Spring 2024
Times M/Th 10–11:50
Location Dickinson 148
Delivery Fully in-person
Contact Email
Office Hours M/Th 3:30–4:30 (or by appointment)

Description

Have you ever wondered what a computer is and how it actually works? In this course, we’ll answer the hardware half of this question. In Systems 2 next term, we’ll answer the software half.

Working from the ground up, we will start with basic circuits and develop elementary logic gates. Taking these gates as our building blocks, we will construct the core components of a modern computer: the central processing unit, registers, and memory chips. We will then follow the principles of modern hardware architecture to integrate these components into a general-purpose computer. Our journey will culminate in using machine code to control the computer we have designed.

By the end of this course, you will understand what a computer is and how it actually works, from the perspective of hardware. You will be able to explain how to go from basic circuits, to a working machine that responds to code you write. You will also have completed the prerequisite for Systems 2, which explores the software architecture and design of a modern computer.

No previous experience in Computer Science is necessary to take this course, and you do not need any familiarity with programming. However, your learning will be well-supported by experience in a course that emphasizes symbolic thinking. You are encouraged to have completed (or be simultaneously enrolled in) a Computer Science or Mathematics course; but this is not a requirement for Systems 1.

Topics include: electronic circuits, combinatorial logic, sequential logic, chip design, hardware architecture, machine code, assembly language.

Learning Outcomes

  1. Understand Basic Electronics and Circuitry: By the end of the course, you will be able to describe the principles of electronic circuits and identify key components that allow for the flow and control of electricity.
  2. Design Elementary Logic Gates: You will be able to design and implement basic combinatorial and sequential logic gates, and explain their role in computer hardware operations.
  3. Construct Core Computer Components: Using elementary logic gates as building blocks, you will be able to design and explain the function of a central processing unit, registers, and memory chips.
  4. Integrate Hardware Components into a Functional Computer System: You will gain experience integrating the core components of a computer using principles of modern hardware architecture to create a general-purpose machine.
  5. Write Machine Code: You will showcase your ability to write simple machine code instructions and demonstrate how those instructions control and manipulate the computer system you’ve built.

An overarching objective of this course is to help you develop as a student of the liberal arts. True students of the liberal arts are able to reflect on the context in which they live, and reason about what it means to live a meaningful and happy life. Thus, they are able to be more than just children of their own time. But this means we must be willing to put our ideas to the test, see our own errors, and develop intellectual courage and humility. It also helps not to take ourselves too seriously.

Readings

  • Nisan, Noam and Shimon Schocken. The Elements of Computing Systems: Building a Modern Computer from First Principles, 2nd ed. Cambridge: The MIT Press, 2021. Available in the Dickinson reading room.

Evaluation

Exercises and Writing 30% Portfolio
Final Project 30% Subject to approval
Oral Examination 40% Comprehensive
  • Exercises and Writing: Short exercises and writing assignments will be given in coördination with the current topic, and comprise your portfolio. All written submissions should be submitted as PDF, with program code attached as appropriate. Please put your last name and assignment number in the filenames, as well as in the text of the file.

  • Final Project: You will propose and complete a group project in coördination with the professor. A proposal must be approved in order to submit your final project. See below for details about possible projects.

  • Oral Examination: The examination is comprehensive and will be a series of oral questions, related to the topics covered in the course.

Portfolio Assignment #1

Portfolio Assignment #1 is due on Monday, March 25. In preparation to submit your portfolio, please submit (in groups of two) the following exercises:

  • Concepts
    1. For the following, define the concept, provide an example, and explain how the example is an instance of the concept (written; about 1/2 page typing minimum for each): Interface versus implementation; NAND operator; bitwise operation.
  • Abacus Machines
    1. Given m stones in A and n stones in B, halt with mn stones in C.
    2. Given m stones in A and n stones in B, halt with m/n stones in C (assume m is evenly divisible by n).
  • Theory
    1. Give the definition of a computer. Provide an example and explain why that example illustrates the definition.
    2. State and explain the Church-Turing Thesis (as it applies to Abacus Machines). Be sure to provide an example as part of your explanation (written; about 3/4 page typing minimum).
  • Semantics and Chips
    1. Complete truth-tables for the following: “(a v b) → ((a ≡ ~b) v (~a → ~b))”, and “(a v (b → c)) → (a & (~b v c))”
    2. Provide a circuit diagram for a 4-way Or chip (together with a short explanation of how you intend the circuit to work).
    3. Provide working HDL code for the following chips: Not, Or16, Mux, Mux8Way16, HalfAdder, FullAdder.

Fill out the Portfolio Cover Sheet for Assignment #1, and follow the submission instructions on that sheet.

Portfolio Assignment #2

Portfolio Assignment #2 is due on Monday, May 13. In preparation to submit your portfolio, please submit (in groups of two) the following exercises:

  • Concepts
    1. For the following, define the concept, provide an example, and explain how the example is an instance of the concept (written; about 1/2 page typing minimum for each): control bits (for ALU), sequential logic, flip-flop, a-instruction (in assembly), c-instruction (in binary), register, program counter.
  • Assembly:
    1. Given m in @R0, and n in @R1, where m>n: return the number of times n divides into m in @R2, and any remainder in @R3. Make sure @R0 and @R1 retain their original values throughout the program.
    2. Given m0, m1, …, m199 in RAM[100], RAM[101], …, RAM[299], return 1 in @R0 if m0==m100, m1==m101, … m99==m199. Otherwise, return 0 in @R0.
    3. In RAM[100] to RAM[1000], store the following pattern: 010110111011110111110111111 …
    4. Draw a large uppercase letter (minimum height: 200 px) on the screen. Make sure strokes/curves are >1px.
    5. Each time a vowel (A, E, I, O, U, not including Y) is pressed on the keyboard (listen to @KBD), draw five new 256px horizontal lines on the screen. Work your way down the screen for each new line, top to bottom. Stop listening (to @KBD) after 10 vowels have been pressed. (Note: there is a bug in the CPU emulator that means the keyboard detects both lowercase and uppercase letters as uppercase letters; since this is the case, just detect the uppercase letter in the exercise.)

Fill out the Portfolio Cover Sheet for Assignment #2, and follow the submission instructions on that sheet.

Final Project

Your final project is an exploration of a particular topic in computer science that is connected to our course in some way. You will complete your final project in a group of two or more. The project should be a substantive piece of work that correlates with the weight given in the course. Beyond this, there are no preëstablished guidelines: you must submit a proposal for your final project before the midterm break.

Project proposals should be no more than one page in length (single spaced), and should consist of the following: (i) a list of who is going to be involved in the final project; (ii) a brief description of the final product (be it an analysis, a commentary, a program, or some other work), including the steps you will take to complete the project; (iii) a bibliography of works that you intend to consult as part of the project. Note that the bibliography need not be long, and it also does not bind you: you may go beyond these works if you choose.

You should fill out the Final Project Reflection as part of your Populi submission.

Here are some examples of final projects:

  1. A physical realisation of the Hack CPU.
  2. A breadboard realisation of a Hack memory chip.
  3. A method to translate Hack assembly instructions into MOS 6502 instructions.
  4. A commentary and exercises for the initial chapters of Computer Organization and Design RISC-V Edition.
  5. A Turing Machine in Hack assembly.
  6. A game in Hack assembly.
  7. A MOS 6502 assembler.

Tentative Schedule

Day Topic Readings Notes
Feb 22 Introduction None
Feb 26 Boolean Logic Elements I, 1-1.4.4
Feb 29 Abacus Machines
Mar 4 Circuits
Mar 7 Elementary Chips Elements 1.5–1.7
Mar 11 Boolean Arithmetic Elements 2-2.4 Project 01
Mar 14 No class
Mar 18 Adders, Incrementer Elements 2.5-2.8 Project 02 (adders, incrementer)
Mar 21 ALU Project 02 (ALU: ALU-nostat.hdl only)
Mar 25 Memory Project 02 (ALU: ALU.hdl) Portfolio #1 Due
Mar 28 Memory Elements 3–3.5
Apr 1 Memory Elements Project 03 a/b
Apr 4 Machine Language Elements 4-4.2.3
Apr 9 Long Weekend
Apr 11 Machine Language Elements 4.2.4-4.5
Apr 15 Machine Language
Apr 18 Machine Language
Apr 22 Machine Language Complete Rect.asm
Apr 25 Machine Language Complete Fill.asm
Apr 29 Computer Architecture Complete CPU.hdl
May 6 Computer Architecture Complete Computer.hdl
May 9 Assembler
May 13 Assembler
May 16 Assembler — 
May 20 Summary Complete Assembler

Resources

Reading Questions

  1. Electronic Whiteboard: For information sharing during class
  2. Circuit Construction Kit: DC: Simple circuit simulator
  3. From NAND to Tetris: Website corresponding to our text
  4. Lectures on From NAND to Tetris: by Noam and Schocken, authors of our text
  5. From NAND to Tetris Software Suite: Software used by our course (also available in CatLab)
  6. HDL Survival Guide: Help with the HDL language
  7. OpenJDK: May be needed to run Software Suite
  8. Digital Logic Design: Interactive book on CircuitVerse
  9. Circuit Simulator: by CircuitVerse
  10. Easy 6502: MOS 6502 assembly tutorial
  11. Learn Assembly Programming: On the MOS 6502, by ChibiAkumas

Additional Information

  1. This course outline is subject to arbitrary change. I shall announce any changes in class; if you are not present, you are still responsible for finding out what I announce.
  2. Late assignments will not be accepted without an acceptable medical or compassionate reason. Assignments are due according to deadlines on this course outline.
  3. You must attend classes regularly and on-time. Penalties for unexcused absences and for lateness will factor into the class grade. Two unexcused absences are grounds for a marginal pass, and three are grounds for failure, even if all you other work is good.
  4. Office hours are first-come-first-serve, unless you have an appointment. If you request an appointment by email, please send me a selection of several times you are available.
  5. Please be aware of the college policies on class attendance, as well as academic and artistic ethics. You must declare any work you submit that is generated in part or whole by AI.
  6. If you are being graded, your mark in the course will be translated into a letter-grade, according to the following scale: A (85–100), A– (80–84), B+ (77–79), B (73–76), B– (70–72), C+ (67–69), C (63–66), C– (60–62), D (50–59), F (0–49). Your grade will not be otherwise curved or adjusted.