Computer Architecture Part V Arithmetic Algorithms and Memory

24 Slides1.02 MB

Computer Architecture Part V Arithmetic Algorithms and Memory Address Map Department of Computer Science, Faculty of Science, Chiang Mai University

Outline Signed-Magnitude Addition and Subtraction Multiply Operation Memory Address Map for Microprocessor 204231: Computer Organization and Architecture 2

Hardware for Signed-Magnitude Addition and Subtraction It consists of register A and B and sign flip-flop As and Bs. Subtraction is done by adding A to the 2’s complement of B. The output carry is transferred to flip-flop E, where it can be checked to determine the relative magnitudes of the two numbers. The add-overflow flip-flop AVF holds the overflow bit when A and B are added. 204231: Computer Organization and Architecture 3

Hardware for Signed-Magnitude Addition and Subtraction The addition of A plus B is done through the parallel adder. The S (sum) output of the adder is applied to the input of the A register. The complementer provides and output of B or the complement of B depending on the state of the mode control M. 204231: Computer Organization and Architecture 4

Hardware for Signed-Magnitude Addition and Subtraction When M 0, the output of B is transferred to the adder, the input carry is 0, and the output of the adder is equal to the sum A B. When M 1, the 1’s complement of B is applied to the adder, the input carry is 1, and output S A B 1 A – B. 204231: Computer Organization and Architecture 5

Hardware for Signed-Magnitude Addition and Subtraction 204231: Computer Organization and Architecture 6

Hardware Implementation A and B are registers. AS and BS are sign flip-flops. E is an output carry flip-flop. EA is a register that combines E and A. AVF is an add-overflow flip-flop. S is sum. M is mode control. M 0, A B 0 A B M 1, A B̅ 1 A – B 204231: Computer Organization and Architecture 7

Multiplication Algorithm 204231: Computer Organization and Architecture 8

Hardware for Multiply Operation The multiplier is stored in the Q register and its sign in Qs. The sequence counter SC is initially set to a number equal to the number of bits in the multiplier. The counter is decremented by 1 after forming each partial product. When the content of the counter reaches zero, the product is formed and the process stops. 204231: Computer Organization and Architecture 9

Hardware for Multiply Operation Initially, the multiplicand is in register B and the multiplier in Q. The sum of A and B forms partial product which is transferred to the EA register. Both partial product and multiplier are shifted to the right. The 0 is shifted into E. 204231: Computer Organization and Architecture 10

Hardware for Multiply Operation After the shift, one bit of the partial product is shifted into Q, pushing the multiplier bits one position to the right. In this manner, the rightmost flip-flop in register Q, designated by Qn, will hold the bit of the multiplier, which must be inspected next. 204231: Computer Organization and Architecture 11

Hardware for Multiply Operation 204231: Computer Organization and Architecture 12

Numerical Example for Binary Multiplier 204231: Computer Organization and Architecture 13

Main Memory RAM is used for storing the bulk of the programs and data that are subject to change. ROM is used for storing programs that are permanently resident in the computer and for tables of constants that do not change in value once the production of the computer is completed. 204231: Computer Organization and Architecture 14

Typical RAM chip The capacity of the memory is 128 words of eight bits (one byte) per word. This requires a 7-bit address and an 8-bit bidirectional data bus. The read and write inputs specify the memory operation and the two chips select (CS) control inputs are for enabling the chip only when it is selected by the microprocessor. 204231: Computer Organization and Architecture 15

Typical RAM chip The function table listed in slide number 31 specifies the operation of the RAM chip. The unit is in operation only when CS1 1 and CS2 0. If the chip select inputs are not enabled, or if they are enables but the read or write inputs are not enabled, the memory is inhibited and its data bus is in a high-impedance state. 204231: Computer Organization and Architecture 16

Typical RAM chip 204231: Computer Organization and Architecture 17

Typical ROM chip 204231: Computer Organization and Architecture 18

Memory Address Map for Microprocessor The component column specifies whether a RAM or a ROM chip is used. The hexadecimal address column assigns a range of hexadecimal equivalent addresses for each chip. The small x’s under the address bus lines designate those lines that must be connected to the address inputs in each chip. 204231: Computer Organization and Architecture 19

Memory Address Map for Microprocessor The RAM chips have 128 bytes and need seven address line. The ROM chip has 512 bytes and needs 9 address line. We choose bus lines 8 and 9 to represent four distinct binary combinations. Note that any other pair of unused bus lines can be chosen for this purpose. 204231: Computer Organization and Architecture 20

Memory Address Map for Microprocessor The distinction between a RAM and ROM address is done with another bus line. Here we choose line 10 for this purpose. The equivalent hexadecimal address for each chip is obtained from the information under the address bus assignment. 204231: Computer Organization and Architecture 21

Memory Address Map for Microprocessor The address bus lines are subdivided into groups of four bits each so that each group can be represented with a hexadecimal digit. The x’s represent a binary number that can range from an all-0’s to an all-1’s value. 204231: Computer Organization and Architecture 22

Memory Address Map for Microprocessor 204231: Computer Organization and Architecture 23

Reference M. Moris Mano, Computer System Architecture, 3rd ed. NJ: Prentice Hall, 1992. 204231: Computer Organization and Architecture 24

Back to top button