Download presentation
Presentation is loading. Please wait.
Published byEzra McDowell Modified over 9 years ago
1
Data Manipulation CSCI130 Instructor: Dr. Imad Rahal
2
Layered Architecture LAYEROrder Application SW: Excel & Access2 High-order P.L.: Visual Basic1 Low-order P.L.: Assembly3 System SW: O.S.3 Machine Language4 Data Representation5 HW: Circuit Design6
3
0 clock 16-3000 MHz (~3.0 GHz)
4
Overview of Computer Hardware “necessary” components of a computer CPU, Main memory components needed for convenience computer won’t be very practical to use otherwise Secondary/Auxiliary storage, I/O devices Main memory Connects to the motherboard Divided into two major parts
5
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
6
Data Manipulation Computing an answer to an equation: 5*3 + 6 2 – 7 Assume our computer can’t directly multiply, subtract, or raise to power Multiplication task: 1: Get 1 st number, Number_1 2: Get 2 nd number, Number_2 3: Answer = 0 4: Add Number_1 to Answer 5: Subtract 1 from Number_2 6: if Number_2>0, go to step 4 7: Stop
7
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
8
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 NOT Truth Table ANOT A (A’) 10 01
9
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 AND Truth Table ABA AND B (AB) 000 010 100 111
10
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 OR Truth Table ABA OR B A+B 000 011 101 111
11
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 A+B NOT A A’ A’B’ + AB
12
(2) Through Circuit diagrams Given an expression Draw a gate after its inputs have been drawn Try A’B’ + 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) NOTANDOR ABA’B’A’B’ABA’B’+AB 0011101 0110000 1001000 1100011 Enough rows to hold all input combinations 1 letter 2 1 rows 2 letters 2 2 rows 3 letters 2 3 rows n letters 2 n rows
13
Practice Try A + (A.B’+B.C)’ How many gates? Design circuit Parenthesis, NOT, AND, and then OR Find truth table How many rows?
14
Data Manipulation given a circuit diagram expression truth table Mark every output wire by its label
15
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? 001 011 100 111 A’B’ A’B Ignore AB A’B’+A’B+AB Complicated and UGLY !!! (requires space, and is costly and slow)
16
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)
17
Simplification of Expressions Laws of Boolean Algebra Commutative Law A+B = B+A, A.B=B.A E.g. addition and multiplication Distributive Law A.(B+C) = A.B + A.C, E.g. multiplication over addition A+(B.C) = (A+B).(A+C) Idempotency Law A+A = A, A.A=A Double Negation (A’)’ = A E.g. -(-5) = +5 DeMorgan’s Law (A+B)’ = A’.B’, (A.B)’ = A’+B’ Identities A.0 = 0, A+0=A A.1 = A, A+1=1 A.A’ = 0, A+A’ = 1
18
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(B+C) A’B’+A’B+AB // distributive law (#1) A’(B’+B) + AB // identities A’(1) + AB // identities A’ + AB // distributive law (#2) (A’+A)(A’+B) // identities (1)(A’+B) // identities A’+B
19
Simplification of Expressions A.B’+A’.B’+A’.B Distributive law Idempotency Law Distributive Law B’. (A + A’) + A’.B B’ + A’.B (B’ + A’).(B’ + B) B’ + A’ (B.A)’ Identities Distributive DeMorgans
20
Simplification of Expressions AB’+B+B’+AB AB’+1 + AB 1 Identities
21
Simplification of Expressions Distributive law Idempotency Law Distributive Law
22
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 A’B’+AB (Sum of products method) Ask yourself: when am I getting a 1? (A+B)’ +AB (simpler) Draw circuit ABA=B 001 010 100 111
23
Circuit for Equivalence
24
Circuit for Addition
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.