Logical Circuit Design Week 2,3: Fundamental Concepts in Computer Science, Binary Logic, Number Systems Mentor Hamiti, MSc Office: ,
2 An Introduction To Computer Science Computer science is the study of computers Computer science is the study of how to write computer programs Computer science is the study of the uses and applications of computers and software MISCONCEPTION 1: MISCONCEPTION 2: MISCONCEPTION 3: Logical Circuit Design
3 Concepts such as: - Computers, - Programming languages, - Software, and - Applications are part of the discipline of computer science, but individually they do not capture the richness and diversity of this new field. Logical Circuit Design An Introduction To Computer Science
4 The Definition Of Computer Science Computer science the study of algorithmsalgorithms 1. Their formal and mathematical properties 2. Their hardware realizations 3. Their linguistic realizations 4. Their applications, including Logical Circuit Design
5 The Formal Definition of an Algorithm Algorithm a well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts in a finite amount of time.a well-ordered collectionunambiguous andeffectively computable operationsproduces a resulthalts in a finite amount of time Digital Systems and Binary Logic
6 Design of Digital Systems The design of digital systems can be divided into three parts: System design Logic design Circuit design
7 Digital Systems and Binary Logic Digital systems are used extensively in computation and data processing, control systems, communications, and measurement. What is the difference between analog and digital systems? Why are digital systems capable of greater accuracy than analog systems? Why is binary logic used in digital systems?
8 Binary Logic Distinction Between the External and the Internal Representation of Information
9 Why Binary numbers ? Computers are made of millions of tiny switches. The switches have only two states - OFF & ON. OFF = 0 & ON = 1 So binary numbers is the language of all modern computers. Binary Logic
10 Binary Logic What is Information? Numbers –Binary numbers Text and Symbols –ASCII, UNICODE Sound –Binary signals Images –Pixels Animations
11 Closed circuit Open circuit Binary circuits: Electronic devices are cheapest and function most reliably if they assume only two states. Representations of Numbers
12 The three-light system: Has eight possible combinations of on and off. Could be used to indicate the numbers 0, 1, 2, 3, 4, 5, 6, 7. 0 = 0004 = = 0015 = = 0106 = = 0117 = 111 Representations of Numbers
13 The Decimal System: B=10 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) 175 = 1* * = 1 * * * 10 0 The Binary System: B=2(0, 1) 1011 = 1 * * * * 2 0 = 1 * * * = 11 (1011) 2 = (11) 10 Representations of Numbers
14 To store any kind of information in the computer’s memory, it must first be transformed into a binary numeric form. Symbols and Text Includes characters, punctuation, symbols representing numbers. Each symbol can be assigned a numeric value. Two standardized sets of codes for symbols: ASCII: American Standard Code for Information Interchange. Can represent 255 different characters/symbols. UNICODE: More modern code that can represent characters/symbols (useful for other languages such as Arabic, Chinese). Representations of Symbols and Text
15 Letters: ASCII - (American Standard Code for Information Interchange) Letter Decimal Representation 8 bit Binary Representation A B C D E F G Representations of Symbols and Text
16 Analog Signals: Representations of Sound
17 Binary Signals: Representations of Sound
18 Pictures: A picture must be transformed into numeric form before it can be stored or manipulated by the computer. Each picture is subdivided into a grid of squares called pixels (picture elements). If the squares are small enough, we will see a reasonably good image. Representations of Images
19 In a picture with only black and white pixels: 1 represents black. 0 represents white Representations of Images
20 The baby's picture with smaller pixels - more detail. The baby's picture with 4 levels of gray. Representations of Images
21 Photographic quality images have a gray-scale. Several shades between black and white are used. 4 level gray-scale means 4 shades are used. Each pixel needs 2 bits: 00 - represents white 01 - represents light gray 10 - represents dark gray 11 - represents black 256 level gray scale means 8 bits per pixel are needed for 256 shades of gray 256 levels of gray Representations of Images
22 Color Images with RGB Uses three values per pixel One number is used for each of the amounts of Red, Green and Blue on the computer screen. The amounts of Red, Green, and Blue combine like light or paint to create other colors Full color image Representations of Images
23 Number Systems Number Systems?! Not weighted Number Systems Roman: L, C, D, M, … Weighted Number Systems Decimal Binary Octal Hexadecimal ….
24 Number Systems and Conversions Examples: Convert to binary (?) 2 Convert to binary (?) 2 Convert to binary (?) 2 Convert to decimal (?) 10 Convert to octal (?) 8 Convert to decimal (?) 10 Convert to hexadecimal (?) 16 Convert ABC 16 to decimal (?) 10 Convert to base (?) 7
25 Number Systems and Conversions Direct conversions between number systems: Examples: Convert to octal (?) 8 Convert to hexadecimal (?) 16 Convert A5.C 16 to binary (?) 2 Convert ABE.B 16 to octal (?) 8 Convert to hexadecimal (?) 16 Convert to base (?) 9
26 Binary Arithmetic Binary Arithmetic: Addition Subtraction Multiply Divide Example:
27 Binary Codes Binary codes are codes which are represented in binary system with modification from the original ones. Weighted Binary Codes Weighted binary codes are those which obey the positional weighting principles, each position of the number represents a specific weight. The binary counting sequence is an example. Non Weighted Codes Non weighted codes are codes that are not positionally weighted. That is, each position within the binary number is not assigned a fixed value.
28 Weighted Binary Codes 8421 Code/BCD Code The BCD (Binary Coded Decimal) is a straight assignment of the binary equivalent. It is possible to assign weights to the binary bits according to their positions. The weights in the BCD code are 8,4,2,1. Example: The bit assignment 1001, can be seen by its weights to represent the decimal 9 because: 1x8+0x4+0x2+1x1 = 9
29 Weighted Binary Codes Binary Codes for Decimal Digits:
30 Weighted Binary Codes 2421 Code This is a weighted code, its weights are 2, 4, 2 and 1. A decimal number is represented in 4-bit form and the total four bits weight is = 9. Hence the 2421 code represents the decimal numbers from 0 to 9. 5211 Code This is a weighted code, its weights are 5, 2, 1 and 1. A decimal number is represented in 4-bit form and the total four bits weight is = 9. Hence the 5211 code represents the decimal numbers from 0 to 9.
31 Non Weighted Binary Codes Excess-3 Code Excess-3 is a non weighted code used to express decimal numbers. The code derives its name from the fact that each binary code is the corresponding 8421 code plus 0011(3). Example: 1000 of 8421 = 1011 in Excess-3
32 Non Weighted Binary Codes Gray Code The gray code belongs to a class of codes called minimum change codes, in which only one bit in the code changes when moving from one code to the next. The Gray code is non-weighted code, as the position of bit does not contain any weight. The gray code is a reflective digital code which has the special property that any two subsequent numbers codes differ by only one bit. This is also called a unit-distance code. In digital Gray code has got a special place.
33 Non Weighted Binary Codes Gray Code
34 Other Codes Sequential Codes Cyclic Codes Optimal Codes Error Detecting and Correction Codes Alphanumeric Codes
35 Logical Circuit Design Questions?!