京都大学 情報学研究科 通信情報システム専攻 2020年8月実施 専門基礎A [A-7]
Author
Description
Answer all the following questions.
(1) Answer the following questions on the binary number representation.
(a) Express the following decimal numbers in the 8-bit two’s complement representation.
(i) +88 (ii) −72
(b) Convert the following 8-bit two’s complement binary numbers into the 8-bit sign-and-magnitude binary representation.
(i) 10101010 (ii) 11010101
(c) Show the results of the following additions and subtractions in the 8-bit sign-and-magnitude binary number system.
(i) 00101010 + 10101011 (ii) 10101010 + 10101010
(iii) 11010101 − 01010101 (iv) 10101011 − 10101010
(d) Show the result of the following multiplication of 8-bit two’s complement binary numbers in the 16-bit two’s complement binary representation.
01110111 × 10001000
(2) Explain the procedure of addition of floating-point numbers
(3) Explain ‘data addressing modes’ in processors.
题目描述
回答全部问题。
- 关于二进制数表示:
- 将下列十进制数写成 8 位二进制补码: (i) ;(ii) 。
- 将下列 8 位补码转换为 8 位原码(符号—数值表示):
(i)
10101010;(ii)11010101。 - 在 8 位原码体系中给出下列加减运算结果:
(i)
00101010 + 10101011; (ii)10101010 + 10101010; (iii)11010101 − 01010101; (iv)10101011 − 10101010。 - 将两个 8 位补码数
01110111 × 10001000的乘积写成 16 位补码。
- 说明浮点数加法的步骤。
- 说明处理器中的“数据寻址方式”。
Kai
(1)
(a)
- (i) +88: 01011000
- (ii) −72: . Two’s complement: invert 10110111, add 1 10111000
(b)
- (i) 10101010: Negative. Magnitude: invert 01010101, add 1 01010110 (86). Sign-and-magnitude 11010110
- (ii) 11010101: Negative. Magnitude: invert 00101010, add 1 00101011 (43). Sign-and-magnitude 10101011
(c)
- (i) 00101010 + 10101011: 10000001
- (ii) 10101010 + 10101010: 11010100
- (iii) 11010101 − 01010101: . Since , it results in overflow.
- (iv) 10101011 − 10101010: 10000001
(d)
Multiply 01110111 (+119) and 10001000 (-120):
- Product:
- Magnitude:
- Two’s complement for -14280: invert 1100100000110111, add 1 1100100000111000
Result: 1100100000111000
(2)
- Unpack: Extract sign, exponent, and significand.
- Align: Shift significand of the smaller-exponent number until exponents match.
- Add/Subtract: Perform operation on significands based on signs.
- Normalize: Shift result to standard form and adjust exponent.
- Round: Round the significand to the available precision.
- Check: Verify exceptions (overflow, underflow, zero).
(3)
Addressing modes define how instructions locate operands:
- Immediate/Implied: Operand is constant within the instruction or implied by the opcode.
- Register: Operand is stored in a CPU register.
- Direct/Indirect: Address is directly in instruction, or instruction points to a pointer in memory.
- Register Indirect: A register holds the memory address (pointer).
- Indexed/Offset: Effective address = Base + Index or Base + Constant offset (common for arrays/stacks).
- PC-relative: Address is an offset from the Program Counter (used for branches).
- Auto-inc/dec: Register indirect with automatic address update before/after access.