CPE206 - Number System - Lecture 1 PDF

Summary

This document covers fundamental concepts of number systems, including decimal, binary, octal, and hexadecimal systems. It details their representation and conversion techniques, introducing foundational concepts and terminology for computer science and related fields.

Full Transcript

Lesson 1 NUMBER SYSTEM CPE206 – LOGIC CIRCUITS AND DESIGN NUMBER SYSTEM A number system is a writing system used to express numbers. It provides a set of symbols and rules for representing and manipulating quantities. DECIMAL NUMBER SYST...

Lesson 1 NUMBER SYSTEM CPE206 – LOGIC CIRCUITS AND DESIGN NUMBER SYSTEM A number system is a writing system used to express numbers. It provides a set of symbols and rules for representing and manipulating quantities. DECIMAL NUMBER SYSTEM BINARY NUMBER SYSTEM OCTAL NUMBER SYSTEM HEXA DECIMAL NUMBER SYSTEM BINARY CODED DECIMAL (BCD) NUMBER SYSTEM NUMBER SYSTEM DECIMAL NUMBER SYSTEM The decimal number system is also called as Base 10 or a radix (base of a number system) 10. It has 10 symbols or numerals: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. BINARY NUMBER SYSTEM The binary number system has a radix of 2 or base 2. Only number 0 and 1 is accepted. Among all the number systems, the decimal system is the most common for humans, while binary is primarily used in computers. NUMBER SYSTEM BINARY NUMBER SYSTEM When counting up, as Byte – when 8 bits are soon as you count from 0 grouped together to 1, you are out of symbols and must Bit – rather than digits, increment the p + 1 0000 0101 bit is used to describe the individual numbers position in order to Nibble – when 4 bits in binary. represent the next number (e.g., 0, 1, are grouped together 10, 11, 100, 101, …) NUMBER SYSTEM BINARY NUMBER SYSTEM When counting up, as Byte – when 8 bits are soon as you count from 0 grouped together to 1, you are out of symbols and must Bit – rather than digits, increment the p + 1 0000 0101 bit is used to describe the individual numbers position in order to Nibble – when 4 bits in binary. represent the next number (e.g., 0, 1, are grouped together 10, 11, 100, 101, …) NUMBER SYSTEM OCTAL NUMBER SYSTEM Since binary numbers are often very long, two shorthand notations, octal and hexadecimal, are used for representing large binary numbers. Octal systems use a base or radix of 8. It uses digits from 0 to 7. 0, 1, 2, 3, 4, 5, 6, 7. HEXA DECIMAL NUMBER SYSTEM The hexadecimal numbering system operates with a base or radix of 16 and utilizes 16 symbols. It starts with the digits 0 to 9, just like the decimal system, and continues with the letters A, B, C, D, E, and F, which correspond to the values 10, 11, 12, 13, 14, and 15, respectively. NUMBER SYSTEM Base 10 Base 2 Base 8 Base 16 0 0 0 0 1 1 1 1 2 10 2 2 3 11 3 3 4 100 4 4 5 101 5 5 6 110 6 6 7 111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F NUMBER BASE CONVERSION Binary to Decimal Convert: 101.11 (base 2) 2 1 0 -1 -2 1 0 1. 1 1 Value = 1 x 22 + 0 x 21 + 1 x 20 + 1 x 2-1 + 1 x 2-2 Value = 1 x 4 + 0 x 2 + 1 x 1 + 1 x 0.5 + 1 x 0.25 Value = 4 + 0 + 1 + 0.5 + 0.25 Value = 5.7510 NUMBER BASE CONVERSION Octal to Decimal Convert: 17.17 (base 8) 1 0 -1 -2 1 7. 1 7 Value = [1 x 81] + [7 x 80] + [1 x 8-1] + [7 x 8-2] Value = [1 x 8] + [7 x 1] + [1 x 0.125] + [7 x 0.015625] Value = 8 + 7 + 0.125 + 0.109375 Value = 15.23437510 NUMBER BASE CONVERSION Hexadecimal to Decimal Convert: 1AB.EF (base 16) 2 1 0 -1 -2 1 A B. E F Value = [1 x 162] + [A x 161] + [B x 160] + [E x 16-1] + [F x 16-2] Value = [1 x 256] + [A x 16] + [B x 1] + [E x 0.0625] + [F x 0.00390625] Value = 256 + 160 + 11 + 0.0625 + 0.05859375 Value = 427.9335937510 DECIMAL TO BINARY DECIMAL TO OCTAL When converting the fractional component of the number, the algorithm is continued until 4 digits (or the given limit) worth of fractional numerals has been achieved. Once the accuracy has been achieved, the conversion is finished even though a product with a zero fractional value has not been obtained. DECIMAL TO HEXADECIMAL In converting decimal to hexadecimal, when the number is 10 to 15 it should be substituted with hex symbol (A to F) Converting between 2^n Bases Converting between 2^n bases (e.g., 2, 4, 8, 16, etc.) takes advantage of the direct mapping that each of these bases has back to binary. Base 8 numbers take exactly 3 binary bits to represent all 8 symbols (i.e., 08 = 0002 , 78 = 1112 ). Base 16 numbers take exactly 4 binary bits to represent all 16 symbols (i.e., 016 = 00002 , F16 = 11112 ). The whole number bits are grouped into the appropriate-sized sets starting from the radix point and working left. If the final leftmost grouping does not have enough symbols, it is simply padded on left with leading 0’s. BINARY TO OCTAL BINARY TO HEXADECIMAL In converting to binary from any base 2^n, each of the symbols in the originating number are replaced with the appropriate-sized number of bits. An octal symbol will be replaced with 3 binary bits while a hexadecimal symbol will be replaced with 4 binary bits. OCTAL TO BINARY HEXADECIMAL TO BINARY When converting between 2^n bases (excluding binary) the number is first converted into binary and then converted from binary into the final 2 n base using the algorithms described before. OCTAL TO HEXADECIMAL HEXADECIMAL TO OCTAL Lesson 2 BINARY ARITHMETIC CPE206 – LOGIC CIRCUITS AND DESIGN ADDITION (CARRIES) Binary addition is like how we do in decimal addition. The two numbers (or terms) to be added are aligned at the radix point and addition begins at the least significant bit. If the sum of the least significant position yields a value with two bits, then the least significant bit is recorded and the most significant bit is carried to the next higher position. ADDITION (CARRIES) ADDITION (CARRIES) In binary addition, the width of the inputs and output is fixed. Carries that exist within the n-bits are treated in the normal fashion of including them in the next higher position sum; however, if the highest position summation produces a carry, this is a uniquely named event. This event is called a carry out or the sum is said to generate a carry. The reason this type of event is given special terminology is because in real circuitry, the number of bits of the inputs and output is fixed in hardware and the carry out is typically handled by a separate circuit. ADDITION (CARRIES)

Use Quizgecko on...
Browser
Browser