COMP 125 Principles of Computing - PowerPoint PPT Presentation

1 / 73
About This Presentation
Title:

COMP 125 Principles of Computing

Description:

Patrick's Evaluation. Attendance. Collect Assignment 3. Patrick will take up 2 & 3 on June 20th ... Intro to Level 2 The Hardware World ... – PowerPoint PPT presentation

Number of Views:81
Avg rating:3.0/5.0
Slides: 74
Provided by: paulkr5
Category:

less

Transcript and Presenter's Notes

Title: COMP 125 Principles of Computing


1
COMP 125Principles of Computing
  • The Building Blocks Binary Numbers, Boolean
    Logic Gates

2
Agenda
  • Patricks Evaluation
  • Attendance
  • Collect Assignment 3
  • Patrick will take up 2 3 on June 20th
  • Final Exam
  • Interested doing the final exam in last class
    August 1?
  • Review Practice Problem 104 (105)
  • Questions 1-4
  • Chapter 4
  • Lab Experience 7

3
Intro to Level 2 The Hardware World
  • What is involved in designing real computers to
    solve real-life problems
  • Chapter 4 Digital logic design level
  • How to represent and store information
  • Use symbolic (Boolean) logic to design gates
  • Use gates to design circuits
  • Chapter 5 Organization level
  • Memory
  • input/output,
  • Arithmetic/logic unit
  • Control unit

4
Chapter 4 to 4.2
  • Topics
  • Binary Representation
  • Reliability of Binary Representation
  • Binary Storage Devices
  • Learning Objectives
  • Understand why binary is used, to translate
    between decimal and binary and to do simple
    binary calculations
  • Know the conditions of a bistable environment and
    the way light switches, magnetic cores and
    transistors meet them.

5
Data Representation
  • Notational conventions for representing
    information
  • Decimal representation for numerical values
  • 0,1,2,3,4,5,6,7,8,9
  • The 26 letters A,B,C,X,Y,Z for text
  • Plus lowercase and punctuation
  • Signed notation ,-
  • Decimal Notation for real numbers
  • Decimal point separates whole number part from
    fractional part

6
Data Representation
  • External
  • Internal

7
Decimal Representation
  • In decimal, the following symbols are used to
    represent different values 0, 1, 2, 3, 4, 5, 6,
    7, 8, 9.
  • For example, let us write four thousand, seven
    hundred and sixty-three. 1000s  100s   10s    1s
    103    102    101    100   4    
    7     6      3 or else it can be written
    this way (4 x 1000) (7 x 100) (6 x 10) (3
    x 1) 4763

8
Binary Representation
  • In the binary system, just two symbols are used
    0 and 1.
  • Therefore any number can be represented by 0s and
    1s only
  • Lets examine a 6 digit (bit) binary number
  • 1 1 1 0 0 1
  • Position value 25 24 23 22 21 20
  • 32 16 8 0 0 1
  • 57
  • This table converts binary to decimal

9
Converting Decimal to Binary
  • A popular method for converting a Decimal number
    into a Binary number is by dividing the number by
    two, repeatedly.
  • 26 is written as 11010 in binary.
  • Check it out, using the repeated "division by 2"
    method.
  • 26 divided by 2 13, remainder 0
  • 13 divided by 2 6, remainder 1
  • 6 divided by 2 3, remainder 0
  • 3 divided by 2 1, remainder 1
  • 1 divided by 2 0, remainder 1

10
Computer Maximums
  • Every number that can be represented in base 10
    can be represented in base 2, although it takes
    more digits
  • in base 10, 57 takes 2 digits
  • In base 2, 57 takes 6 digits - 111001
  • Every computer (virtual machine) has a maximum
    number of bits used to represent an integer
  • 16 bit 216 65,535
  • 32 bit 232 4,294,967,296
  • Adding just one more (than max) causes an
    arithmetic overflow error.

11
Signed Integers
  • The leftmost will represent the sign negative
    if on (1), positive if off (0)
  • Our previous 6 digit binary now needs an extra
    bit to make it negative
  • Here it is in full 1 byte ( 8 bit) representation

1 0 1 1 1 0 0 1
neg. 26 25 24 23 22 21 20 - 0 32 16
8 0 0 1 - 57
12
Encoding Schemes
  • Weve just looked at two such schemes for numbers
  • Another called twos complement is generally used
    for signed integers
  • Real numbers have yet another scheme
  • So far weve looked at schemes that involve
    performing some conversion
  • The next uses a look-up table

