Вы находитесь на странице: 1из 3

KT14203- Computer Architecture and Organization

Sekolah Kejuruteraan dan Teknologi Maklumat

QUIZ #5

1. Given x = -7 and y = -5. Find the twos complement notation of x and y, then
compute the product x x y with Booths Algorithm using 4-bit words.
(11 marks)

Answer:

X = -7 = 0111=1000+1=1001=M [1]
Y= -5 = 0101=1010+1 =1011= Q [1]
A Q Q-1 M
0000 1011 0 1001 Initial [1]
0111 1011 0 0+0111 Subtract [1]
0011 1101 1 Shift [1]
0001 1110 1 Shift [1]
1010 1110 1 0001+1001 Add [1]
1101 0111 0 Shift [1]
0100 0111 0 1101+0111 Subtract [1]
0010 0011 1 Shift [1]

-7x-5= 00100011 = 35 [1]

Semester 2 2013/2014 Page 1


KT14203- Computer Architecture and Organization

2. Consider a hypothetical machine as depicted in Figure 1. Table 1


lists the opcodes (in hexadecimal) for your machine.
(9 marks)

opcode address
1 Load AC from memory
0 7 23 5 Subtract AC from memory
2 Store AC to memory
magnitude Table 1
0 1 23

Instruction and integer format

Figure 1
Show the program execution (step by step) based on Figure 2.

Memory CPU Registers

PC
1500
1500 014002

AC
1501 054003
IR
1502 024001

: :

4001 000000

00000A
4002

00000F
4003

Figure 2

Semester 2 2013/2014 Page 2


KT14203- Computer Architecture and Organization

Answer:

0.5 mark each for bold fonts. Total is 18 x 0.5 = 9 marks

1500 014002 1500 PC 1500 014002 1501 PC

1501 054003 000000 AC 1501 054003 00000A AC

1502 024001 014002 IR 1502 024001 014002 IR

4001 000000 4001 000000

4002 00000A 4002 00000A

4003 00000F 4003 00000F


Step 1 Step 2

1500 014002 1501 PC 1500 014002 1502 PC

1501 054003 00000A AC 1501 054003 000005 AC

1502 024001 054003 IR 1502 024001 054003 IR

4001 000000 4001 000000

4002 00000A 4002 00000A

4003 00000F 4003 00000F


Step 3 Step 4

1500 014002 1502 PC 1500 014002 1503 PC

1501 054003 000005 AC 1501 054003 000005 AC

1502 024001 024001 IR 1502 024001 024001 IR

4001 000000 4001 000005

4002 00000A 4002 00000A

4003 00000F 4003 00000F


Step 5 Step 6

Semester 2 2013/2014 Page 3

Вам также может понравиться