Post on 22-Apr-2019
1
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 1
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Rechnernetze und -Organisation
Teil D1: Hardware from below 2012
Tomislav Nad Karl C. Posch
www.iaik.tugraz.at/content/teaching/bachelor_courses/rechnernetze_und_organisation/
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 2
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Contents of lecture
TOY x86
Networks Hardware,
Stack, Input/Output
2
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 3
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Contents
• Combinational functions • Feedback, storage, and finite state automata • How to build a RAM? • Datapath and microcode
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 4
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Electrical circuits and schematics
CIRCuit = SchaltKREIS
+
-Erde, Masse, „0 Volt“, „0“
„1 Volt“, „1"
LampeBatterie
3
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 5
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Electrical circuits and schematics
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 6
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Switches: switch on and switch off
Symbol for “switch”
out1 = f(in1)
4
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 7
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Logisim
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 8
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Logisim
5
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 9
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
+
-Erde, Masse, „0 Volt“, „0“
„1 Volt“, „1"
Lampe L
Batterie
Schaltermein_schalter
1
0
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 10
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Timing diagrams
time
6
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 11
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
How many different functions are possible
Inverter
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 12
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Testing an inverter
7
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 13
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
The internals of an inverter in MOS technology
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 14
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Inverter
+
-Erde, Masse, „0 Volt“, „0“
„1 Volt“, „1"
Lampe L
Schaltermein_schalter
1
0
Inverter
8
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 15
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Another logic function: AND
out = in1 & in2
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 16
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Other popular gates
9
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 17
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Other logic functions
a! b! c! s!0! 0! 0! 0!0! 0! 1! 1!0! 1! 0! 1!0! 1! 1! 0!1! 0! 0! 1!1! 0! 1! 0!1! 1! 0! 0!1! 1! 1! 1!
Caution: This table is wrong In your document.
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 18
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Arithmetic: Adding 2 bits – “half adder”
carry = a & b sum = a ^ b sum = (a + b) mod 2
sum
carry
a b
10
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 19
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Adding 3 bits: “full adder”
carry = (a & b) | (a & c) | (b & c) sum = a ^ b ^ c
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 20
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
A full adder (version 1)
11
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 21
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Adding 1: “Increment”
out0 = ~in0 out1 = in0 ^ in1 out2 = (~in0 & in1 & in2) | (in2 & ~in1) | (in0 & in1 & ~in2)
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 22
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Increment (version 1)
12
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 23
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Increment (version 2)
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 24
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
2-to-1 multiplexer: If-then-else
if (sel == 0) then q = d0;
else q = d1;
13
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 25
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Feedback, storage, and finite state automata
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 26
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Latch
14
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 27
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
2 latches and 1 inverter make a flipflop
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 28
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
The problem with the initial state
15
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 29
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Counter
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 30
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
State diagram out = 0
out = 1
out = 2
out = 3
out = 4
out = 5
out = 6
out = 7
000
001
010
011
100
101
110
111
16
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 31
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Example “Lauflicht”
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 32
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Example “Lauflicht”
17
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 33
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
State diagram of “Lauflicht” L0
L1
L2
L3
L4
L3
L2
L1
000
001
010
011
100
101
110
111
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 34
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
“Lauflicht” with start/stop
18
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 35
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
State diagram L0 000
111
en
L1en
L2en
L3en
001
010
011
10
1
1
1
0
0
0
L4 100en
L3en
L2en
L1en
101
110
10
1
1
1
0
0
0
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 36
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Splitter
19
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 37
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Moore and Mealy: 2 types of automata
Next-State-Logik
Output-LogikD Q
reset
reset clk
in out
Next-State-Logik
Output-Logik
D Q
reset
reset clk
in out
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 38
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Your turn now: A traffic light
20
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 39
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
A RAM
Let’s start with a flipflop:
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 40
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
4-times-4 bit RAM
4x4-RAM
din
wr_addr
rd_addr
wr
dout
clk
21
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 41
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
A register with a load input
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 42
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
A 4-bit register (with load input)
22
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 43
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
A 4-to-1 multiplexor
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 44
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
A decoder for decoding the address
23
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 45
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
The complete 4*4-bit RAM D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
D Q
ld
00
01
10
11wr_addr
write
rd_addr
dout
din
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 46
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
What is this?
24
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 47
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Aha, we are having a RAM
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 48
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
This is cool
25
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 49
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
More on adding: A 4-bit adder
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 50
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
A register file with 2 read ports
26
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 51
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
The datapath
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 52
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Microcode
Microcode! din! ld_din! wr! wr_addr! rd_addrA! rd_addrB!
ld R0, 3! 0011! 1! 1! 00! 00! 00!
R1 ! R0 + R0! XXXX! 0! 1! 01! 00! 00!
out R1! XXXX! 0! 0! XX! 01! XX!
27
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 53
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
A program 0: ld R0, 1 goto 1 // Lade R0 mit 1 und gehe weiter zu Zeile 1 1: ld R1, 2 goto 2 // Lade R1 mit 2 und gehe weiter zu Zeile 2 2: R2 ! R0 + R1 goto 3 // Lade R2 mit dem Wert R1 + R2,
// gehe weiter zu Zeile 3 3: R3 ! R2 + R0 goto 4 4: out R0 goto 5 // schalte R0 auf den Ausgang,
// weiter mit Zeile 5 5: out R1 goto 6 6: out R2 goto 7 7: out R3 goto 4 // schalte R3 auf den Ausgang,
// weiter mit Zeile 4
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 54
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
The controller
Next-State-Logik
Output-Logik für
dinD Q
clk
start dp_din
Output-Logik für
control_wordcontrol_word
28
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 55
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Controller
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 56
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
Controller + datapath
29
IAIK – Institut für Angewandte Informationsverarbeitung und Kommunikationstechnologie
Professor Horst Cerjak, 19.12.2005 57
T Nad, KC Posch Vorlesung 2012 Teil D1: Hardware from below
RN
O R
echnernetze und -Organisation
What should you know by now?
• Electrical circuit • Switch • Ground • Combinational function • Inverter • Truth table • MOS technology • AND, NAND, OR, NOR,… • Half adder, full adder • Carry & sum • Look-up table • Increment • multiplexor
• Feedback & storage • Finite-state automaton • Latch and flipflop • State, initial state • Counter • State diagram • Output of a finite-state machine • Next-state logic function • Moore machine & Mealy machine • RAM • Register with load input • Decoder, address decoder • N-bit adder
Understand the terms; understand the connections between them; be able to operate with them: