tailieunhanh - Lecture Computer organization and assembly language - Lecture 02: Data Representation 1

This chapter presents the following content: Data representation, decimal representation, binary representation, two’s complement, hexadecimal representation, floating point representation. | CSC 221 Computer Organization and Assembly Language Lecture 02: Data Representation Lecture 01 Anatomy of a Computer: Detailed Block Diagram Memory Program Storage Data Storage Output Units Input Units Control Unit Datapath Arithmetic Logic Unit (ALU) Registers Common Bus (address, data & control) Processor (CPU) Lecture 01 Levels of Program Code Compilers and Assemblers Lecture Outline Data Representation Decimal Representation Binary Representation Two’s Complement Hexadecimal Representation Floating Point Representation 5 Introduction A bit is the most basic unit of information in a computer. It is a state of “on” or “off” in a digital circuit. Or “high” or “low” voltage instead of “on” or “off.” A byte is a group of eight bits. A byte is the smallest possible addressable unit of computer storage. A word is a contiguous group of bytes Word sizes of 16, 32, or 64 bits are most common. Usually a word represents a number or instruction. 5 Numbering Systems Numbering systems are . | CSC 221 Computer Organization and Assembly Language Lecture 02: Data Representation Lecture 01 Anatomy of a Computer: Detailed Block Diagram Memory Program Storage Data Storage Output Units Input Units Control Unit Datapath Arithmetic Logic Unit (ALU) Registers Common Bus (address, data & control) Processor (CPU) Lecture 01 Levels of Program Code Compilers and Assemblers Lecture Outline Data Representation Decimal Representation Binary Representation Two’s Complement Hexadecimal Representation Floating Point Representation 5 Introduction A bit is the most basic unit of information in a computer. It is a state of “on” or “off” in a digital circuit. Or “high” or “low” voltage instead of “on” or “off.” A byte is a group of eight bits. A byte is the smallest possible addressable unit of computer storage. A word is a contiguous group of bytes Word sizes of 16, 32, or 64 bits are most common. Usually a word represents a number or instruction. 5 Numbering Systems Numbering systems are characterized by their base number. In general a numbering system with a base r will have r different digits (including the 0) in its number set. These digits will range from 0 to r-1 The most widely used numbering systems are listed in the table below: Decimal Binary Hexadecimal Octal Number Systems and Bases Number’s Base “B” B unique values per digit. DECIMAL NUMBER SYSTEM Base 10: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} BINARY NUMBER SYSTEM Base 2: {0, 1} HEXADECIMAL NUMBER SYSTEM Base 16: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} Base 10 (Decimal) Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (10 of them) Example: 3217 = (3 103) + (2 102) + (1 101) + (7 100) A shorthand form we’ll also use: 103 102 101 100 3 2 1 7 Binary Numbers (Base 2) Digits: 0, 1 (2 of them) “Binary digit” = “Bit” Example: 110102 = (1 24) + (1 23) + (0 22) + (1 21) + (0 20) = 16 + 8 + 0 + 2 + 0 = 2610 Choice for machine implementation! 1 = ON / HIGH / TRUE, 0 = OFF / LOW / FALSE Binary Numbers (Base 2) Each digit (bit) .