Digitalteknik & Datorarkitektur vren 2009 Rkna med grindar - - PowerPoint PPT Presentation

digitalteknik datorarkitektur v ren 2009
SMART_READER_LITE
LIVE PREVIEW

Digitalteknik & Datorarkitektur vren 2009 Rkna med grindar - - PowerPoint PPT Presentation

Digitalteknik & Datorarkitektur vren 2009 Rkna med grindar Frelsning 2 mndag 23 mars karl.marklund@it.uu.se Gates and Boolean Algebra Some logical functions for two variables. x y x AND y x OR y x XOR y 0 0 0 0 0 0 1


slide-1
SLIDE 1

Digitalteknik & Datorarkitektur våren 2009

Räkna med grindar

Föreläsning 2 måndag 23 mars

karl.marklund@it.uu.se

slide-2
SLIDE 2

Gates and Boolean Algebra

slide-3
SLIDE 3

1 1 1 1 1 1 1 1 1 1 x XOR y x OR y x AND y y x Some logical functions for two variables. Hur många olika sådana funktioner finns det för två variabler?

slide-4
SLIDE 4

1 1 1 1 1 1 1 1 1 1 x XOR y x OR y x AND y y x Some logical functions for two variables. Varje funktion definieras entydigt av sin kolumn i tabellen.. Varje kolumn utgörs av ett fyra bitars binärt tal... Hur många olika fyra bitars tal finns det?

slide-5
SLIDE 5

Det finns 24 = 16 olika!

slide-6
SLIDE 6

Hur adderar vi tal?

slide-7
SLIDE 7
slide-8
SLIDE 8

1 0 1 + 1 1 1

  • ? ? ?

Hur adderar vi binära tal?

slide-9
SLIDE 9

1 (c) 1 1 1 1 1 1 0 1 (x) 1 0 1 1 0 1 + 1 1 1 (y) + 1 1 1 + 1 1 1

  • 0 0 0 1 1 0 0

Minnessiffra – Carry (överskjutande 2-tal) Summanderna är på tre bitar och resultatet kan då bli fyra bitar. Har vi endast möjlighet att lagra tre bitar finns alltså risk för

  • verflow.

Hur adderar vi binära tal?

överskjutande 4-tal överskjutande 8-tal

slide-10
SLIDE 10

Half Adder

1 cout Output 1 1 y 1 1 s 1 1 x Inputs 3 2 1 Row

S = ? Cout = ?

slide-11
SLIDE 11

Half Adder

1 cout Output 1 1 y 1 1 s 1 1 x Inputs 3 2 1 Row

S = x XOR y Cout = x AND y

slide-12
SLIDE 12

Logisim Demo!

slide-13
SLIDE 13
slide-14
SLIDE 14

When just one of them is "on"...

Programmable Water

When both are "on", the two jets collide, going vertically down to the "U" piece, that collects the water. In other words, it's a XOR gate. In other words, an AND gate. So, we have two Boolean

  • perations in just one

device… … and it’s a half adder.

Paulo Blikstein

slide-15
SLIDE 15

http://www.blikstein.com/paulo/projects/project_water.html

slide-16
SLIDE 16

http://web.cecs.pdx.edu/~harry/Relay/ Vill man inte bygga en dator av vatten funkar det bra med reläer.

slide-17
SLIDE 17

Relay Triod Transistor Water Gate Alla dessa tekniker kan användas för att konstruera logiska kretstar... till exempel för att addera två tal.

slide-18
SLIDE 18

1 1 0 + 0 1 1

  • ? ? ?

6 + 3 = ? 6 3

= 4 + 2 = 22 + 21 = 2 + 1 = 21 + 20

slide-19
SLIDE 19

1 1 0 + 0 1 1

  • ? ? ?

6 + 3 = ? 6 3

= 4 + 2 = 22 + 21 = 2 + 1 = 21 + 20

slide-20
SLIDE 20

