Data Manipulation - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Data Manipulation

Description:

(2) Through Circuit diagrams. Given an expression. Draw a gate after its inputs have been drawn ... given a circuit diagram expression truth table. Mark every ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 20
Provided by: usersC1
Category:

less

Transcript and Presenter's Notes

Title: Data Manipulation


1
Data Manipulation
  • CSCI130
  • Instructor Dr. Imad Rahal

2
Overview of Computer Hardware
  • necessary components of a computer
  • CPU, Main memory
  • components needed for convenience
  • computer wont be very practical to use otherwise
  • Secondary/Auxiliary storage, I/O devices
  • Main memory
  • Connects to the motherboard
  • Divided into two major parts

3
Overview of Computer Hardware
  • RAM --- Random Access Memory
  • memory registers which store data before/after
    CPU processing
  • Available for users and programs so store data in
    and read data from
  • Volatile --- does not persist when no electric
    power is supplied to its circuits
  • ROM --- Read Only Memory
  • Permanent
  • Holds programs that are vital for the operation
    of the computer
  • As the name indicates, can be read but never
    altered
  • CPU
  • Central Processing Unit
  • Single silicon chip with circuits attached to it
  • Known as microprocessor
  • Sits on a circuit board known as the motherboard

4
Data Manipulation
  • Computing an answer to an equation
  • 53 62 7
  • Assume our computer cant directly multiply,
    subtract, or raise to power
  • Multiplication task
  • 1 Get 1st number, Number_1
  • 2 Get 2nd number, Number_2
  • 3 Answer 0
  • 4 Add Number_1 to Answer
  • 5 Subtract 1 from Number_2
  • 6 if Number_2gt0, go to step 4
  • 7 Stop

5
Data Manipulation
  • All tasks done by a general-purpose computer can
    be accomplished through the following set of
    operations
  • Input/output
  • Not mentioned in book but important
  • Store data
  • numbers (positive, negative or fractions), text,
    pictures, etc
  • Compare data (numbers, pictures, sounds, letters)
  • Add
  • Move data from one storage (memory) location to
    another
  • Editing a text document

6
Data Manipulation
  • Adding and comparing bit patterns is sufficient
    to achieve an operational machines
  • Hard-wired vs. programmed
  • This is done by circuits for adding and comparing
    bit patterns in registers
  • Circuits are made up of logical gates
  • Gates and Truth Tables
  • Gates needed are NOT, AND, and OR
  • NOT Gate
  • Single input and single output
  • Reverses input
  • 1 ? 0 and 0 ? 1
  • If there is a strong electric current
  • ? shut it off
  • If there is no/weak electric current
  • ? turns it on
  • Like a power switch

7
Data Manipulation
  • AND Gate
  • Accepts two inputs (or more) and yields one
    output
  • Output is 0 when any input is 0
  • Requires power coming from both lines in order to
    give out power

8
Data Manipulation
  • OR Gate
  • Accepts two inputs and yields one output
  • Output is 1 when any input is 1
  • Requires power coming from at least one of the
    input lines in order to give out power

9
Data Manipulation
  • These three simple gates are combined to create
    circuits that perform more complicated operations
  • Circuits, in turn, might then be used (thru
    programs) to perform even more complicated tasks
  • Gate combinations can be expressed in three ways
  • (1) Through Expressions
  • A AND B ? AB
  • A OR B ? AB
  • NOT A ? A
  • AB AB

10
  • Enough rows to hold all input combinations
  • 1 letter ? 21 rows
  • 2 letters ? 22 rows
  • 3 letters ?23 rows
  • n letters ?2n rows
  • (2) Through Circuit diagrams
  • Given an expression
  • Draw a gate after its inputs have been drawn
  • Try AB AB
  • (3) Through Truth Tables
  • Each of the representations can be derived from
    the other
  • Derive truth table given expression
  • One column for each letter
  • Make 1 additional column for every sub-expression
    (order parentheses, NOTs, ANDs, ORs)

11
Practice
  • Try A (ABBC)
  • Design circuit
  • Rule once you have drawn all the inputs of a
    gate, you can draw the gate itself
  • Find truth table
  • How many rows?

12
Data Manipulation
  • given a circuit diagram ? expression ? truth
    table
  • Mark every output wire by its label

13
Sum of Products Method
  • Given a truth table, how to find expression?
  • Sum-of-product method
  • For each row with a 1 in the final column
  • AND letters with a 1 in their column and negation
    of the letters with a 0 in their column
  • Connect the resulting AND groups with ORs
  • AB
  • AB
  • Ignore
  • AB

? ABABAB ? Complicated and UGLY ? !!!
(requires space, and is costly and slow)
14
Simplification
  • Why simplify?
  • UGLY ?
  • Circuits supposed to be as simple as possible
  • Save on speed (operation execution---fewest gates
    as possible because every gates slows the
    operation a bit)
  • (in general) more gates ? more time
  • Save space (on motherboard)
  • Notebooks!
  • Save money (not as critical)

15
Simplification of Expressions
  • Laws of Boolean Algebra
  • Commutative Law
  • AB BA, ABBA
  • E.g. addition and multiplication
  • Distributive Law
  • A(BC) AB AC, E.g. multiplication over
    addition
  • A(BC) (AB)(AC)
  • Idempotency Law
  • AA A, AAA
  • Double Negation
  • (A) A
  • E.g. -(-5) 5
  • DeMorgans Law
  • (AB) AB,
  • (AB) AB
  • Identities
  • A0 0, A0A
  • A1 A, A11
  • AA 0, AA 1

16
Simplification of Expressions
  • To simplify (reduce the number of gates)
  • (1) look at two or more terms sharing one or more
    letters
  • use distributive Law
  • AB AC A(BC)
  • ABABAB // distributive law (1)
  • A(BB) AB // identities
  • A(1) AB // identities
  • A AB // distributive law (2)
  • (AA)(AB) // identities
  • (1)(AB) // identities
  • AB

17
Simplification of Expressions
  • ABBBAB
  • AB1 AB
  • 1

Identities
Identities
18
Simplification of Expressions
Distributive law
Idempotency Law
Idempotency Law
Distributive Law
19
Circuit for Equivalence
  • We need to compare the data contents of two
    registers
  • Data is in binary
  • compare them bit by bit
  • Start right to left
  • Take two inputs
  • If both 0s or 1s, output 1
  • Otherwise, output a zero
  • ABAB
  • (Sum of products method)
  • Ask yourself when am I getting a 1?
  • ? (AB) AB (simpler)
  • Draw circuit
Write a Comment
User Comments (0)
About PowerShow.com