Hacker News new | ask | show | jobs
Microprocessor's Romance with Integers (freecodecamp.org)
29 points by vkweb 602 days ago
5 comments

An article I wrote on how subtraction (or basic arithmetic) works inside the processor. I wondered it one day and went deep into up till registers. This resulted in me learning about how exactly CPU executes code.

Its from a few years back but never posted on HN. The content is timeless because basics stay more or less the same.

Let me know your honest thoughts. I love going deep into questions my mind gets stuck on. Let me know if you want me to continue this deep dive:D

>_The fetch decode execute cycle architected by Sir John von Neumann. Every digital computer follows this cycle to run machine code._

Harvard Architecture and Modified Harvard Architecture do exist as well.

All modern high-performance computers use a combination of von Neumann Architecture and Harvard Architecture.

They use a big unified main memory used to store both programs and data, but the CPU has separate instruction and data cache memories, in order to be able to overlap in time the fetching of the instructions from the instruction cache memory with the loading and storing of their operands from/to the data cache memory.

Only some of the cheapest microcontrollers without caches may not have such a combined architecture, but even many of them can overlap fetching instructions from a read-only flash memory with loading and storing operands from an internal SRAM, while also being able to use an external unified memory for both programs and data.

Harvard architecture computers use that same cycle. The difference between Harvard and von Neumann architecture is how memory is organized and used.
It is possible to build single cycle Harvard computers but not von Neumann ones. So a course on computer architecture using, for example, RISC-V as a concrete example might start out showing a Harvard RISC-V with a single cycle implementation. The next step is a multicycle von Neumann version and the third step is a pipelined RISC-V using caches to make a locally Harvard, globally von Neumann implementation.
Additionally, von Neumann did not "architect" that design; it was named for him because he wrote a paper describing it.

https://en.wikipedia.org/wiki/Von_Neumann_architecture#Devel...

https://en.wikipedia.org/wiki/J._Presper_Eckert#%22Eckert_ar...

The concept of a unified memory for both programs and data has been presented for the first time in a public document in the report written by von Neumann.

It is likely that the Eckert-Mauchly team had arrived earlier at this idea, but there is no evidence about this.

Despite the possible precedence of Eckert, von Neumann is the one who deserves full credit for the content of the report, including the "von Neumann Architecture".

The decision made by von Neumann to distribute this report has provided incalculable benefits for all mankind. The report described how to make an electronic computer in a much more clear way than any of the Eckert-Mauchly team would have ever been able to explain.

The effect of the von Neumann report has been that multiple teams, first in USA and UK, then also in many other countries, have started immediately to work at the development of electronic computers, leading to a large number of successful research projects then to an explosion of the computer industry.

The public distribution of the von Neumann report has annoyed a lot the Eckert-Mauchly team, who wanted to keep these developments secret, because they were preparing the creation of their own startup company, in order to exploit computer technology for becoming rich. Without the interference of von Neumann, the creation of a big computer industry could have been delayed by a decade and it certainly would have been much less diverse.

After the war, the Eckert-Mauchly team has never made any significant technological progress, all the essential inventions that have improved the electronic computers have been made at a great number of companies, research institutions or universities. Had the design of electronic computers remained a monopoly, that would have happened much later.

Moreover, the Eckert-Mauchly team did not have much grounds to consider themselves as the owners of electronic computer technology, because they could not have done anything without a great amount of money from the government, and at the beginning they have also taken useful information about the electronic computing circuits used in the Atanasoff-Berry computer, without later acknowledging any of their sources of inspiration.

It will never be known how much of the von Neumann report has been created by von Neumann and how much he had already learned from discussions with members of the Eckert-Mauchly team. However, this does not matter, because either way the von Neumann report is what has taught the world how to make electronic computers.

Herman Goldstine made the decision to distribute the report. Though Eckert and Mauchly liked to think they came up with the idea before von Neumann came along and that he got the idea from them, it is very hard to know if that is true. Kurt Gödel, who von Neumann helped get out of Austria at the start of the war and come work with him at Princeton's Institute of Advanced Study, had already published the idea of using numbers to encode algorithms as part of his famous 1931 proof. And while Turing Machines use the Harvard architecture, the Universal Turing Machine at the end of Alan Turing's 1936 paper is a von Neumann one.
This is a long winded explanation of twos complement binary arithmetic. I'm sure some readers can benefit from it, but probably not most of the HN crowd.
It's probably worth mentioning that this representation of numbers is neither the only possible in computers nor the optimal for all imaginable applications.
"Sir John von Neumann"?
The author is Indian, where “Sir” is often used as an honorific substitute for “Mr.” or “Dr.”

A downstream effect of colonialism.

Don't know how titles worked in the Austria-Hungary empire but his family had nobility titles:

https://en.wikipedia.org/wiki/Von_Neumann_family

(at least he's listed there)

Not sure which title and how it'd work in english but "Sir" doesn't sound off if he indeed was part of the nobility (not that you'd be forced to use it: but it may not be wrong to use it).

From Wikipedia it sounds like the closest English equivalent would be Lord John Neumann of Margitta.

Reasoning: the title was hereditary and knighthoods aren’t but peerages can be. Also peerages are often associated with with a place but knighthoods aren’t.

No, he was foreign born, so any title would have had to be renounced to gain citizenship.
Since when did we knight people in the USA?!