How do computers do math?

This is part 3 in a quest to answer the question “How do computers do math?”. In this chapter we introduce the different types of electronic circuits.\(\)

Electronic circuits

In electronic circuits, another electric signal controls the flow of electrons. This electrical input signal typically represents physical properties such as sound, vision or temperature. Converting these physical properties to electrical signals, allows them to be easily manipulated and transported.

We distinguish three types of electronic systems: analog, digital and microprocessor systems.


Analog waveform
Example of an analog signal

In analog systems, a continuously variable voltage on a wire has a proportional relationship to a physical property as illustrated on the right. The word “analog” comes from the Greek word ανάλογος (analogos) meaning “proportional”. For example, a voltage of -1 to 1 volt may represent a sound pressure of -15 to 0 dBa.

In an old fashion telephone, a battery provides the energy. The carbon powder in the microphone controls the current, as the vibrations from the voice causes the resistance to fluctuate. Copper wires transport the analog signal. Eventually, on the other end, a loudspeaker recreates the sound.

(c) 2017 Coert Vonk
Analog telephone circuit

Analog systems consist of components such as batteries, resistors, capacitors, diodes and transistors. They first became viable with the introduction of the vacuum tube (Fleming, 1904; de Forest, 1907) and later the semiconductor diode (Ohl, 1939) and transistor (Bardeen, Brattain and Shockley, 1947).

If you interested in the history, consider watching the PBS documentary Transistorized! (the original video vanished, but it can still be found on YouTube) or the Silicon Valley American Experience.

(c) 2017 Coert Vonk
Analog system architecture

The thermal behavior of the components and the transmission of the analog signal introduce noise. Reducing noise and thereby improving accuracy is complicated and expensive in analog systems. The inherent inaccuracy was acceptable for telephony, but not for precision tools such as calculators. As we will see next, digital systems can offer this precision.

Digital systems

In digital systems, there are only two voltages. One voltage corresponds to a logic 1, and the other to logic 0. These systems are binary after the Latin word bīnārius that stands for “consisting of twos”. Digital systems consist of circuits build using digital gates. Internally the gates use analog components, but the input and output are digital, so only logic 1 and logic 0.

Digital systems became viable with the introduction of the transistor. Later with the invention of integrated circuits, digital systems became commonplace (Kilby and Noyce, 1959).

By combining a set of \(n\) wires and assigning them weighted values, we can transmit \(2^n\) binary values. In the above example with four wires, a mass from 0 to 100 kg may be represented by a 4-bit binary signal from 0000 to 1111. That implies that 16 different values can be transmitted, decimal 0 to 15.\(\)

\mathrm{b}\color{red}{0000} &\equiv \tfrac{
\color{red}{0}\color{black}{\times 8}\ +\
\color{red}{0}\color{black}{\times 4}\ +\
\color{red}{0}\color{black}{\times 2}\ +\
\color{red}{0}\color{black}{\times 1}}{15} \cdot 100\ \mathrm{kg} =
\tfrac{0}{15}\ \cdot\ 100 = 0\ \mathrm{kg}\\
\mathrm{b}\color{red}{0001} &\equiv \tfrac{
\color{red}{0}\color{black}{\times 8}\ +\
\color{red}{0}\color{black}{\times 4}\ +\
\color{red}{0}\color{black}{\times 2}\ +\
\color{red}{1}\color{black}{\times 1}}{15} \cdot 100\ \mathrm{kg} =
\tfrac{1}{15}\ \cdot\ 100 = 6\tfrac{2}{3}\ \mathrm{kg}\\
\mathrm{b}\color{red}{1111} &\equiv \tfrac{
\color{red}{1}\color{black}{\times 8}\ +\
\color{red}{1}\color{black}{\times 4}\ +\
\color{red}{1}\color{black}{\times 2}\ +\
\color{red}{1}\color{black}{\times 1}}{15} \cdot 100\ \mathrm{kg} =
\tfrac{15}{15}\ \cdot\ 100 = 100\ \mathrm{kg}\\
A 4-bit value can transmit 16 different values

All voltages within a range represent the same digital value. As shown in the figure above, TTL-based logic recognizes an input value of 0 … 0.8 volt as logic 0, while 2 … 5 volt is recognized as logic 1. This implies that small changes in analog signal levels (noise) will be ignored allowing transmission over long distances without noise degradation.

The number of bits used limits the precision of digital systems. Digital systems can be very precise, but have to be custom designed for each task. During World War II, the Nazis and allied forces, used electro-mechanical systems and later vacuum tube based calculators to calculate artillery-firing tables. These systems were fast, but it took great effort to re-purpose the machines. Microprocessor systems add flexibility to digital systems.

Microprocessor systems

Since 1945, the von Neumann architecture forms the foundation for modern day computers. It allows the same device to perform a wide variety of functions. One moment it can be a scientific calculator, another a magazine reader of be used to call your cousin.

A programmable device takes digital input signals, processes them according to instructions stored in its memory and outputs results. The programmable device is a Central Processing Unit (CPU).

Microprocessor system architecture

Build using digital gates, microprocessors came to life with the invention of integrated circuits and spread rapidly once the whole CPU fit on one piece of silicon (Intel and Texas Instruments, 1971). This architecture is described in more detail in our follow-up inquiry “How do Microprocessors Work?.

In the following chapters we will introduce the building blocks of digital systems, and go in-depth explaining the physics of its components. The next chapter starts with an introduction to digital logic and shows an implementation of diode based logic.

Embedded software developer
Passionately curious and stubbornly persistent. Enjoys to inspire and consult with others to exchange the poetry of logical ideas.

2 Replies to “How do computers do math?”

  1. Coert, I have tried to make a square root in excel but it would be work. The multiply and divide work in excel and the CSM works. I can not send you a picture of my work in this system. Can you help me?
    Ronald lokker from the Netherlands

  2. Thanks. I think the sqrt schematic might use the q* instead of the q to build the new subtrahend.
    [in parallel to email conversation]

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.