13
Binary Representation of Characters
  • Each character is represented by a unique
    (binary) number
  • The ASCII table is the most common scheme page
    141
  • Uses 8 bits 28 or 256 different characters
  • Only the numbers 32-126 have been assigned
    printable characters

14
Binary Representation of Sound
  • Multimedia data is sampled to store in digital
    form, with or without detectable differences
  • Representing sound data
  • Sound data must be digitized for storage in a
    computer
  • Digitizing means periodic sampling of amplitude
    values

15
Sound (continued)
  • From samples, original sound may be approximated
  • To improve the approximation
  • Sample more frequently
  • Use more bits for each sample value

16
Digitization of an Analog Signal
  • (a) Sampling the Original
  • Signal
  • (b) Recreating the
  • Signal from the Sampled
  • Values

17
Representing Image Data
  • Images are sampled by reading colour and
    intensity values at even intervals (a grid)
    across the image
  • The size of the grid is called resolution
  • 1024 x 768 or 1600 x 1200
  • Each sampled point is a pixel
  • Image quality depends on number of bits at each
    pixel
  • True-Color (24bit) uses 1 byte for each of red,
    green blue to represent over 16 million colours
    at each pixel
  • What is the storage requirement (size) of a
    True-Color image with a resolution of 1600 x 1200?

18
What do the bits mean?
  • The computer does not know what a specific bit
    pattern in memory means
  • The meaning is imposed only as a result of how
    some process has been designed to interpret the
    pattern
  • In writing programs we declare variables as a
    certain type
  • integer a number
  • character letter, number or character
  • string group of numbers, letters or characters

19
Reliability
  • Electrical systems work best in a bistable
    environment, in which there are only two stable
    states
  • The problem with base 10 representation is that
    it needs to store 10 unique symbols and therefore
    needs a device that has 10 stable states.
  • As electrical component ages, it may drift
    (change their energy level) and therefore not
    reliably represent a state
  • If it only needs to deal with voltage or no
    voltage circuit on/circuit off, nearly a 50
    drift in voltage is still tolerable when
    interpreting a stored value.

20
Binary Storage Devices
  • Binary Hardware Criteria
  • 2 stable energy states
  • A large energy barrier between them
  • Ability to read the state without destroying it
  • Ability to change the state as needed
  • Two approaches
  • Magnetic Cores historic
  • Transistors current

21
Magnetic Cores
  • An Iron oxide-coated donut can be magnetized by
    running current through a wire strung through its
    hole
  • The direction of the resulting magnetic field is
    dependant upon the direction of the current
  • Who can say how big ½ a gigabyte of memory would
    be?

22
Transistor
  • Just a switch its turned on/off electrically
  • Current technology (at texts printing)
  • Switch state 1 billionth of a sec
  • Density 30 to 50 million per cm2
  • Made from semiconductors (silicon or gallium
    arsenide)
  • Transistors are printed photographically onto a
    wafer of silicon using a mask which is used to
    produce many copies of the circuit (chip)
  • VLSI Very large scale integration 3 to 10
    million transistors per cm2
  • ULSI Ultra large scale integration possibly
    billions transistors per cm2

23
Relationship of Transistors, Chips
Individual transistors (typically 30 50
million per chip)
DIPs are not often used any longer. Most boards
have chips soldered directly onto the board.
24
Transistor Model
25
Links
  • Binary Numbers
  • http//courses.cs.vt.edu/csonline/NumberSystems/L
    essons/BinaryNumbers/index.html
  • Core Memory
  • http//www.psych.usyd.edu.au/pdp-11/core.html

26
Lets Practice
  • Practice problems page 142
  • Number 1, 2, 3 5
  • Convert the following to binary using the
    standard notation
  • 25, 78, 255
  • Convert several bit patterns to decimal
  • Start with 0110 1011

27
IMPORTANT
  • Bring a disc so that you can save (and take with
    you) the files that you create in LE 7
  • You will need the disc for future labs as well

28
Chp 4 theory cont.
  • Chapter 4 (156 178)
  • Boolean Logic
  • Gates
  • Building Computer Circuits (to 178)

29
George Boole (1815 1864)
  • Created a new form of logic containing the values
    true and false and the operators AND OR NOT
  • Developed a set of rules to interpret and
    manipulate expressions that contain these values
  • 100 years later his theories became the framework
    for designing computer systems

