140 likes | 271 Vues
This lecture covers key aspects of computer architecture, focusing on the control unit and microprogrammed control. We delve into the representation of signed integers, exploring binary representation methods such as signed magnitude, 1's complement, and 2's complement. The session includes practical examples of arithmetic operations with signed numbers, highlighting their implementation. Key concepts will be illustrated with an 8-bit word example, demonstrating how to compute negative numbers and perform addition and subtraction with signed values.
E N D
Computer Architecture Lecture 14 FasihurRehman
Last Class • Control Unit • Microprogrammed Control
Today’s Agenda • Arithmetic (Integer) • Representation • Signed numbers • Operations and their implementation
Signed Numbers • Representation Methods • Signed Magnitude • 1’s Complement • 2’s Complement
1’s Complement • – N = (2n -1) - N • where: n is the number of bits per word • N is a positive integer • -N in 1's complement (Negative Number) • For example with an 8-bit word and N = 6, we have: • – N = (28 -1) - 6 = 255 - 6 = 249 = 11111001 • Alternatively • N = +6 = 000001102 • (-N ) = -6 = 111110012 • the values 00000000 and 11111111 both represent zero
2’s Complement • N * = 2n- N • where: n is the number of bits per word • N is a positive integer • N* is -N in 2's complement notation • For example with an 8-bit word and N = 6, we have: N* = 28 - 6 = 256 - 6 = 250 = 11111010 • Alternatively, to take 2's complement is to start at the right and complement each bit to the left of the first "1". • For example: N = +6 = 00000110 • N* = -6 = 11111010
Addition/subtraction of signed numbers x y Carry-in c Sum s Carry-out c i i i i i +1 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 x y c + x y c + x y c + x y c s = = x Å y Å c i i i i i i i i i i i i i i i i y c x c x y c = + + i i i i i i i +1 E xample: x X 7 0 1 1 1 Carry-out Carry-in i y + Y = + 6 = + 0 1 1 0 0 1 1 0 0 c i c i +1 i 13 1 1 0 1 s Z i Legend for stage i
Summary • Arithmetic • Representation • Signed numbers • Operations and their implementation