CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

46
CBP 2005-6 Comp 1017 Digital Technol ogies 1

Transcript of CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

Page 1: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 1

Page 2: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 2

Page 3: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 3

Patron Saint of

England,

Moscow,

Boy Scouts,

the Italian calvary, chivalry, Istanbul,

Aragon,

Beirut,

Portugal,

Germany,

Genoa,

and Venice.

In the East, he is the patron of soldiers, and also of husbandmen …

Representation

Dr.C Comp 1017

Page 5: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 5

Bits and Electronics

1 0 0 1

8s 4s 2s 1s

8 + 0 + 0 + 1 = 9

Example 1

1 0 0 1

Electronics … a wire can be on (“1”) or off

(“0”)

Electric signals

The Magic … numbers are bits

are electric signals

Page 6: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 6

Numbers are Bits128 64 32 16 8 4 2 1

1 0 1 0 1

1 x 16 + 0 x 8 + 1 x 4 + 0 x 2 + 1 x 1

128 64 32 16 8 4 2 1

0 1 1 1 1

? x 16 + ? x 8 + ? x 4 + ? x 2 + ? x 1

example

question

Page 7: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 7

Counting in Binary

1s2s

0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1

4s

0 1 2 3 4 5 6 7

Page 9: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 9

N-MOS

in

P-MOS

in

CMOS : Complementary

Transistors

Page 10: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 10

N-MOS

In = 0 In = 1

P-MOS

In = 1In = 0

Transistors are Switches

Page 11: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 11

1

0

in out

Transistor Symbols

Logic Gate Symbol

Representing Electronics

Page 12: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 12

1

0

1 0

1

0

0 1

on

off on

off

Page 13: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 13

1

0

B

A B

A

out

1

0

A B O

0 0

0 1

1 0

1 1

AND gate

A

B

O/P

X

Page 14: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 14

Digital Logic Gates.

AND gate

A

B

O/P

A B O

0 0

0 1

1 0

1 1

LOGIC SYMBOL

TRUTH TABLE

0

0

0

1

Page 15: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 15

Digital Logic Lab

A B O

0 0 0

0 1 0

1 0 0

1 1 1

input switches

A

B

O OR gate

NOT gate

NOR gate

NAND gate

Page 16: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 16

Combinations of Gates

3 4

bU1

Inverter

3 4

bU1

Inverter

Sum is greater than the parts

Page 17: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 17

Exercise - Find the Truth Table

A

B

C

A B C O

0 0 0

0 1 0

1 0 0

1 1 0

0 0 1

0 1 1

1 0 1

1 1 1

P

0

0

0

1

0

0

0

1

0

0

0

0

0

0

0

1

P O

AND gate AND gate

Page 18: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 18

Investigation of Single Neurons

Microelectrode recording of Biological Neuron activation using tungsten electrode

Hubel and Weisel. Nobel Prize 1958

Photomicrograph: Height = 1mm.

Page 19: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 19

Biological AND and NOT

0

1 1

1

1

Neuron output fires only if both inputs are 1

INHIBITORY synapse : Input high 1 prevents neuron firing

Inhibitory synapse

Page 20: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 20

Two Gate Memory Cell

12

aU1

3 4

bU1

3 4

bU1

Electronic Inverter

1 00 1

Two inverters + feedback

12

aU1

3 4

bU1 1 0

0 1 0

0 1

1

Choose input 0 or 1. Follow it through two invertors with feedback. States are consistent. Two possible solutions. These are two memory states.

Page 21: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 21

SRAM Memory Cell

12aU1

3 4bU1

12aU1

3 4bU1

select

select

In/out bit

In/out bit

12

aU1

3 4

bU1

Two inverters + feedback

Neural Circuits

SRAM Memory 0

1

Page 22: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 22

STM and LTM

Before Learning

After Learning

A

A

B

B

Short Term Memory :

Cycling data between groups of neurons

0

1

Long Term Memory :

Change in strength of synapse connexion

Random Access Memory (RAM)

Hard Disk Drive

Page 23: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 23

How Many Numbers with N-bits ?

256 128 64 32 16 8 4 2 1

0 0

1 1 from 0 to 3 are 4 numbers

What are they ?

256 128 64 32 16 8 4 2 1

0 0 0

1 1 1 from 0 to 7 are 8 numbers

Page 24: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 24

Biggest Number Represented ?

256 128 64 32 16 8 4 2 1

1 1 1 1 = 15 (dec)

One less

256 128 64 32 16 8 4 2 1

1 1 1 1 1 1 1 1 = ? (dec)

One less

With 4 bits ?

With 8 bits ?

Page 25: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 25

Memory Addressing

CPU

CPU

2-bit address = 4 memory cells

3-bit address = 8 memory cells

256 128 64 32 16 8 4 2 1

0 0 0 1 1 0 1 1

16 8 4 2 1

0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1

Page 26: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 26

Questions

So what size memory with 8 bits of address ?

So what size memory with 16 bits of address ?

