5
9/8/15 1 WELLESLEY CS CS 240, Fall 2014 Digital Logic Gateway to computer science Devices (transistors, etc.) SolidState Physics Hardware Digital Logic Microarchitecture Instruction Set Architecture Operating System Programming Language Compiler/Interpreter Program, Application Software WELLESLEY CS CS 240, Fall 2014 Digital logic values A digital circuit has only two logicalvalues present. *Exact voltage levels and their interpretation varies with technology. 0.0V 0.5V 2.8V 3.3V 0 1 0 1, true, asserted 0, false, unasserted WELLESLEY CS CS 240, Fall 2014 Transistors Very fast binary switches. Base Collec tor +V cc (Supply Voltage) Emitter (Circuit Ground)

CS 240, Fall 2014 WELLESLEY CS CS 240, Fall 2014 Program

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS 240, Fall 2014 WELLESLEY CS CS 240, Fall 2014 Program

9/8/15

1

WELLESLEY CSCS 240, Fall 2014

Digital  Logic

Gateway  to  computer  science

WELLESLEY CSCS 240, Fall 2014

Devices  (transistors,  etc.)

Solid-­‐State   Physics

Hardw

are

Digital  LogicMicroarchitecture

Instruction   Set  Architecture

Operating   System

Programming   Language

Compiler/Interpreter

Program,   Application

Software

WELLESLEY CSCS 240, Fall 2014

Digital  logic  values

A  digital  circuit  has  only  two  logical  values  present.

*Exact  voltage   levels  and   their   interpretation   varies   with   technology.

0.0V0.5V

2.8V3.3V

0 1 0

1,  true,  asserted

0,   false,   unasserted

WELLESLEY CSCS 240, Fall 2014

TransistorsVery  fast  binary  switches.

Base

Collector

+Vcc (Supply  Voltage)

Emitter

(Circuit   Ground)

Page 2: CS 240, Fall 2014 WELLESLEY CS CS 240, Fall 2014 Program

9/8/15

2

WELLESLEY CSCS 240, Fall 2014

Tiny  electronic  devices  that  compute  functions  on  two-­‐valued  signals.

Logic  Gates

Vin

+Vcc

Vout

NAND

V1

+Vcc

Vout

V2

NOT

WELLESLEY CSCS 240, Fall 2014

Integrated   Circuits   (invented   1950s)

Gates  are  manufactured  in  units  called  integrated  circuits.From  SSI  (tens)  to  VLSI  (hundreds  of  thousands  to  billions)

Wafer

Chip

WELLESLEY CSCS 240, Fall 2014

Five  basic  gates

NOT NAND NOR

AND OR

*Gates  with   more  than   two   inputs   are  possible:

Define  with   truth   tables.

WELLESLEY CSCS 240, Fall 2014

Design  new  gates  from  old

exclusive  or often  used  as  a  one-­‐bit  comparator.

XOR

Future  video  game  designers,  Halloween  costumers  extraordinaire,  sci-­‐fi/fantasy  screenwriters,I  have  an  idea…

Page 3: CS 240, Fall 2014 WELLESLEY CS CS 240, Fall 2014 Program

9/8/15

3

WELLESLEY CSCS 240, Fall 2014

Gates of XOR

Exclusive preview, or something.

WELLESLEY CSCS 240, Fall 2014

Boolean  Algebra

A

BA  B(A  ·∙  B)

A

BA  +  B

A A A A

wires  =  variables

gates  =   simple  functions

AND  =  Boolean  product OR  =  Boolean  sum

NOT  =  inverse  or  complement wire  =  identity

·∙ 0 1

0 0 0

1 0 1

+ 0 1

0 0 1

1 1 1

0 1

1 00 0

1 1

WELLESLEY CSCS 240, Fall 2014

Boolean  expressions,circuit  equivalence

A

B=

A

B

A  +  B

0

A A A

A  +  B

0  +  A=

A

A  A= A

0

Notice  the  bubble...  familiar?

WELLESLEY CSCS 240, Fall 2014

Name  that  rule

A

B=

=

A  +  BB

AB  +  A

AB

C

(AB)CAB A

BC

A(BC)

BC

Page 4: CS 240, Fall 2014 WELLESLEY CS CS 240, Fall 2014 Program

9/8/15

4

WELLESLEY CSCS 240, Fall 2014

Rules,  rules,  rules

0

A

A A

0  A=

A

A0

A  +  A =

WELLESLEY CSCS 240, Fall 2014

DeMorgan's Law(double  bubble,  toil  and  trouble,  in  Randy's  words...)

AA  +  B

B

A

B=

AB A  B=

AB

A  +  B =

A  +  B

WELLESLEY CSCS 240, Fall 2014

Take  care

A

1

A  +  1 =

A A  +  AB

B

=

AB

WELLESLEY CSCS 240, Fall 2014

A  universal  gate*

*Are   there  others?

Let's  prove  it!    Build  AND,  OR,  NOR,  NOT  using  only  NAND.

Page 5: CS 240, Fall 2014 WELLESLEY CS CS 240, Fall 2014 Program

9/8/15

5

WELLESLEY CSCS 240, Fall 2014

Circuit  simplificationCan  we  find  a  simpler  circuit  that  performs  the  same  function?*

Start  with  an  equivalent  Boolean  expressionF(A,  B,  C)  =  

*All   other   things   equal,   smaller   circuits  are  cheaper,   faster,   cooler,   and  easier   to  design.

Check  with  a  truth  table...  with  3  inputs?

WELLESLEY CSCS 240, Fall 2014

Code  detectorsA  four  input  AND  gate  recognizes  exactly  one  input  code.

Design  a  code  detector  that  recognizes  ABCD  =  1001.

Design  a  code  detector  that  recognizes  either  ABCD  =  1001  or  ABCD  =  1111.

ABCD

WELLESLEY CSCS 240, Fall 2014

Voting  machinesA  majority  circuit outputs  1  whenever  a  majority  of  its  inputs  equal  1.Design  a  simple  majority  circuit  for  three  inputs.

A B C Majority0 0 0 00 0 1 00 1 0 00 1 1 11 0 0 01 0 1 11 1 0 11 1 1 1

WELLESLEY CSCS 240, Fall 2014

Sum  of  productsA  sum  of  products representation  is

the  logical  sum  (OR)of  products  (AND)of  inputs  or  their  complements  (NOT).

Digital   circuits13-­‐21

Try  building  for  E:    Think  of  summing/ORing code  detectors.