# Does the Hack computer from "The Elements of Computing Systems" use Von Neumann architecture?

I'm reading "The Elements of Computing Systems" (subtitled "Building a Modern Computer from First Principles - Nand to Tetris Companion) by Noam Nisan and Shimon Schocken.

Chapter 4 is about machine language, and more specifically the machine language used on their computer platform called Hack. Section 4.2.1 says this about Hack:

The Hack computer is a von Neumann platform. It is a 16-bit machine, consisting of a CPU, two separate memory modules serving as instruction memory and data memory, and two memory-mapped I/O devices: a screen and a keyboard.
… The Hack programmer is aware of two distinct address spaces: an instruction memory and a data memory. … The CPU can only execute programs that reside in the instruction memory. The instruction memory is a read-only device, and programs are loaded into it using some exogenous means.

With that distinction between instruction memory and data memory, is it really a von Neumann architecture? According to my understanding of the difference between von Neumann and Harvard, that description sounds much more like a Harvard architecture.

• Is there a universally accepted definition of von Neumann architecture? (en.wikipedia singles out an instruction fetch and a data operation cannot occur at the same time because they share a common bus. [von Neumann bottleneck], mentions cache architecture and supplies comparisons. Dec 8 '19 at 10:53

I had the same suspicion going through the Nand to Tetris course.

Indeed, if you look at John K. Bennett's annotated version of "The Elements of Computing Systems", specifically Chapter 5, he calls this out:

The Hack architecture would more properly be called a “Harvard Architecture,” since the data and instruction memories are separate.

We can also do some digging for ourselves.

If we consult Wikipedia, it states that the Harvard architecture is distinguished by:

The term "von Neumann architecture" has evolved to mean any stored-program computer in which an instruction fetch and a data operation cannot occur at the same time because they share a common bus.

The design of a von Neumann architecture machine is simpler than a Harvard architecture machine—which is also a stored-program system but has one dedicated set of address and data buses for reading and writing to memory, and another set of address and data buses to fetch instructions.

The latter is indeed the architecture of the Hack machine, which has two separate memories and can do an instruction lookup, data lookup, and computation all in one step* of the CPU. You can see this in the book's diagram:

Last, this is also explicitly stated at the end of Chapter 5 of the original book:

Unlike Hack, most general-purpose computers use a single address space for storing both data and instructions. In such architectures, the instruction address as well as the optional data address specified by the instruction must be fed into the same destination: the single address input of the shared address space. Clearly, this cannot be done at the same time.... In contrast, the Hack architecture is unique in that it partitions the address space into two separate parts, allowing a single-cycle fetch-execute logic.

*Note: In the Hack machine language, it actually takes two steps (e.g. @dataaddr then D = M + 1) to do an operation on data in memory. However, during the second instruction, both the instruction and the data in memory can be read by the CPU simultaneously.

This is rather surprising.

If we look at the specification of the Hack Computer, I found this (consistent with your query):

Instruction memory (ROM)
Data memory: Memory (RAM)

Also, I've been studying Computer Architecture- MIPS-64 bit by Hennessy, which is based on von Neumann's, like most of the general-purpose computers in the mainstream. Harvard machines are generally specialty products. But there has been an increasing number of machines with Harvard-Neumann's Hybrid. These are the highlighted points which provides a reason:

• Split-cache (or almost-von-Neumann) architecture
• Instruction-memory-as-data architecture
• Data-memory-as-instruction architecture

So, it's fairly safe to assume the conundrum of The Hack being a von Neumann one.