PDF Logic Gates, Circuits, Processors, Compilers and Computers 13th Edition Jan Friso Groote download
PDF Logic Gates, Circuits, Processors, Compilers and Computers 13th Edition Jan Friso Groote download
com
https://ebookmeta.com/product/logic-gates-circuits-
processors-compilers-and-computers-13th-edition-jan-friso-
groote/
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/electronics-circuits-amplifiers-and-
gates-second-edition-d-v-bugg/
ebookmeta.com
https://ebookmeta.com/product/death-of-a-bookseller-1st-edition-alice-
slater/
ebookmeta.com
Web Data Mining Exploring Hyperlinks Contents and Usage
Data First Edition Bing Liu
https://ebookmeta.com/product/web-data-mining-exploring-hyperlinks-
contents-and-usage-data-first-edition-bing-liu-2/
ebookmeta.com
https://ebookmeta.com/product/deep-reinforcement-learning-with-python-
with-pytorch-tensorflow-and-openai-gym-1st-edition-nimish-sanghi-2/
ebookmeta.com
https://ebookmeta.com/product/cambridge-english-exam-booster-with-
answer-key-for-advanced-1st-edition-carole-allsop/
ebookmeta.com
https://ebookmeta.com/product/register-based-statistics-registers-and-
the-national-statistical-system-3rd-edition-britt-wallgren/
ebookmeta.com
Tempting Fate Black Shamrocks MC Australia Book 1 A dark
and angsty love triangle romance Bella Faust Kylie Hillman
https://ebookmeta.com/product/tempting-fate-black-shamrocks-mc-
australia-book-1-a-dark-and-angsty-love-triangle-romance-bella-faust-
kylie-hillman/
ebookmeta.com
Jan Friso Groote
Rolf Morel
Julien Schmaltz
Adam Watkins
Logic Gates,
Circuits,
Processors,
Compilers and
Computers
Logic Gates, Circuits, Processors, Compilers
and Computers
Jan Friso Groote Rolf Morel
• •
123
Jan Friso Groote Rolf Morel
Department of Mathematics Department of Computer Science
and Computer Science University of Oxford
Eindhoven University of Technology Oxford, UK
Eindhoven, Noord-Brabant, The Netherlands
This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
This book is for everyone who wants to
understand how a computer can do such
marvellous calculations, when it is
essentially only constructed of simple logic
gates.
Preface
Computers have revolutionised the world in well within a century. Dozens of com-
puter processors have been built for every inhabitant of this earth, and this number is
rapidly increasing. Most people have little idea of how a computer goes about doing
its job. And there is a reason for it. Computers have been designed such that the in-
ternal complexity is hidden, not only for those that use computers but even for those
who design computer controlled systems, such as hardware engineers, programmers
and maintenance staff.
Are computers complex? The answer is both yes and no. Let us first look into
the reasons why the answer is yes. Computers are constructed with integrated cir-
cuits such as micro-processors. These processors can contain well over a billion
components, such as transistors and resistors, all connected with each other in an
intricate pattern. And against all odds, this number of components is still growing
very rapidly, quickly increasing the complexity of these integrated circuits.
All these systems are man made. This also adds to the complexity as many in-
dependent development teams made their own designs. In the history of computer
design virtually any conceivable idea has been implemented, and traces of many of
these ideas can still be found almost anywhere in computers. The need for back-
ward compatibility makes it hard to remove such ideas. On top of all this hardware
many layers of software have been implemented. This makes computer systems very
complex objects indeed.
But from a different perspective computers are not at all complex. Many of the
essential ideas behind the construction of computers are actually quite straightfor-
ward. The purpose of this book is to give a concise, but precise, description of the
essence of a computer. After finishing this book the reader should in principle be
able to build a computer system from elementary logic components with most of
the features that modern computers have, including an elementary operating system
and a compiler.
The book starts out with the logic components, and-, not-, or-, and nand-gates,
that are constructed from transistors. It is explained how such gates can be used to
implement any logic function over the boolean values true and false given by truth
tables. These are called combinatorial circuits.
vii
viii Preface
Further reading. There are many books written about the structure of computer
systems [24, 25, 30, 29, 32, 22, 13, 21], which generally cover the structure of
computer systems more extensively, or focus on certain aspects, such as circuits, or
assembly programming. This book provides a minimal but complete exposition of
all aspects of a computer system such that the essence of how a computer works can
be understood completely.
Acknowledgements. This book has been written to support the course Computer
Systems (2IC30) at Eindhoven University of Technology, The Netherlands. The
course was previously given by Michael Franssen and Rob Hoogerwoord, and the
book is based on the structure of the course as developed by them.
Thanks go to the following people for assisting us in writing this book. Special
thanks go to Bram Bosch who formally verified many of the circuits, leading to
numerous improvements [8], and Alan Mycroft for his many useful comments com-
ing from proof reading large parts of this book. We are also grateful for the helpful
remarks by Max Crone, Nikola Djurendic, Bas van Geffen, Bas van Hoeflaken,
Quinten van Eijsden, Mohamed Hemza, Anneke Huijsmans, Christine Jacob, Erik
Luit, Sebastiaan Peters, Jeroen van Riel, Anson van Rooij, Richard Verhoeven, Sten
Wessel and Hans Zantema on drafts of this book.
xi
xii Contents
3 Sequential circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.1 A one-time latch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.2 The set-reset flip-flop/set-reset latch . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.3 The D-latch/D-flip-flop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.4 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.5 Finite state machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.5.1 An example state machine with four states . . . . . . . . . . . . . . . 61
3.5.2 Encoding the state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.5.3 Realising the state machine using logic gates and flip-flops . 63
3.6 Random access memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.7 Finite state machines to control registers . . . . . . . . . . . . . . . . . . . . . . . 68
3.8 Hardware description languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
3.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4 An elementary processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.1 The general structure of the processor . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.2 The instruction set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.3 The instruction fetch and the register transfer language . . . . . . . . . . . 81
4.4 The format of machine code instructions . . . . . . . . . . . . . . . . . . . . . . . 83
4.5 Implementing instructions on the processor . . . . . . . . . . . . . . . . . . . . . 85
4.6 Optimisation of the execution of instructions . . . . . . . . . . . . . . . . . . . . 88
4.7 More advanced instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.8 Input and output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.9 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5 Assembly programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5.1 Labels and comments, EQU and CONS . . . . . . . . . . . . . . . . . . . . . . . . 99
5.2 Arithmetic calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.3 A timed loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.4 Basic data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.4.1 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.4.2 Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
5.4.3 Linked lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.5 Memory layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.5.1 Allocation dependence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.5.2 Relocatable code and data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.6 Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.6.1 Saving the return address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Contents xiii
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Chapter 1
Basic components and combinatorial circuits
In this chapter we introduce logic gates because they are very useful to describe dig-
ital hardware such as computer processors. This was observed by Claude Shannon1
in his master thesis in 1937 [28]. We show how such gates are constructed using
electronic components, such as transistors, and illustrate how circuits with more
complex functionality can be constructed efficiently from such elementary gates.
In Figure 1.1 we find the symbols for three basic logic gates from which digital
circuits are built. Each logic gate, or gate for short, is a small hardware component
that implements a simple logic function from its inputs to its output. The and and
or gates have two inputs and one output. The not gate has one input and one output.
A truth table defines the relationship between the input and the output of that gate.
A 0 generally means a voltage of 0 V and a 1 represents a higher voltage, for in-
stance 5 V, although today lower voltages, such as 3.3 V, are typical. We discuss the
practical realisation of logic gates and their voltages and current flows later in this
chapter.
From the truth table it is obvious that the and gate has an output of 1 exactly if
both inputs are 1. For the or gate, the output is 1 if at least one of the inputs is 1.
For the not gate the output is 1 exactly when the input is 0. Because the not gate is
a simple gate occurring often it is also written as a single small circle, in particular
when joined to another gate.
Using these three basic gates more complex circuits can be made, for instance
circuits that add or multiply numbers. When gates are connected such that an output
of one gate is never connected to one of its inputs, not even via other gates, the
circuit is called combinatorial. In this chapter we restrict ourselves to combinatorial
1 Claude Elwood Shannon (1916-2001) was a mathematician and an electrical engineer. He
founded the field of information theory, and worked as a cryptanalyst on code breaking and se-
cure communication.
circuits. Chapter 3 deals with sequential circuits where outputs are connected to
inputs.
A simple but important component is a two-way multiplexer. It has three inputs
in1 , in2 and sel and one output out. If the selector sel is 0, the output out equals
in1 and if sel is 1, the output is equal to in2 . The truth table that reflects this is
depicted in Figure 1.2 on the left. The circuit representing this function is given on
the right. Note that there is a not gate just before the lower input of the upper and
gate, drawn as a small circle. Note also that input sel is connected to two input wires.
It is common to connect wires to the inputs of several gates, but there is a physical
limit to the number of gates that a single wire can drive.
Fig. 1.2 The truth table and the combinatorial circuit for a two-input multiplexer
These graphical representations of gates are useful when the circuits are small.
When the circuits become more complex a description in textual form tends to work
better. Therefore, in text we write in1 ∧in2 to represent the output of an and gate.
Alternative notations that one can encounter are in1 ·in2 , in1 ∗in2 and in1 &in2 . The
or gate is denoted as in1 ∨in2 , and also by in1 +in2 and in1 |in2 . The not gate is
denoted as ¬in, but also as in, and !in. The notations with ∧, ∨ and ¬ are more
common in text about logics and are referred to as the conjunction, disjunction,
and negation operators, respectively. The other symbols are more common in the
electronics literature.
1.1 The three basic logic gates 3
Exercise 1.1.1. Using logic notation, give the textual representation of the two-input
multiplexer depicted in Figure 1.2.
Exercise 1.1.2. Consider a circuit with three inputs in1 , in2 and in3 and one output.
Make a truth table in which the output is 1 only if exactly one input is equal to 0.
E.g., input 011 gives output 1, and input 111 produces 0 as output. Draw a circuit
realising this function.
Exercise 1.1.3. Implement an and gate with three inputs and a three-input or gate
using only the basic and, or and not gates. Generalise to an n input and gate and n
input or gate. How many basic gates are necessary? Can you give a proof?
in1 in1
out out in out
in2 in2
The nand gate. The nor gate. The buffer gate.
Fig. 1.3 The nand, nor, and buffer basic logic gates
in1 in1
out out
in2 in2
The xor gate. The xnor gate.
Language: English
By MARTIN PEARSON
When I came to again it was in the city by the hills. Several of the
creatures were standing around me trying to question me in their odd
language and, of course, making no headway. I felt that this was not
the time to inform them of my imperial accession, I was not sure that
they were the most fitting inhabitants of this world to receive that
honor. There might be other intelligent races inhabiting the same
planet even as there are on Venus.
Accordingly I kept my mouth shut and stared them down. That was a
feat of which I could be proud considering the odd nature of their
eyes and faces.
Finally they led me away in short bounds to a building and up a ramp
to a room. There they thrust me and closed the door.
The room was large, partly open to an interior patio. But it had
another inhabitant. A girl!
She was standing by the open semi-balcony staring into the
courtyard. When I exclaimed, she turned sharply and looked at me.
She was dressed surprisingly like an earth girl, she looked very
much like the earth type. I congratulated myself on having picked for
my empire a planet which held a race so similar to my own. But my
hopes were dashed two seconds later when she opened her mouth
and said in perfect English:
"Hello, stranger, how'd you get to Midplanet so soon?"
I recovered my composure and introduced myself modestly, not
telling her of the position I had taken upon myself. "And who are
you?" I asked.
"Oh, I'm Nadia Landor and I came with the Official I. U. Expedition.
Our ship is about thirty miles away and I came here on a geological
survey in a single-seater flier. I stopped to say hello but our hosts
don't seem to know the meaning of the word."
"Oh," I said and fell silent. What was I to say? I had been so certain
that I could get to Midplanet first and now it seemed that the Union
had beaten me out again. Then, I squared my shoulders. This was
no way for Ajax Calkins, Emperor of at least half Midplanet, to act.
My destiny would see me through.
"You need have no fear," I said. "I will find a way for us to escape."
She looked at me oddly and smiled. "Oh, that? That's all settled.
We'll escape immediately if you want to. I've fixed things with our
buggy friend."
"With whom?" I gasped.
"Why, haven't you seen the buggers yet? Look, there's Bosco in the
yard." She beckoned to the inner courtyard. I went over to her side
and looked.
"What shall we do?" called Nadia to me. "We can't shake them."
It was then that the idea occurred to me that saved us. We were
already very close to where my spaceship had landed and I
succeeded to conveying in signals what I had in mind to our quite
intelligent flea.
On we went and when we came to the side of the swamp in which
my ship had landed, Bosco gave a terrific leap which must have well
set a record for all Midplanet and sailed fully five hundred yards
across the swamp to land exhausted on the other side.
But the pogos could not make that great leap, nor could the giant
things stop so easily. On they rushed and one after another they
landed in the middle of that thick gummy deep swamp-like mass.
The automatic vibrations of their shafts continued but their bases
were hopelessly gummed in. The crews were hurled off in all
directions and fell helplessly into the gooey morass.
We were saved! My ship was around at the other side but we could
walk it. Nadia signalled our thanks to the bugger and it bounded off
alone towards the distant horizon.
As we walked, Nadia complimented me on my trick of the swamp. I
glowed within and, turning to her, said:
"Let us stay here and master this world, my Empress. I, Ajax Calkins,
lay my heart and a planet at your feet."
But women are fickle creatures and cannot understand the ways of
the great. She laughed and said: "Don't be silly, my husband is
waiting for me at our own spaceship."
And then when we found that my ship had, while I had been away,
sunk into the swamp completely and that we would have to walk the
twenty or so miles to Nadia's craft, she laughed even louder. Women
do not appreciate destiny.
*** END OF THE PROJECT GUTENBERG EBOOK POGO PLANET
***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.