30
Boolean Logic
  • Rules for manipulating 2 logical values true
    and false
  • Anything stored in a sequence of binary digits
    can also be viewed as a sequence of logical
    values, true and false
  • The operators AND OR NOT map a set of True False
    values into a single (true, false) result

31
Boolean Logic
  • Boolean Logic deals with manipulating the two
    logical values true and false
  • A Boolean Expression is defined as any expression
    that evaluates to either true or false
  • Examples (x1), (a?b), (cgt5.23)
  • A Boolean Expression combines arithmetic
    expressions using the boolean operators
  • AND (x y 25 AND y lt 100)
  • OR (x y OR x lt 10)
  • NOT (NOT (x y))

32
Rule for performing AND operation
  • a AND b, also written as a?b, is true only if the
    value of a and the value of b is true
  • Otherwise the expression a?b has the value of
    false
  • To check a test score S in the range 90 to 100
    inclusive
  • Sgt90 AND Slt100

33
Truth Table for AND Operation
34
Rule for performing OR operation
  • a OR b, also written as ab, is true if the value
    of a is true, if value of b is true, or both are
    true
  • Otherwise the expression ab has the value of
    false
  • To check a students major
  • (major math) OR (major comp science)

35
Truth Table for OR Operation
36
Boolean logic (OR and AND)
  • What conditions must be satisfied for the
    necessary outcome (buzzer sounding, alarm
    sounding, etc.) ?
  • Determine whether all conditions must be met or
    whether satisfying only one of the conditions is
    necessary.
  • You have a buzzer in your car that sounds when
    your keys are in the ignition AND the door is
    open.
  • You have a fire alarm installed in your house.
    This alarm will sound if it senses heat OR smoke.
  • There is a federal election coming up. People are
    allowed to vote if they are a Canadian citizen
    AND they are 18.

37
Rule for performing NOT operation
  • Not a, also written as a, is true if a has the
    value of false and false if a has the value of
    true
  • NOT reverses or complements the value of the
    Boolean expression
  • To compare a students gpa
  • (gpa gt 3,5) is true if your gpa is greater than
    3.5
  • NOT (gpagt3.5) is true only if your gpa 3.5

38
Truth Table for NOT Operation
39
Lets Practice
  • Page 159
  • Problem 1 2

40
Gates
  • A gate operates on a collection of binary inputs
    to produce a binary output
  • Consider the value 1 equivalent to true and the
    value 0 equivalent to false
  • Then AND, OR, NOT gates directly implement the
    corresponding Boolean expression

41
AND, OR, NOT Gates
42
IMPORTANT NOTE
  • The text takes a different (slightly more
    complex) approach to building gates that we will
    here.
  • Be sure that youre comfortable with the texts
    approach as well as this approach.

43
Gates and Transistors
  • AND 2 transistors in series
  • The output will be 1 only if both inputs are 1
  • OR 2 transistors in parallel
  • Only if both inputs are 0 will the output be 0
  • NOT 1 transistor 1 resistor
  • If input is 0, output is 1
  • If input is 1, output is 0

44
(No Transcript)
45
Why Gates and not transistors?
  • A transistor is too elementary a device
  • we dont have to deal with transistors,
    resistors and capacitors or voltages, current and
    resistance the building block of circuit
    construction (for us) will be gates
  • Using gates as building blocks is another
    example of using abstraction in computer science.

46
Building Computer Circuits
  • A combinational circuit (just circuit to us) is
    made up of logic gates
  • That transform a set of binary inputs into a set
    of binary outputs,
  • Where the values of the outputs depend only on
    the values of the inputs
  • A circuit is constructed from AND, OR NOT gates
  • These gates can be connected in any way so long
    as the connections do not violate the proper
    number of inputs and outputs for each gate
  • Each AND - two inputs, one output
  • Each OR gate two inputs , one output
  • Each NOT gate - one input, one output

47
Building Computer Circuits
  • Every Boolean expression can be represented
    pictorially as a circuit diagram
  • The pictorial view is often used during the
    design stage, allowing overall visualization
  • Every output value in a circuit diagram can be
    written as a Boolean expression
  • An expression may be a more convenient way to
    perform verification and optimization

48
Our First Circuit
  • c (a OR b)
  • d NOT ( (a OR b) AND (NOT b ))