… 1024 512 256 128 64 32 16 8 4 2 1

Page 27: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 27

Data and Address Buses

address bus 16 bits ? Max number of memory cells ?

Memory

16 bits

CPU 8 bits

A

A

D Data bus 8 bits ? Max number which can be stored in each cell ?

D

Page 28: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 28

Representing Characters - ASCII

ASCII 8bits 256 characters

Unicode 16bits 65536

ISO 36bits 17 million

ASCII (American National Standards Institute ANSI)

American Standard Code for Information Interchange

The code for H is 01001000, for e is 01100101 So the message “Hello.” can be coded as 01001000 01100101 01101100 01101100 01101111 00101110

Page 29: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 29

Unicode

HEX Ascii

30 0

41 A

61 a

6D m

0D CRASCII

UNICODE

Babelmap

Page 30: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 30

Adding Colored Light

All colors of light can be made from the addition of RED + GREEN + BLUE

e.g. RED + GREEN = YELLOW

Page 31: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 31

Three Images Make One

RGB

(Red Green Blue)Red + Green + Blue

=

Page 32: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 32

Images “IView” Applet

Zoomed areaZoom here

+

+

=

Red, green and Blue PIXELS

Page 33: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 33

255

100

10

Video memory “planes”

Each PIXEL has 3 SAMPLES R G B

+

+

=

=

PIXEL SAMPLES

Cathode Ray Tube (CRT) screen

Page 34: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 34

8

8

8

24 bits per pixel

255

100

10

BIU

Graphics Processor

DAC’s

CRT

memory planes

Page 35: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 35

You recognize this guy. But SQUINT while looking. The image appears very much clearer. Yes!

Defocussing the image gets more information to your brain.

How? By removing distracting info pro- duced by the sharp pixel edges

Page 36: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 36

Image Processing Applet

Image Pixels Convolution KERNEL

Page 37: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 37

How convolution works

0 0 0

1 2 1

0 0 0

3 6 5 4 6 4

5 0 1 0 0 0

0 1 2 0 2 1

9 4 8 4 7 7

8 7 6 8 9 7

5 7 8 9 8 7

3 6 5 4 6 4

5 0 1 0 0 0

0 1 2 0 2 1

9 4 6 4 7 7

8 7 6 8 9 7

5 7 8 9 8 7

Scan KERNEL OVER whole image, pixel by pixel and at each point do this, e.g,

(1 x 4) + (2 x 8) + (1 x 4) = 24, divide by 4 = 6

Divide = 4

input image output image

Page 38: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 38

Hexadecimal Representation

We need a shorthand for representing binary numbers.

Divide a byte (8 bits) into two 4-bit nibbles.

1 1 1 0 0 1 1 0

1 1 1 0 0 1 1 0

Each nibble can be

0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1

1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1

0 1 2 3 4 5 6 7

8 9 A B C DEF

… so we have

E 6

E6

Page 39: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 39

Use of Hexadecimals

2. Assembler Programming

0 1 0 1 0 1 1 0 1 1 1 0 0 0 1 1

addresses Assembler code

Yellow is FFFF00

This means

FF 255 FF 255 00 0

R G B

1. Web colours in HTML

Page 40: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 40

Steganography

Page 41: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 41

Sound Representation - Demo

Microcontroller loudspeaker1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

Page 42: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 42

Digital and Analogue Data

Digital

Loaf of Bread

Notes of flute

Light On or Off

Binary 0 or 1

Analogue

Glass of Water

Notes of cello

Light Dimmer

Number 2.7123..

Page 43: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 43

Sound Representationrecording

Analogue from instrument162 148 96

Digital Representation

Sampled signal

playback

Page 44: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 44Page 461

MIDI Representation

Each track stored as sequence

List of instructions to instrument how to play music.

Does not contain sounds but instructions how to make them

Midi instruments read these instructions and make the sounds represented by the instructions

Page 45: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 45

The Abundance of Logic

Digital logic AND

AND in neurons

AND in programming

if (x == 2 ) && (y == 3 )) gohome

AND in language

(Holmes was a detective) AND (Holmes was on the case)

Page 46: CBP 2005-6Comp 1017 Digital Technologies1. CBP 2005-6Comp 1017 Digital Technologies2.

CBP 2005-6 Comp 1017 Digital Technologies 46

Why have we done all this ?

• Leibnitz (17th C) saw the need to make a machine to prove mathematical and logical theorems – that means could “reason” about a problem

• George Boole (19th C) produced symbolic logic (AND, NOT, NOR) which could simplify this process and capture most of “everyday reasoning” using only two states 0 and 1.

• Claude Shannon (20th C) showed how Boole’s logic could be implemented by electronic Logic GATES which were digital using only 0 or 1

• Alan Turing (20th C) showed how these problems could be solved by a simple “central processor” and a “storage tape”. This is our Computer!

• Bohme and Jacopini showed that any complex set of instructions to solve these problems could be broken down into simple programming constructs, e.g. “ if (this) then do that”