How does a Von Neumann machine work?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How does a Von Neumann machine work?

LBSCR
I just can't understand how 1 single memory block can store program and data.
Reply | Threaded
Open this post in threaded view
|

Re: How does a Von Neumann machine work?

ivant
To do that, you need a bit more complicated CPU. The first thing it reads should be an instruction (or part of instruction). Let's say the instruction is to load the contents of address 485 in the A register.

The CPU remembers the instruction in special internal registers and instructs the memory to fetch the content of address 485.

On the next cycle (or more, in a more realistic CPU) the data arrives on the bus. The CPU "sees" that it's still executed the load instruction, so it stores this data in the A register. The instruction is done, so it can request the next one, and also clearing up its internal state.

This means that it will spend a lot of time just waiting for instructions or data to arrive. To speed things up modern CPUs use pipelining. (I just realized I linked to your thread :))
Reply | Threaded
Open this post in threaded view
|

Re: How does a Von Neumann machine work?

cadet1620
Administrator
In reply to this post by LBSCR
Here's a single memory space implementation of the Hack computer.

You will see in the test file output how in alternates reading and executing instructions.

--Mark