1 + 1 + 1 = 112 1 + 1 + 0 = 102 1 + 0 + 1 = 102 1 + 0 + 0 = 012 0 + 1 + 1 = 102 0 + 1 + 0 = 012 0 + 0 + 1 = 012 0 + 0 + 0 = 002 Comment 1 1 1 1 s 1 1 1 1 cout Outputs Inputs 1 1 1 7 1 1 6 1 1 5 1 4 1 1 3 1 2 1 1 cin y x Row 1 0 0 (c) 1 1 0 (x) + 0 1 1 (y)

  • (1) 0 (1)0 (0)1

Overflow

Carry Out från den ena enbits-additionen blir carry in för nästa…

Vi skriver det som en sanningstabell

slide-21
SLIDE 21

1 1 1 1 cout 1 1 1 cin 1 1 1 y 1 1 1 x Inputs 7 6 5 3 Row

Values of the inputs when Carry Out equals 1. All inputs in a row can be represented as a minterm. In a minterm each input variable appearc once, either as the variable itself or as the inverse.

slide-22
SLIDE 22

1 1 1 1 cout 1 1 1 cin xycin xy!cin x!ycin !xycin minterms 1 1 1 y 1 1 1 x Inputs 7 6 5 3 Row

Values of the inputs when Carry Out equals 1.

Cout = !xycin + x!ycin + xy!cin + xycin

Row 3 5 6 7

In a minterm, each input variable, A, B or C appears once, either as the variable itself or as the inverse. Each minterm corresponds to exactly one entry (row) in the truth table.

slide-23
SLIDE 23

1 1 1 1 cout 1 1 1 cin xycin xy!cin x!ycin !xycin minterms 1 1 1 y 1 1 1 x Inputs 7 6 5 3 Row

Values of the inputs when Carry Out equals 1.

Cout = !xycin + x!ycin + xy!cin + xycin

Row 3 5 6 7

Cout = cin(!xy + x!y) + xy(!cin + cin)

??? ???

slide-24
SLIDE 24

1 1 1 1 cout 1 1 1 cin xycin xy!cin x!ycin !xycin minterms 1 1 1 y 1 1 1 x Inputs 7 6 5 3 Row

Values of the inputs when Carry Out equals 1.

Cout = !xycin + x!ycin + xy!cin + xycin

Row 3 5 6 7

Cout = cin(!xy + x!y) + xy(!cin + cin)

!cin + cin = 1 !xy + x!y = x XOR y

slide-25
SLIDE 25

1 1 1 1 cout 1 1 1 cin xycin xy!cin x!ycin !xycin minterms 1 1 1 y 1 1 1 x Inputs 7 6 5 3 Row

Values of the inputs when Carry Out equals 1.

Cout = !xycin + x!ycin + xy!cin + xycin Cout = cin(!xy + x!y) + xy(!cin + cin) Cout = cin(x XOR y) + xy

Logisim DEMO

slide-26
SLIDE 26

xycin x!y!cin !xy!cin !x!ycin minterms 1 1 1 1 S Inputs 1 1 1 7 1 4 1 2 1 1 cin y x Row

S = x XOR y XOR cin

Aha! Sum is one only one when an odd number of inputs are one.

Logisim DEMO

slide-27
SLIDE 27

1 bit half adder 1 bit half adder

slide-28
SLIDE 28

A one bit Adder wiht Carry In and Carry out.

slide-29
SLIDE 29

When multiple full adders are used with the carry ins and carry outs chained together then this is called a ripple carry adder because the correct value of the carry bit ripples from one bit to the next.

slide-30
SLIDE 30

Tutorial: Mer om grindar

  • ch andra grundläggande

komponenter.

slide-31
SLIDE 31

Uppgift: Lär dig mer om grindar, multiplexrar, demultiplexrar adderare

  • ch register..
slide-32
SLIDE 32

Ok, om vi först sätter koden till 0127 När vi trycker in 3, 4, 5 ... händer ingenting. Om vi fortsätter med 0, 1 händer inget. Men när vi fortsätter med 2, 7 så öppnas låset.

Utmaning: Konstruera ett kodlås.

Skall kunna sätta en 4-siffrig kod. Skall signalera när rätt kod trykts in.