0% found this document useful (0 votes)
770 views

Digital Logic & Computer Design (Morris Mano) PDF

Uploaded by

nofiya yousuf
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
770 views

Digital Logic & Computer Design (Morris Mano) PDF

Uploaded by

nofiya yousuf
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 624
a roy Digital Logic and Computer Design OS TRA M. MORRIS MANO Professor of Engineering California State University, Los Angeles 9 0537 29 BHANDARKARS' COLLEGE LIBRARY ACEH. No.053721 iii Prentice-Hall of India Pcivate Limiied New Delhi - 110 001 This indian $995, 00 (Original U.S. Edition —HSt8892.00) DIGITAL LOGIC AND COMPUTER DESIGN by M. Morris Mano © 1978 by Prentice-Hall, Inc., Upper Saddle River, New Jersey 07458, U.S.A All rights resetved No part oF this book may be reproduced in any form, by mimeograph or any other means, without permission in writing from the publisher. ISBN-81-203-0417-9 ‘The export rights of this book are vested solely with the publisher. ‘This Eastern Economy Edition is the authorized, complete and unabridged photo-oltset reproduction qTihe latest American edition specially published and priced for sale only in Bangladesh, Burma, Gambodia, China, Fiji, Hong Kong, india, Indonesia, Laos, Malaysia, Nepal, Pakistan, Philippines, Singapore, South Korea, Sti Lanka, Taiwan, Thailand, and Vietnam. Published by Asoke K. Ghosh, Prentice Hall of India Private Limited, M-97, Connaught Giccus, Now Delhi110007 and Printed by Mohan Makhijani at Rekha Printers Private Limited, New Dethi-110020. —>>>EEEEEEEEEEEEE—__ Contents —_————————— PREFACE viii 1 BINARY SYSTEMS 1 Digital Computers and Digital Systems 1 Pinary Numbers 4.” . mber Base Conversion 6 LY “Qctal and Hexadecimal Numbers 9 ~ Gomplements 10 ~ ary Codes 16 -~ Binary Storage and Registers 22 Bifary Logic 25 -—~ 2 Integrated Circuits 30 References 31 Problems 3/ Nooaons on 2 BOOLEAN ALGEBRA AND LOGIC GATES 4 21 Basic Definitions 34 ~ Zz 2-2 Axiomatic Definition of Boolean Algebra “36 2-3 Basic Theorems and Properties - of Boolean Algebra 39 2-4 Boolean Functions 43 ~ a 25 Canonical and Standard Forms “47 2-6 Other Logic Operations a 27 Digital Logic Gates 56 2.8 IC Digital Logic Families 60 References 68 Problems 68 ii iv CONTENTS: 3 SIMPLIFICATION OF BOOLEAN FUNCTIONS 72 3-1 The Map Method 72“ a 3-2 Two- and Three-Variable Maps 72 3-3. Four-Variable Map 77 3-4 Five- and Six-Variable Maps 80 - 3-5 Product of Sums Simplification 83 3-6 | NAND and NOR Implementation 86° 3-7 Other Two-Level Implementations 93” 3-8 Don't-Care Conditions 100 - 3-9 The Tabulation Method 102 3-10 Determination of Prime-Implicants 102 3-11. Selection of Prime-Implicants 108 312 Concluding Remarks 1/0 References 1/2 Problems 1/2 4 COMBINATIONAL LOGIC. 116 44 Introduction 1/6 4-2 Design Procedure 1/7 4-3 Adders 1/9 4-4 Subtractors 123 4-5 Code Conversion 125 4-6 Analysis Procedure 128 47 Multilevel NAND Circuits 132 4-8 Multilevel NOR Circuits /4/ 4-9 Exclusive-or and Equivalence Functions 1/45 References 150 Problems 150 5 COMBINATIONAL LOGIC WITH MSI AND LSI 154 5-1 Introduction 154 5-2 Binary Parallel Adder 155 5-3 Decimal Adder 167 5-4 Magnitude Comparator 1/64 5-5 Decoders 167 5-6 Multiplexers 175 5-7 Read-Only Memory (ROM) 182 5-8 Programmable Logic Array (PLA) 189 5-9 Concluding Remarks 195 References 196 Problems 196 6 SEQUENTIAL LOGIC 202 6-1 Introduction 202 6-2 Flip-Flops 204 6-3 Triggering of Flip-Flops 2/0 6-4 Analysis of Clocked Sequential Circuits 2/7 6-5 State Reduction and Assignment 224 6-6 Flip-Flop Excitation Tables 230 6-7 Design Procedure 233 6-8 Design of Counters 243 6-9 Design with State Equations 247 References 25/ Probiems 252 7 REGISTERS, COUNTERS, AND THE MEMORY UNIT 256 7A Introduction 256 7-2 Registers 257 7-3 Shift Registers 263 7-4 Ripple Counters 272 75 Synchronous Counters 276 7-6 Timing Sequences 284 7-7 The Memory Unit 289 7-8 Examples of Random Access Memories 294 References 300 Problems 307 8 REGISTER TRANSFER LOGIC 305 81 Introduction 305 8-2 Interregister Transfer 308 83 Arithmetic, Logic, and Shift Micro-Operations 3/6 8-4 Conditional Control Statements 32/ 85 Fixed-Point Binary Data 322 8-6 Overflow 327 8-7 Arithmetic Shifts 329 8-8 Decimal Data 331 89 Floating-Point Data 332 8-10 Non-Numeric Data 335 8-11 Instruction Codes 339 8-12 Design of Simple Computer 344 References 352 Problems 352 CONTENTS PROCESSOR LOGIC DESIGN 358 - 9-1 Introduction 358 9-2 Processor Organization 359 9-3 Arithmetic Logic Unit 367 9-4 Design of Arithmetic Circuit 368 9-5 Design of Logic Circuit 376 9-6 Design of Arithmetic Logic Unit 378 9-7 Status Register 32 9-8 Design of Shifter 38¢ 9-9 Processor Unit 386 9-10 Design of Accumulator 39/ References 402 Problems 402 CONTROL LOGIC DESIGN 407 10-1 introduction 407 10-2 Control Organization 409 10-3 Hard-Wired Control. Example 1 415 10-4 — Microprogram Control 424 10-5 Control of Processor Unit 429 10-6 Hard-Wired Control Example 2 432 10-7 PLAControl 443 10-8 Microprogram Sequencer 446 References 453 Problems 453 COMPUTER DESIGN 459 11-1 Introduction 459 11-2 System of Configuration 460 11-3. Computer Instructions 464 11-4 Timing and Control 47/ 11-5 Execution of Instructions 473 11-6 Design of Computer Registers 479 11-7, Design of Control 484 41-8 Computer Console 493 References 494 Problems 495 12 13 MICROCOMPUTER SYSTEM DESIGN 12-1 Introduction 499 12-2 Microcomputer Organization 502 12-3. Microprocessor Organization 506 12-4 Instructions and Addressing Modes 514 12-5 Stack, Subroutines, and Interrupt 523 12-6 — Memory Organization 532 12-7 Input-Output Interface 537 12-8 Direct Memory Access 547 References 557 Problems 552 DIGITAL INTEGRATED CIRCUITS 13-1 Introduction 556 13-2 Bipolar Transistor Characteristics 558 13-3 RTL and DTI. Circuits 562 13-4 _Integrated-Injection Logic (FFL) 565 13-5 — Transistor-Transistor Logic (TTL) 568 13-6 Emitter-Coupled Logic (ECL) 578 13-7 Metal-Oxide Semiconductor (MOS) 580 13-8 Complementary MOS (CMOS) 584 References 586 Problems 586 APPENDIX:—Answers to Selected Problems INDEX CONTENTS vif 499 556 589 606 Preface Digital logic is concerned with the interconnection among digital components and modules and is a term used to denote the design and analysis of digital systems. The best known example of a digital system is the general purpose digital computer. This book presents the basic concepts used in the design and analysis of digital systems and introduces the principles of digital computer organization and design. It provides various methods and techniques suitable for a variety of digital system design applications. It covers all aspects of digital systems from the electronic gate circuits to the complex structure of microcomputer systems. Chapters 1 through 6 present digital logic design techniques from the classical point of view. Boolean algebra and truth tables are used for the analysis and design of combinational circuits and state transition techniques for the analysis and design of sequential circuits. Chapiers 7 through 12 present digital system design methods from the register-transfer point of view. The digital system is decomposed into register subunits and the system is specified with a list of register-transfer state- ments that describe the operational transfers among the information stored in registers. The register-transfer method is used for the analysis and design of processor units, control units, a computer central processor, and for describing the internal operations of microprocessors and microcomputers. Chapter 13 deals with the electronics of digital circuits and presents the most common integrated circuit digital logic families. The components used to construct digital systems are manufactured in integrated circuit form. Integrated circuits contain a large amount of intercon- nected digital circuits within a single small package. Medium scale integration (MSI) devices provide digital functions and large scale integration (LSI) devices provide complete computer modules. It is very important for the logic designer 10 be familiar with the various digital components encountered in integrated circuit form. For this reason, many MSI and LSI circuits are introduced throughout the book and their logical function fully explained. The use of integrated circuits in the design of digital systems is illustrated by means of examples in the text and in problems at the end of the chapters. vith PREFACE ix ‘This book was originally planned as a second edition to the author’s Com- puter Logic Design (Prentice-Hall, 1972). Because of the amount of new material added and the extensive revisions that have taken place, it seems more appropriate to adopt a new title for the present text. About one third of the text is material that appears in the previous book. The other two thirds constitutes new or revised information. The underlying factors for the revisions and additions arise from developments in the digital electronics technology. Great emphasis is given to MSI and LSI circuits and to design methods using integrated circuits. The book covers various LSI components of the bit-slice and microcomputer variety. It presents applications of the read only memory (ROM) and programmable logic array (PLA). Moreover, further developments in the register transfer method of design mandated a complete rewriting of the second half of the book. Chapter 1 presents various binary systems suitable for representing informa- tion in digital components. The binary number system is explained and binary codes are illustrated to show the representation of decimal and alphanumeric information. Binary logic is introduced from an intuitive point of view before proceeding with a formal definition of Boolean algebra. The basic postulates and theorems of Boolean algebra are found in Chapter 2. The correlation between a Boolean expression and its equivalent interconnection of gates is emphasized. All possible logic operations for two variables are investi- gated and from that, the most useful logic gates are derived. The characteristics of digital gates available in integrated circuit form are presented early in this chapter but a more detailed analysis describing the internal construction of the gates is left for the last chapter. Chapter 3 supplies the map and tabulation methods for simplifying Boolean functions. The map method is used to simplify digital circuits constructed with AND, OR, NAND, NOR, and wired-logic gates. The various simplification proce- dures are summarized in tabular form for easy reference. Design and analysis procedures for combinational circuits are provided in Chapter 4. Some basic components used in the design of digital systems, such as adders and code converters, are introduced as, design or analysis examples. The chapter investigates possible implementations using multilevel NAND and NOR combinational circuits. Chapter 5 deals with combinational logic MSI and LSI components. Often used functions such as parallel adders, decoders, and multiplexers are explained, and their use in the design of combinational circuits is illustrated with examples. The read only memory (ROM) and programmable logic array (PLA) are in- troduced and their usefulness in the design of complex combinational circuits is demonstrated. Chapter 6 outlines various methods for the design and analysis of clocked sequential circuits. The chapter stasts by presenting various types of flip-flops and the way they are triggered. The state diagram, state table, and state equations are shown to be convenient tools for analyzing sequential circuits. The design methods Presented transform the sequential circuit to a set of Boolean functions that specify xX PREFACE the input logic to the circuit flip-flops. The input Boolean functions are derived from the excitation table and are simplified by means of maps. In Chapter 7, a variety of registers, shift-registers, and counters similar to those available in integrated circuit packages is presented, The operation of the random access memory (RAM) is also explained. The digital functions introduced in this chapter are the basic building blocks from which more complex digital systems are constructed Chapier 8 introduces the register-transfer method for describing digital sys- tems, It shows how to express in symbolic form the operation sequence among the registers of a digital system. Symbols are defined for interregister transfer, arithmetic, logic, and shift microoperations. The different data types that are stored in computer registers are covered in detail. Some typical examples are used to show how computer instructions are represented in binary coded form and how the operations specified by instructions can be expressed with register-transfer state- ments. The chapter concludes with the design of a very simple computer to demonstrate the register-transfer method of digital system design. Chapter 9 is concerned with the processor unit of digital computers. It discusses alternatives for organizing a processor unit with buses or scratchpad memory. A typical arithmetic logic unit (ALU) is presented and a procedure is developed for the design of any other ALU configuration. Other components commonly found in processors, such as shifters and status registers, are also presented, The design of a general purpose accumulator register is undertaken, starting from a specified set of register-transfer operations and culminating in a logic diagram. Four methods of control logic design are introduced in Chapter 10. Two of the methods constitute a hard-wired control. The other two introduce the concept of microprogramming and how to design a controller with the programmable logic array (PLA). The four methods are demonstrated by means of examples that show the development of design algorithms and the procedure for obtaining the control circuits for the system. The last section introduces an LSI microprogram sequencer and shows how it can be used to design a microprogram control unit. Chapter 1] is devoted to the design of a small digital computer. The registers in the computer are defined and a set of computer instructions is specified. The computer description is formalized with register-transfer statements that specify the microoperations among the registers as well as the control functions that initiate these microoperations. It is then shown that the set of microoperations can be used to design the data processor part of the computer. The control functions in the list of register-transfer statements supply the information for the design of the control unit. The control unit for the computer is designed by three different methods: hard-wired control, PLA control, and microprogram control. Chapter 12 focuses on various LSI components that form a microcomputer system. The organization of a typical microprocessor is described and its internal operation explained. A typical set of instructions for the microprocessor is pre- sented and various addressing modes are explained. The operation of a stack and PREFACE xi the handling of subroutines and interrupts is covered from the hardware point of view. The chapter also illustrates the connection of memory chips to a micro- processor bus system and the operation of various interface units that communicate with input-output devices. It concludes with a description of the direct memory access mode of transfer. Chapter 13 details the electronic circuits of the basic gate in seven integrated circuit logic families. This final chapter should be considered as an appendix and can be omitted if desired. Chapter 13 assumes prior knowledge of basic electronics, but there is no specific prerequisite for the rest of the book. Every chapter includes a set of problems and a list of references. Answers to selected problems appear in the Appendix to provide an aid for the student and to help the independent reader. A solutions manual is available for the instructor from the publisher. The book is suitable for a course in digital logic and computer design in an electrical or computer engineering department. It can also be used in a computer science department for a course in computer organization, Parts of the book can be used in a variety of ways. (f} As a first course in digital logic or switching circuits by covering Chapters ! through 7 and possibly Chapter 13; (2) As a second course in digital computer logic with a prerequisite of a course in basic switching circuits by covering Chapter 5 and Chapters 7 through 12; (3) As an introduction to the hardware of microprocessors and microcomputers by covering Chapters 8 through 12. In conclusion, I would like to explain the philosophy underlying the material presented in this book. The classical method has been predominant in the past for describing the uperations of digital circuits. With the advent of integrated circuits, and especially the introduction of microcomputer LSI components, the classical method seems to be far removed from practical applications. Although the classical method for describing complex digital systems is not directly applicable, the basic concepts of Boolean algebra, combinational logic, and sequential logic procedures, are still important for understanding the internal construction of many digital functions. On the other hand, the register-transfer method provides a better representation for describing the operations among the various modules in digital systems. It is concerned with the transfer of bit strings in parallel and may be considered to be one level higher in the hierarchy of digital system representation. ‘The transition from the classical to the register-transfer method is made in the book by way of integrated circuit MSI functions. Chapters 5 and 7 cover many digital functions which are available in integrated circuits. Their operation is explained in terms of gates and flip-flops that make up the particular digital circuit. Each MSI circuit is considered as a functional unit that performs a particular operation. This operation is then described in the register-transfer method of notation. Thus, the analysis and design of registers and other digital functions is done by means of the classical method but the use of these functions in describing the operations of a digital system is specified by means of register-transfer state- ments, ‘The register-transfer method is then used to define computer instructions, 10 xii PREFACE express digital operations in concise form, to demonstrate the organization of digital computers, and to specify the hardware components for the design of digital systems. I wish to express my thanks to Dr. John L. Fike for reviewing the original manuscript and to Professor Victor Payse for pointing out corrections while teaching a course using the manuscript. Most of the typing was done by Mrs. Lucy Albert and her skilled help is gratefully appreciated. My greatest thanks go to my wife for all the suggestions she made for improving the readability of the text and for her encouragement and support during the preparation of this book. va Moras vw Binary : Systems | 1-1 DIGITAL COMPUTERS AND DIGITAL SYSTEMS Digital computers have made possible many scientific, industrial, and commercial advances that would have becn unattainable otherwise. Our space program would have been impossible without real-time, continuous computer monitoring, and many business enterprises function efficiently only with the aid of automatic data processing. Computers are used in scientific calculations, commercial and business data processing, air traffic control, space guidance, the educational field, and many other areas. The most striking property of a digital computer is its generality. It can follow a sequence of instructions, called a program, that operates on given data. ‘The user can specify and change programs and/or data according to the specific need. As a result of this flexibility, general-purpose digital computers can perform a wide variety of information-processing tasks. The general-purpose digital computer is the best-known example of a digital system. Other examples include telephone switching exchanges, digital voltmeters, frequency counters, calculating machines, and teletype machines. Characteristic of a digital system is its manipulation of discrete elements of information. Such discrete elements may be electric impulses, the decimal digits, the letters of an alphabet, arithmetic operations, punctuation marks, or any other set of meaningful symbols. The juxtaposition of discrete elements of information represents a quan- tity of information. For example, the letters d, 0, and g form the word dog. The digits 237 form a number. Thus, a sequence of discrete elements forms a language, that is, a discipline that conveys information. Early digital computers were used mostly for numerical computations. In this case the discrete elements used are the digits, From this application, the term digital computer has emerged. A more appropriate name for a digital computer would be a “discrete information process- ing system.” Discrete elements of information are represented in a digital system by physical quantities called signals. Electrical signals such as voltages and currents 1 Kg 2 BINARY SYSTEMS On are the most common. The signals in all present-day electronic digital systems have only two discrete values and are said to be binary. The digital-system designer is restricted 10 the use of binary signals because of the lower reliability of many-valued electronic circuits. In other words, a circuit with ten states, using one discrete voltage value for each state, can be designed, but it would possess a very low reliability of operation. In contrast, a transistor circuit that is either on or off has two possible signal values and can be constructed to be extremely reliable. Because of this physical restriction of components, and because human logic tends to be binary, digital systems that are constrained to take discrete values are further constrained to take binary values. Discrete quantities of information emerge either from the nature of the process or may be purposely quantized from a continuous process. For example, a payroll schedule is an inherently discrete process that contains employee names, social security numbers, weekly salaries, income taxes, etc. An employee's paycheck is processed using discrete data values such as letters of the alphabet (names), digits (salary), and special symbols such as $. On the other hand, a research scientist may observe a continous process but record only specific quanti- ties in tabular form. The scientist is thus quantizing his continuous data, Each number in his table is a discrete element of information. Many physical systems can be described mathematically by differential equations whose solutions as a function of time give the complete mathematical behavior of the process. An analog computer performs a direct simulation of a physical system. Each section of the computer is the analog of some particular portion of the process under study. The variables in the analog computer are represented by continous signals, usually electric voltages that vary with time. The signal variables are considered analogous to those of the process and behave in the same manner. Thus measurements of the analog voltage can be substituted for variables of the process. The term analog signal is sometimes substituted for continuous signal because “analog computer” has come to mean a computer that manipulates continuous variables. To simulate a physical process in a digital computer, the quantities must be quantized. When the variables of the process are presented by real-time continuous signals, the latter are quantized by an analog-to-digital conversion device, A physical system whose behavior is described by mathematical equations is simu- lated in a digital computer by means of numerical methods. When the problem 10 be processed is inherently discrete, as in commercial applications, the digital computer manipulates the variables in their natural form. ‘A block diagram of the digital computer is shown in Fig. 1-1. The memory unit stores programs as well as input, output, and intermediate data. The processor unit performs arithmetic and other data-processing tasks as specified by a program. The control unit supervises the flow of information between the various units. The control unit retrieves the instructions, one by one, from the program which is stored in memory. For each instruction, the control unit informs the processor to execute the operation specified by the instruction. Both program and data are Processor [7] Arithmetic Unit Control Unit Storage or Memory Unit Output Devices and Controt and Control Figure 1-1 Block diagram of a digital computer stored in memory. The control unit supervises the program instructions, and the processor manipulates the data as specified by the program. The program and data prepared by the user are transferred into the memory unit by means of an input device such as punch-card reader or a teletypewriter. An output device, such as a printer, receives the result of the computations and the printed results are presented to the user. The input and output devices are special digital systems driven by electromechanical parts and controlled by electronic digital circuits. An electronic calculator is a digital system similar to a digital computer, with the input device being a keyboard and the output device a numerical display. Instructions are entered in the calculator by means of the function keys, such as plus and minus. Data are entered through the numeric keys. Results are displayed directly in numeric’ form. Some calculators come close to resembling a digital computer by having printing capabilities and programmable facilities. A digital computer, however, is a more powerful device than a calculator. A digital com- puter can accommodate many other input and output devices; it can perform not only arithmetic computations but logical operations as well and can be pro- grammed to make decisions based on internal and external conditions. A digital computer is an interconnection of digital modules. To undersjand the operation of each digital module, it is necessary to have a basic knowledge of digital systems and their general behavior. The first half of this book deals with digital systems in general to provide the background necessary for their design. The second half of the book discusses the various modules of the digital computer, their operation and design. The operational characteristics of the memory unit are explained in Chapter 7. The organization and design of the processor unit is 3 Kg 4 BINARY SYSTEMS cH. undertaken in Chapter 9. Various methods for designing the control unit are introduced in Chapter 10. The organization and design of a small, complete digital computer is presented in Chapter II. A processor, when combined with the control unit, forms a component referred to as a central processor unit or CPU. A CPU enclosed in small integrated-circuit package is called a microprocessor. The memory unit, as well as the part that controls the interface between the microprocessor and the input and output devices, may be enclosed within the microprocessor package or may be available in other small integrated-circuit packages. A CPU combined with mem- ory and interface control to form a smiall-size computer is called a microcomputer. The availability of microcomputer components has revolutionized the digital sys- tem design technology, giving the designer the freedom to create structures that were previously uneconomical. The various components of a microcomputer sys- tem are presented in Chapter 12. It has already been mentioned that a digital computer manipulates discrete elements of information and that these elements are represented in the binary form. Operands used for calculations may be expressed in the binary number system. Other discrete clements, including the decimal digits, are represented in binary codes. Data processing is carried out by means of binary logic clements using binary signals. Quantities are stored in binary storage elements. The purpose of this chapter is to introduce the various binary concepts as a frame of reference for further detailed study in the suceeding chapters. 1-2 BINARY NUMBERS. A decimal number such as 7392 represents a quantity equal to 7 thousands plus 3 hundreds, plus 9 tens, plus 2 units. The thousands, hundreds, etc., are powers of 10 implied by the position of the coefficients. To be more exact, 7392 should be written as: 7x 10° +3 x 107 +9x Io! +2 x 10° However, the convention is to write only the coefficients and from their position deduce the necessary powers of 10. In general, a number with a decimal point is represented by a series of coefficients as follows: 5044040, - 00-95 The g, coefficients are one of the ten digits (0, 1, 2, .. -, 9), and the subscript value J gives the place value and, hence, the power of 10 by which the coefficient must be multiplied. 10%, + 10%, + 10’; + 10%; + 10'a, + 10%) + 10-'a_, +10-7a_, + 10-%a_, The decimal number system is said to be of base, or radix, 10 because it uses ten digits and the coefficients are multiplied by powers of 10. The binary system is a SEC.1-2 BINARY NUMBERS 5 different number system. The coefficients of the binary numbers system have two possible values: 0 and 1. Each coefficient a, is multiplied by 2. For example, the decimal equivalent of the binary number 11010.11 is 26.75, as shown from the multiplication of the coefficients by powers of 2: Ix 2eixPsOx Fei xtsoxPe1x2 412°? = 26.75 In general, a number expressed in base-r system has coefficients multiplied by powers of r: Oy yy Pe tay tar tay tartar tte ta, em The coefficients a, range in value from 0 to r — 1, To distinguish between numbers of different bases, we enclose the coefficients in parentheses and write a subscript equal to the base used (except sometimes for decimal numbers, where the content makes it obvious that it is decimal). An example of a base-5 number is: (4021.2), = 4x 940% 942x541 x 5942x571 = (511410 Note that coefficient values for base 5 can be only 0, 1, 2, 3, and 4. It is customary to borrow the needed r digits for the coefficients from the decimal system when the base of the number is less than 10. The letters of the alphabet are used to supplement the ten decimal digits when the base of the number is greater than 10, For example, in the hexadecimal (base 16) number system, the first ten digits are borrowed from the decimal system. The letters A, B, C, D, E, and F are used for digits 10, 11, 12, 13, 14, and 15, respectively. An example of a hexadecimal number is: (BOSF)\g = I x 16° + 6 x 167 + 5 x 16 + 15 = (46687);9 The first 16 numbers in the decimal, binary, octal, and hexadecimal systems are listed in Table 1-1. Arithmetic operations with numbers in base r follow the same rules as for decimal numbers. When other than the familiar base 10 is used, one must be careful to use only the r allowable digits. Examples of addition, subtraction, and multiplication of two binary numbers are shown below: augend: 101101 minuend: 101101 — muitiplicand: 1011 addend: +1001I1 — subtrahend:—100111 — multiplier: x 101 sum: 1010100 difference: 000110 1011 0000 1011 product: 1011 ‘Tame 1-1 Numbers with different bases Decimal Binary Octal Hexadecimal (base 10) {base 2) (base 8) (base 16) 0 0000 00 0 oO 0001 ol L 2 0010 o 2 03 ool! 03 3 oF 0100 4 4 05 0101 05 5 06 Ono 06 6 o7 on 0 7 08 1000 10 a o 1001 iT 9 10 1010 2 A Ww iol 3 B 2 1100 4 c 13 1101 15 D 14 10 16 E F 15 Mi 7 The sum of two binary numbers is calculated by the same rules as in decimal, except that the digits of the sum in any significant position can be only 0 or 1. Any “carry” obtained in a given significant position is used by the pair of digits one significant position higher. The subtraction is slightly more complicated. The rules are still the same as in decimal, except that the “borrow” in a given significant position adds 2 to a minuend digit. (A borrow in the decimal system adds 10 to a minuend digit.) Multiplication is very simple. The multiplier digits are always | or 0. Therefore, the partial products are equal either to the multiplicand of to 0. 1-3. NUMBER BASE CONVERSIONS A binary number can be converted to decimal by forming the sum of the powers of 2 of those coefficients whose value is 1. For example: (1010.011), = 2? + 2! + 27? + 2-7 = (10.375)i9 The binary number bas four I's and the decimal equivalent is found from the sum of four powers of 2. Similarly, a number expressed in base r can be converted to its decimal equivalent by multiplying each coefficient with the corresponding power of rand adding, The following is an example of octal-to-decimal conversion: (630.4) = 6X 8 43X84 4X8! = (408.5);0 SEC.1-9 NUMBER BASE CONVERSIONS 7 The conversion from decimal to binary or to any other base-r system is more convenient if the number is separated into an integer part and a fraction part and the conversion of cach part done separately. The conversion of an integer from decimal to binary is best explained by example. SAMPLE I-I: Convert decimal 41 to binary. First, 41 is divided by 2 to give an integer quotient of 20 and a remainder of }. ‘The quotient is again divided by 2 to give a new quotient and remainder. This process is continued until the integer quotient be- comes 0. The coefficients of the desired binary number ate obtained from the remainders as follows: quant remainder t= 20 + ; ae 10 + 0 x. 5 + 0 Bae | ze + 0 jo + answer: (Al)9 = (@544@230 4), = (101001)y coefficient a= a,=0 a,=1 The arithmetic process can be manipulated more conveniently as follows: integer remainder al 1 0 0 1 0 1 101001 = answer 20 10 5 2 ' 0 The conversion from decimal integers to any base-r system is similar to the above example, except that division is done by r instead of 2. ys 8 BINARY SYSTEMS cH. EXAMPLE 1-2: Convert decimal 153 to octal. The required base r is 8. First, 153 is divided by 8 to give an integer quotient of 19 and a remainder of 1. Then 19 is divided by 8 to give an integer quotient of 2 and a remainder of 3, Finally, 2 is divided by 8 to give a quotient of 0 and a remainder of 2. This process can be con- veniently manipulated as follows: 153 9] a 2\3 of 2 =a3n, ‘The conversion of a decimal fraction to binary is accomplished by a method similar to that used for integers. However, multiplication is used instead of division, and integers are accumulated instead of remainders. Again, the method is best explained by example. EXAMPLE 1-3: Convert (0.6875)yo o binary. First, 0.6875 is multiplied by 2 to give an integer and a fraction. The new fraction is multiplied by 2 to give a new integer and a new fraction. This process is continued until the fraction becomes 0 or until the number of digits have sufficient accuracy. The coefficients of the binary number are obtained from the integers as follows: traction coefficient 03790 “ay=1 07500 a_2=0 05000 a.y=1 0.0000 a_4=t eee answer: (0.6879)ip = (0.4 yaya); = (0-1011)> To convert a decimal fraction to number expressed in base r, a similar procedure is used. Multiplication is by r instead of 2, and the coefficients found from the integers may range in value from 0 to r ~ | instead of O and I. EXAMPLE 1-4: Convert (0.513) to octal. 0.513 x 8 = 4.104 0.104 x 8 = 0.832 0.832 x 8 = 6.656 0.656 x 8 = 5.248 0.248 x 1.984 0.984 X 8 = 7.872

You might also like