49
Building Computer Circuits
  • Construct circuits using AND, OR, and NOT gates.
  • Apply the sum of products algorithm to construct
    the circuit diagram for any truth table. (AND the
    reverse)
  • Understand the purpose and construction of
    multiplexors and decoders

50
Precedence
  • The order of precedence rule for boolean
    operations is NOT first, AND second and OR third.
  • So
  • x AND NOT y OR z
  • Means
  • (x AND (NOT y)) OR z
  • Parentheses can be used to change the order and
    are recommended where needed to enhance
    readability

51
Circuit Construction Algorithm
  • Sum of Products Algorithm
  • Construct the truth table
  • Every output of 1 denotes a sub-expression
  • Create sub-expressions using AND NOT
  • each sub-expression becomes a sub-circuit of the
    completed circuit
  • Combine sub-expressions using OR
  • sub-circuits are joined with OR gates
  • Construct the circuit

52
Truth Table Construction
  • Determine the binary value that should appear on
    each output line of the circuit for every
    possible combination of inputs
  • If a circuit had N input lines, there are 2N
    combinations of input values
  • See the truth tables on pg 166

53
Subexpression Construction using AND and NOT gates
  • Choose an output column
  • For every place you find a 1 in the output
    column, you build a subexpression that produces
    the value of 1
  • If the input is a 1, use the input value
  • If the input is a 0, first take the NOT of that
    input and use that complemented input value in
    your subexpression
  • See the example, page 167

54
Subexpression Combination using OR gates
  • Take each of the subexpressions produced in step
    3 and combine them, two at a time, using OR gates
  • The Boolean expression produced in step 3
    implements exactly the function of the truth table

55
Circuit Diagram Production
  • Convert the Boolean expression produced at the
    end of step 3 into a circuit diagram using the
    AND,OR, NOT gates to implement the AND, OR, Not
    operators appearing in the Boolean expression

56
Circuit Construction
  • IMPORTANT The Sum of Products Algorithm
    doesnt always produce an optimal circuit
  • The circuit on the right has the same output as
    the one on the left.

57
Lets Practice
  • Page 164 (169)
  • Problem 2

58
Problem 2
  • Heres a truth table
  • Create the sub-expressions
  • Combine them
  • Construct the circuit

59
Problem 2
  • Create the sub-expressions
  • NOT a AND b
  • a AND NOT b
  • Combine them
  • NOT a AND b OR a AND NOT b
  • Construct the circuit diagram (next slide)

60
Problem 2
61
Compare for Equality Circuit
  • We can combine simple 1-CE circuits to create
    an N-bit CE circuit

62
Addition Circuit
  • Binary addition
  • 11 (the carry bit)
  • 001101 (binary value 13)
  • 001110 (binary value 14
  • 011011 (binary value 27)

63
1-Add Circuit and Truth Table
  • The truth table for the 2 binary digits, ab, the
    carry digit from the previous column c and the
    outputs sum and the new carry digit
  • Create sub-expressions for Si
  • Combine the subexpressions for Si

64
Sum Output for 1-Add
65
1-Add
66
The Full Adder Add Circuit
67
Size and Complexity of the ADD Circuit
  • How many transistors are needed in a 32-Bit
    Adder?
  • NOT 32 x 3 96 NOT gates _at_ 1 tran/gate
    96
  • AND 32 x 16 512 AND gates _at_ 3 tran/gate
    1536
  • OR 32 x 6 192 OR gates _at_ 3
    tran/gate 576

  • Total 2208
  • Optimized 32-bit addition circuits can be
    constructed with fewer transistors (500-600)
  • NOTE if vacuum tubes were used instead of
    transistors, our ADD computer would be the size
    of a refrigerator
  • With todays technology our ADD circuit fits into
    an area smaller than the period at the end of
    this sentence.

68
Test Your Knowledge
  • Page 172 (178) Do practice problem 1 for
    ungraded homework. We will take it up next class.

69
Control Circuits
  • Control circuits
  • determine the order in which operations are
    performed
  • select the correct data values to process
  • Sequencing and decision-making circuits
  • Multiplexor
  • 2N input, 1 output N selector lines
  • Decoder
  • N input 2N output lines

70
Multiplexor
  • N selector lines can select one output from 2N
    input lines
  • Useful to select data

71
Multiplexor Example
72
Decoder
  • N input lines can determine which one (and ONLY
    one) of 2N output lines will be turned on
  • Useful to select the correct instruction

73
Decoder Example
Write a Comment
User Comments (0)
About PowerShow.com