京都大学 情報学研究科 通信情報システム専攻 2021年8月実施 専門基礎A [A-7]
Author
Description
下記のすべての問に答えよ。
(1)
2進表現について、以下の問に答えよ。
(a) 次の10進数を 8 ビットの 2 の補数表現で表せ。
- (i) +80
- (ii) -48
(b) 次の 8 ビットの 2 の補数表現の 2 進数を 8 ビットの符号付き絶対値表現に変換せよ。
- (i) 10111000
- (ii) 11000111
(c) 次の 8 ビットの符号付き絶対値表現の 2 進数体系での加算および減算の結果を示せ。
- (i) 10111000 + 11000111
- (ii) 10111000 - 11000111
(d) 次の 8 ビットの 2 の補数表現の 2 進数体系での加算および減算の結果を示せ。
- (i) 10111000 + 11000111
- (ii) 10111000 - 11000111
(e) 2 の補数表現の 2 進数の符号拡張について説明せよ。
(2)
命令やデータのメモリ内での配置における整列化制約について説明せよ。
(3)
以下の同じ命令セットアーキテクチャの三つのプロセッサにおいて、実行命令数が 10,000,000 で、そのうち 10% が条件分岐命令であるプログラムを実行した場合の計算時間を求めよ。条件分岐命令の 60% で条件が成立するものとする。
(a) クロック・サイクル時間が 2ns の単一サイクル方式のプロセッサ。
(b) クロック・サイクル時間が 500ps の 5 段パイプライン方式のプロセッサ。
ただし、条件分岐命令で条件が成立した場合、1 サイクルストールする。
(c) クロック・サイクル時間が 400ps の 8 段パイプライン方式のプロセッサ。
ただし、条件分岐命令で条件が成立した場合、2 サイクルストールする。
Kai
(1)
(a)
- (i) +80:
. Since it is positive, the representation is 01010000. - (ii) -48:
. To get two's complement, invert bits (11001111) and add 1. Result: 11010000.
(b)
- (i) 10111000: The MSB is 1 (negative). In two's complement, the magnitude is found by inverting (01000111) and adding 1, which is
. Signed-magnitude is 11001000. - (ii) 11000111: The MSB is 1 (negative). Inverting (00111000) and adding 1 gives
. Signed-magnitude is 10111001.
(c)
- (i) Addition:
. Binary: 11111111. - (ii) Subtraction:
. Binary: 00001111.
(d)
- (i) Addition: 10111000 + 11000111 = 101111111 Truncating to 8 bits: 01111111 (Note: Overflow occurred as -72 + (-57) = -129, which exceeds 8-bit range).
- (ii) Subtraction: 10111000 - 11000111 = 10111000 + 00111001 = 11110001 (Value: -15)
(e)
Sign extension is the operation of increasing the number of bits of a binary number while preserving its signed value. This is achieved by replicating the most significant bit (the sign bit) into the new higher-order positions. For example, extending the 4-bit two's complement
(2)
Alignment constraints require that data of size
Implementation Reason: Many processor architectures fetch data in fixed-size blocks (e.g., 32 or 64 bits); if data is misaligned, the processor might require two memory accesses and additional bit-shifting logic to retrieve a single data element, significantly degrading performance or causing hardware exceptions.
(3)
Parameters:
- Total instructions
- Branch instructions
- Non-branch
- Branch taken rate
(a)
Every instruction takes 1 cycle.
(b)
Base
- Penalty cycles =
- Total cycles =
(c)
Base
- Penalty cycles =
- Total cycles =