ArticleslgStudy

computer science

Hack computer

Hack computer is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Hack computer rather than just read about it. In short: The Hack computer is a theoretical computer design created by Noam Nisan and Shimon Schocken and described in their book, The Elements of Computing Systems: Building a Modern Computer from First Principles. In using the term “modern”, the authors refer to a digital, binary machine that is patterned according to the von Neumann architecture model.

Hack computer — main illustration
Hack computer — illustration

Key takeaways

  • Hack computer belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Hack computer to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Hack computer from memory before moving on to harder problems.

Reference excerpt

The Hack computer is a theoretical computer design created by Noam Nisan and Shimon Schocken and described in their book, The Elements of Computing Systems: Building a Modern Computer from First Principles. In using the term “modern”, the authors refer to a digital, binary machine that is patterned according to the von Neumann architecture model. The Hack computer is intended for hands-on virtual construction in a hardware simulator application as a part of a basic, but comprehensive, course in computer organization and architecture. One such course, created by the authors and delivered in two parts, is freely available as a massive open online course (MOOC) called Build a Modern Computer From First Principles: From Nand to Tetris. In the twelve projects included in the course, learners start with a two input NAND gate and end up with a fully operational virtual computer, including both hardware (memory and CPU) and software (assembler, VM, Java-like programming language, and OS). In addition to the hardware simulator used for initial implementation of the computer hardware, a complete Hack computer emulator program and assembler that supports the projects described in the book and the on-line course is also available at the author's web site.

Hardware architecture

The Hack computer hardware consists of three basic elements as shown in the block diagram. There are two separate 16-bit memory units and a central processing unit (CPU). Because data is moved and processed by the computer in 16-bit words, the Hack computer is classified as a 16-bit architecture. The instruction memory, implemented as read-only memory from the viewpoint of the computer and designated ROM, holds assembled binary program code for execution. The random-access memory, called RAM, provides storage for an executing program’s data and provides services and storage areas for the computer’s memory-mapped I/O mechanism. Data processing and program control management are provided by the CPU. The three units are connected by parallel buses. The address buses (15-bit), as well as the data and instruction busses (16-bit) for the ROM and RAM units are completely independent. Therefore, the Hack design follows the Harvard architecture model with respect to bus communication between the memory units and the CPU. All memory is word addressable only.

Read-only memory (ROM) The Hack computer’s ROM module is presented as a linear array of individually addressable, sequential, 16-bit memory registers. Addresses start at 0 (0x0000). Since the memory elements are sequential devices, a system clock signal is supplied by the simulation application and the computer emulator application. The ROM address bus is 15 bits wide, so a total of 32,768 individual words are available for program instructions. The address of the currently active word is supplied by a program counter register within the CPU (see below). The value in the ROM memory register identified by the address placed on the instruction address bus in a particular clock cycle is available as the "current" instruction at the beginning of the next cycle. There is no instruction register; instructions are decoded in each cycle from the currently active ROM register.

Random-access memory (RAM) Although the RAM module is also viewed as a continuous linear array of individually addressable sequential, read-write, 16-bit memory registers, it is functionally organized by address range into three segments. Addresses 0 (0x000) through 16383 (0x3FFF) contain conventional 16-bit, read-write registers and are meant for use as general-purpose program data storage. The registers at addresses 16384 (0x4000) through 24575 (0x5FFF) are essentially like data RAM, but they are also designated for use by a built-in screen I/O subsystem. Data written to addresses in this range have the side effect of producing output on the computer’s virtual 256 x 512 screen (see I/O). If a program does not require screen output, registers in this range may be used for general program data. The final address in the RAM address space, at 24576 (0x6000), contains a single one word register whose current value is controlled by the output of a keyboard attached to the computer hosting the Hack emulator program. This keyboard memory map register is read-only (see I/O). Data memory addresses in the range 24577 (0x6001) through 32767 (0x7FFF) are invalid. State transitions of the selected RAM memory register is also coordinated by the system clock signal.

Central processing unit (CPU)

… excerpt ends here. Continue reading the full article.

Illustrations

Hack computer: Hack computer CPU block diagram
Hack computer CPU block diagram

Worked examples

Example 1 — a first encounter with Hack computer

Start with the simplest possible case. Write down what Hack computer claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Hack computer before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Hack computer ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Hack computer

In research
Hack computer appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Hack computer in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Hack computer is common in secondary-school and first-year university syllabi. It links to neighbouring topics Classes of computers, Computer architecture, so understanding it makes those chapters shorter.
In everyday life
Look for Hack computer outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Hack computer” →

How to study Hack computer in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Hack computer means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Hack computer out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Hack computer in simple terms?

The Hack computer is a theoretical computer design created by Noam Nisan and Shimon Schocken and described in their book, The Elements of Computing Systems: Building a Modern Computer from First Principles. In using the term “modern”, the authors refer to a digital, binary machine that is patterned…

Why does Hack computer matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Hack computer?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Hack computer.

Tags

  • Classes of computers
  • Computer architecture

Keep exploring