Class Notes of CSCI 370 Computer Architecture (Spring 2025) =========================================================== Slide 16.11.1 ------------- 1 / (0.66 * 10**(-9) sec/cycle) = 1.515 * 10**9 cycles/sec AMAT = Time for a hit + Miss rate × Miss penalty = 0.66 ns + 0.053 * 50 ns = 3.31 ns Total CPI = 1 + (0.053 * 0.42 * 50 ns) / ( 0.66 ns/cycle ) = 2.69 cycles/inst AMAT = Time for a hit + Miss rate × Miss penalty = 0.66 + 0.053*9.32 ns + 0.053*0.63*50 ns = 2.82 ns Total CPI = 1 + (0.053 * 0.42 * 9.32 ns) / ( 0.66 ns/cycle ) + (0.053 * 0.42 * 0.63 * 50 ns) / ( 0.66 ns/cycle ) = 1 + 0.314 + 1.062 = 2.376 cycles/inst Slide 16.10 ----------- Execution timeY / Execution timeX = T (1) / T (2) = 9 cycles/inst / 3.4 cycles/inst = 2.6 100*10**(-9) sec * 4*10**9 cycles/sec = 400 cycles T(1) = 1 cycles/inst + 0.02*400 cycles/inst = 9 cycles/inst 5*10**(-9) sec * 4*10**9 cycles/sec = 20 cycles T(2) = 1 cycles/inst + 0.02 * 20 + 0.005 * 400 = 3.4 Slide 16.8 ---------- Assuming a cache of 4096 blocks, a 4-word block size, and a 32-bit address, find (i) the total number of sets and (ii) the total number of tag bits: Slide 16.8.4 ------------ Fully associative cache: tag index offset --- ----- ------ 28 0 4 sets = 1 = 2**0 tags = 32 - 0 - 4 = 28 bits tag bits = 1 * 4096 * 28 = 114688 bits Slide 16.8.3 ------------ 4-way set associative cache: tag index offset --- ----- ------ 18 10 4 sets = 4096 / 4 = 1024 = 2**10 tags = 32 - 10 - 4 = 18 bits tag bits = 1024 * 4 * 18 = 73728 bits Slide 16.8.2 ------------ 2-way set associative cache: tag index offset --- ----- ------ 17 11 4 sets = 4096 / 2 = 2048 = 2**11 tags = 32 - 11 - 4 = 17 bits tag bits = 2048 * 2 * 17 = 69632 bits Slide 16.8.1 ------------ Direct-mapped cache: tag index offset --- ----- ------ 16 12 4 4096 = 2**12 sets offset = 2*4 = 16 bytes tag = 32 - 12 - 4 = 16 4096 x 16 = 2**12 x 2**4 = 2**16 tag bits Slide: 16.3 ----------- CPU times = Instruction count × CPI × Clock cycle time T = I x CPI x (cycle time) Execution timeY / Execution timeX = T (with stall) / T (without stall) = I x CPI (with) x (cycle time) / I x CPI (out) x (cycle time) = CPI (with) / CPI (out) = ? / 1.5 = (1.5 + 2 + 1) / 1.5 = 3 I x 0.02 x 100 = 2 x I cycles => 2 cycles / inst I x 0.2 x 0.05 x 100 = I cycles => 1 cycles / inst Slide: 16.2 ----------- AMAT = Time for a hit + Miss rate × Miss penalty = 2 ns + 0.05 x 20 cycles / (2 ns / cycle) = 2 ns + 2 ns = 4 ns Slide: 15.11 ------------ address (32 bits): tag | index | offset 22 | 6 | 4 2**4 = 16 bytes / (4 bytes/word) = 4 words 2**6 = 64 blocks Slide: 15.10.3 -------------- Assume a direct-mapped cache has the features: (i) 64 KiB cache data size, (ii) 1-word cache block size, and (iii) a 32-bit byte-addressed cache reference. 2**n * (2**m*32+31-n-m) = 2**14 * (1*32+31-14-0) = 2**4 * 49 Kibibits = 784 Kibibits n = 14 m = 0 because 1 = 2**0 64 * 2**10 bytes / ( 4 bytes / block) = 16 * 2**10 blocks = 2**14 blocks Slide: 15.10.1 -------------- address (32 bits): tag | index | offset 28 | 4 | 0 Slide: 15.7.2 ------------- 1600 / 16 = 100; R = 0 100 / 16 = 6; R = 4 6 / 16 = 0; R = 6 1600(10) = 640(16) = 0000 0000 0000 0000 0000 01 | 10 010 | 0 0000 Slide: 15.7.1 ------------- 01FFF8AC = 0000 0001 1111 1111 1111 1000 1010 1100 offset = 4 bits since 2**4 = 16 bytes index = 8 bits since 2**8 = 256 blocks tag = 20 bits since 20 = 32 - 8 - 4 offset = 1100 = 12 index = 1000 1010 = 8A tag = 0000 0001 1111 1111 1111 = 01FFF Slide: 15.6 ----------- How many total bits are required for a direct-mapped cache with 4 KiB of data and 2-word blocks, assuming a 32-bit byte address? 2**n * (2**m*32+31-n-m) = 2**9 * (2**1*32+31-9-1) = 2**9 * 85 = 42.5 * 2**10 = 42.5 Kibibits m = 1 n = 9 4 * 2**10 = 4 KiB # of blocks = 4 KiB / 2*4 bytes = (4*2**10)/(2*4) = 2**9 Slide: 14.19 ------------ 00 -- 01 11 -- 10 # taken (1-bit) = 0 # taken (2-bit) = 00 for ( i = 0; i < 100; i++ ) { # taken (1-bit) = 1 # taken (2-bit) = 00 $4 = $5 - $6 .... } # taken (1-bit) = 0 # taken (2-bit) = 10 $1 = $2 + $3 beq $t1, $t2, offset # if ( $t1 == $t2 ) goto offset $6 = $7 * $8 offset: $9 = $10 / $11 HW #3 ----- A => 13 (10 + 3) bits Normalization Rounding => 13 bits B => 13 (10 + 3) bits Normalization Rounding => 13 bits C => 13 (10 + 3) bits Normalization Rounding => 13 bits A x B => 26 (13 + 13) bits => 13 (10 + 3) bits Normalization Rounding => 13 bits A x B - C => 13 (10 + 3) bits Normalization Rounding => 10 bits No overflow or underflow beq $t1, $t2, offset # branch if $t1 == $t2 # branch if rs == rt lw $t1, offset($t2) # $t1=mem[[$t2]+offset] # rt=mem[ [rs]+offset] 1111 1111 1111 1111 = -1 1111 1111 1111 1111 1111 1111 1111 1111 = -1 (sign-extended) 1111 1111 1111 1111 = -1 0000 0000 0000 0000 1111 1111 1111 1111 > 0 (zero-extended) 0000 0000 0000 0001 = 1 0000 0000 0000 0000 0000 0000 0000 0001 = 1 add $t1, $t2, $t3 # $t1 = $t2 + $t3 # rd = rs + rt Tuesday, April 01, 2025 ----------------------- 0001 00 = 4 0010 00 = 8 0011 00 = 12 0100 00 = 16 .... Thursday, March 27, 2025 ------------------------ Slide: 10.18 ------------ 1 5 10 S E F 2**5 = 32 - 2 = 30 / 2 = 15 1 - 15 = -14 30 - 15 = 15 Slide: 10.14 ------------ Step 1. Calculating the exponent of the product (-1) + (-2) = -3 Step 2. Multiplying the significands 1.010 x 1.110 ------------ 0000 1010 1010 + 1010 ------------ 10001100 => -10.001100 x 2**(-3) Step 3. Normalizing the product -10.001100 x 2**(-3) => -1.0001100 x 2**(-2) Step 4. Rounding the significand -1.0001100 x 2**(-2) => -1.001 x 2**(-2) Step 5. Checking for overflow or underflow No overflow or underflow Wednesday, March 26, 2025 ------------------------- Slide: 10.11 ------------ Step 1. Making exponents of two operands equal 1.000 x 2**(-3) = 0.00001 x 2**2 Step 2. Adding or subtracting the significands 01.000 x 2**2 10.111 x 2**2 + 1 ------------------ 11.000 x 2**2 + 00.00001 x 2**2 ------------------ 11.00001 x 2**2 Step 3. Normalizing the result 11.00001 x 2**2 00.11110 x 2**2 + 1 ----------------- -00.11111 x 2**2 -00.11111 x 2**2 = -1.1111 x 2**1 Step 4. Rounding the significand -1.1111 x 2**1 => -10.000 x 2**1 Step 3. Normalizing the result -10.000 x 2**1 = -1.000 x 2**2 Step 4. Rounding the significand -1.000 x 2**2 Step 5. Checking for overflow or underflow No overflow or underflow Slide: 10.10 ------------ Step 1. Making exponents of two operands equal 1.011 x 2**(-3) = 0.01011 x 2**(-1) Step 2. Adding or subtracting the significands 1.111 x 2**(-1) + 0.01011 x 2**(-1) -------------------- 10.00111 x 2**(-1) Step 3. Normalizing the result 10.00111 x 2**(-1) = 1.000111 x 2**0 Step 4. Rounding the significand 1.000111 x 2**0 = 1.001 x 2**0 Step 5. Checking for overflow or underflow No overflow or underflow Tuesday, March 25, 2025 ----------------------- Slide: 10.5.6.2 --------------- -5 < -3 254 - 127 = 127 Slide: 10.5.6.1 --------------- 0 11111110 1111111111111111111 ... (-1)**0 × (1.111111111...) × 2**(254-127) ~ 2 x 2**127 = 2**128 0 1111111110 1111111111111111111111111... (-1)**0 × (1.111111111...) × 2**(2046-1023) ~ 2 x 2**1023 = 2**1024 Slide: 10.5.2 ------------- 0.8125 x 2 = 1.6250 => 1 0.6250 x 2 = 1.2500 => 1 0.2500 x 2 = 0.5000 => 0 0.5000 x 2 = 1.0000 => 1 6 => 110 6.8125 => 110.1101 -6.8125 = -1.101101 x 2**2 exponent = 2 + 127 (bias) = 129 = 128 + 1 = 2**7 + 1 => 10000001 1 10000001 101101 00000000000... exponent = 2 + 1023 (bias) = 1025 = 1024 + 1 = 2**10 + 1 => 10000000001 1 10000000001 101101 00000000000... Monday, March 24, 2025 ---------------------- Slide: 10.5.1 ------------- Sign = 1 < 0 Exponent = 01111111000 = 8 + 16 + 32 + 64 + 128 + 256 +512 = 1016 val(E) = 1016 - 1023 = -7 Significand = 1.100 = 1 + 2**(-1) = 1.5 (-1)**S × (1.F)_2 × 2**val(E) = (-1)**1 x (1.1) x 2**(6) = -1.5 x 2**(-7) = -0.01171875 Slide: 10.4.3 ------------- Sign = 0 > 0 Exponent = 10000000101 = 5 + 2**10 = 1029 val(E) = 1029 - 1023 = 6 Significand = 1.0010101 = 1 + 2**(-3) + 2**(-5) + 2**(-7) = 1+(1/8)+(1/32)+(1/128) = 1.164 (-1)**S × (1.F)_2 × 2**val(E) = (-1)**0 x (1.0010101) x 2**(6) = 1.164 x 64 = 74.50 Slide: 10.4.2 ------------- Sign = 0 > 0 Exponent = 10000010 = 2 + 128 (2**7) = 130 val(E) = 130 - 127 = 3 Significand = 1.010011 = 1 + 2**(-2) + 2**(-5) + 2**(-6) = 1+(1/4)+(1/32)+(1/64) = 1 + (16+2+1) / 64 = (64+16+2+1)/64 = 1.2969 (-1)**S × (1.F)_2 × 2**val(E) = (-1)**0 x (1.010011) x 2**(3) = 1.2969 x 8 = 10.375 Slide: 10.4.1 ------------- Sign = 1 < 0 Exponent = 01111100 = 4 + 8 + 16 + 32 + 64 = 124 val(E) = 124 - 127 = -3 Significand = 1.01 = 1 + 2**(-2) = 1+1/4 = 1.25 (-1)**S × (1.F)_2 × 2**val(E) = (-1)**1 x (1.01) x 2**(-3) = -1 x 1.25 x 1/8 = -0.15625 Wednesday, March 19, 2025 ------------------------- Slide: 8.11 ----------- 1110 ÷ 0011 = 14 / 3 => Q: 4 => 0100 R: 2 => 0010 0010 - 0011 1100 + 1 ------ 1101 + 0010 ------ 1111 0001 - 0011 1100 + 1 ------ 1101 + 0001 ------ 1110 0011 - 0011 1100 + 1 ------ 1101 + 0011 ------ 1 0000 0001 - 0011 1100 + 1 ------ 1101 + 0001 ------ 1110 Slide: 8.10 ----------- 1110 ÷ 0011 = 14 / 3 => Q: 4 => 0100 R: 2 => 0000 0010 00000010 - 00000011 11111100 + 1 ---------- 11111101 + 00000010 ---------- 11111111 00000010 - 00000110 11111001 + 1 ---------- 11111010 + 00000010 ---------- 11111100 00001110 - 00001100 11110011 + 1 ---------- 11110100 + 00001110 ---------- 1 00000010 00001110 - 00011000 11100111 + 00000001 ---------- 11101000 + 00001110 ---------- 11110110 Tuesday, March 18, 2025 ----------------------- Slide: 8.5/6 ------------ 1100 + 0111 ------- 10011 1100 × 1101 = 10011100 => 12 x 13 = 156 10011100 = 4 + 8 + 16 + 128 = 156 01100000 + 00111100 ---------- 10011100 00110000 + 00001100 ---------- 00111100 Slide: 8.2.2 ------------ $a0: 7FFFFFFF => 7: 0111 > 0 + 1 > 0 --------------- 80000000 => -2**31 = -2147483648 Slide: 8.2.1 ------------ $a0: 7FFFFFFF => 7: 0111 > 0 + 1 > 0 --------------- 80000000 < 0 Monday, March 17, 2025 ---------------------- Slide: 7.5 ---------- 123450 => 543210 $t1: ^ $t0: 0 $t1: 0 - |0| |1| |2| |3| |4| |5| A => B => C => D Slide: 7.3.2 ------------ 5 + 4 + 3 + 2 + 1 = 15 n: 5 $t0: 5 $t1: 0 ans: 15 Thursday, March 06, 2025 ------------------------ Slide: 7.3.1 ------------ 5 + 4 + 3 + 2 + 1 = 15 n: 5 $t0: 0 $t1: 15 ans: 15 Slide: 6.13.3 ------------- 0 1 1 2 3 5 8 0 1 1 2 3 $t0: 0 $a0: 5 $t1: 8 $t2: 0 L1: $t2 = $t0 > 0 if ( $t2 == 0 ) goto L2 put $a0 $t2 = $t1 + $a0 $a0 = $t1 $t1 = $t2 $t0 = $t0 - 1 goto L1 L2: Slide: 6.13.2 ------------- $t0: -1 => FFFF FFFF if ( $t0 > 0 ) $t1 = 1; else $t1 = 0; if ( $t1 <> 0 ) put 2 else put 1 Slide: 6.13.1 ------------- $t0: -1 if ( $t0 > 0 ) $t1 = 1; else $t1 = 0; if ( $t1 <> 0 ) put 2 else put 1 Wednesday, March 05, 2025 ------------------------- Slide: 6.12.3 ------------- 1 + 2 + 3 + 4 + 5 = 15 5 + 4 + 3 + 2 + 1 = 15 $v0: 5 $a0: 0 L1: for ( $v0 = 5; $t0==0; --$v0 ) { if ( $v0 < 1) $t0 = 1 else $t0 = 0 $a0 := $a0 + $v0; } L2: Slide: 6.12.2 ------------- lb $t0, 0xFF $t0: -1 if ( $t0 <> -1 ) $t0 = 1 else $t0 = 0 if ( $t0 == 0 ) put 2 else put 1 Slide: 6.12.1 ------------- li $t0, 0xFF $t0: 255 $t1: -1 if ( $t0 == $t1 ) $t0 = 1 else $t0 = 0 if ( $t0 == 0 ) put 2 else put 1 Slide: 6.10.3 ------------- lb $t0, FF $t0: 0000 0000 => 0000 00FF => 0000 0000 0000 0000 0000 0000 1111 1111 => 1111 1111 1111 1111 1111 1111 1111 1111 0000 0000 0000 0000 0000 0000 0000 0000 + 1 ----------------------------------------- 0000 0000 0000 0000 0000 0000 0000 0001 = -1 $t0: 0 if ( $t0 == 0 ) put 2 else put 1 Slide: 6.10.2 ------------- li $t0, -1 $t0: FFFF FFFF = -1 FFFF FFFE = -2 0000 0002 = 2 FFFF FFFD + 1 ---------------- FFFF FFFE = -2 $t0: FFFF FFFF = -1 => 2**32 - 1 FFFF FFFE = -2 => 2**32 - 2 1 0000 0000 = 2**32 - 1 = --------------------- FFFF FFFF = 2**32 - 1 if ( $t0 >= (2**32 - 2) ) put 2 else put 1 0xFF => 1111 1111 = 16**2 - 1 = 256 - 1 = 255 1 0000 0000 = 16**2 - 1 --------------------- 1111 1111 = 256 - 1 = 255 $t0: 0000 0000 => 0000 00FF = 255 Slide: 6.10.1 ------------- li $t0, 0xFF $t0: 255 $t1: 0 if ( $t0 >= $t1 ) put 2 else put 1 0xFF => 1111 1111 = 16**2 - 1 = 256 - 1 = 255 1 0000 0000 = 16**2 - 1 --------------------- 1111 1111 = 256 - 1 = 255 $t0: 0000 0000 => 0000 00FF = 255 Tuesday, March 04, 2025 ----------------------- Slide: 6.9.3 ------------ 1 + 2 + 3 + 4 + 5 = 15 5 + 4 + 3 + 2 + 1 = 15 $v0: 5 $a0: 0 L1: for ( $v0 = 5; $v0 == 0; --$v0 ) { $a0 := $a0 + $v0; } L2: Slide: 6.9.2 ------------ li $t0, 0xFF $t0: 255 $t1: -1 if ( $t0 <> $t1 ) put 1 else put 2 0xFF => 1111 1111 = 16**2 - 1 = 256 - 1 = 255 1 0000 0000 = 16**2 - 1 --------------------- 1111 1111 = 256 - 1 = 255 $t0: 0000 0000 => 0000 00FF = 255 Slide: 6.7.3 ------------ $a0: 14 / $t0: -4 => positive ----------- 0 14 / +nn = 0 (quotient) 14 - (+nn*0) = 14 (remainder) Slide: 6.7.1/2 -------------- $a0: -14 / $t0: 4 ----------- -3 -14 / 4 = -3 (quotient) -14 - (-3*4) = -14 + 12 = -2 (remainder) Slide: 6.7.6 ------------ $t0: 8000 0000 = -2**31 x $t1: 2 ----------------------------------- 0000 0001 0000 0000 => 2**32 FFFF FFFE FFFF FFFF + 1 ----------------------------------- FFFF FFFF 0000 0000 => -2**32 FFFF FFFF (negative) 0000 0000 + 1 ----------- 0000 0001 => -1 0000 00 => FFFF FFFF 0000 0000 = -2**32 Monday, March 03, 2025 ---------------------- Slide: 6.7.4/5 -------------- $t0: 8000 0000 = -2**31 x $t1: 2 -------------------------- 1 0000 0000 = 2**32 Slide: 6.7.3 ------------ $t0: -11 $t1: 12 $a0 = $t0 * 12 = -132 Slide: 6.7.1 ------------ $t0: -11 $a0 = $t0 * 12 = -132 Slide: 6.5.3 ------------ X: 8000 0000 = -2**31 $t0: 1000 0000 0000 0000 0000 0000 0000 0000 = -2**31 + 1111 1111 1111 1111 1111 1111 1111 1111 = -1 -------------------------------------------------- $a0: 1 0111 1111 1111 1111 1111 1111 1111 1111 = 2**31-1 Slide: 6.5.1 ------------ X: FF = -1 $a0: 0000 0000 0000 0000 = 0000 0000 0000 0000 0000 0000 0000 0000 => 0000 0000 0000 0000 0000 0000 1111 1111 => 1111 1111 1111 1111 1111 1111 1111 1111 = -1 F = 1111 Slide: 6.4.3 ------------ X: 1 X+1: 0 X+2: 0 X+3: 0 Y: 8000 0000 (- negative) 7 => 0111 (+ positive) 8 => 1000 (- negative) + $t1: 8000 0000 (- negative) - $t0: 1 (+ positive) ---------------- 0000 0000 0000 0000 0000 0000 0000 0001 = 1 1111 1111 1111 1111 1111 1111 1111 1110 + 1 ----------------------------------------- 1111 1111 1111 1111 1111 1111 1111 1111 = -1 $t1: 8000 0000 (- negative) + $t0: FFFF FFFF (- negative) ------------------------------- $a0: 1 7FFF FFFF (+ positive) 7 => 0111 (+ positive) 8 => 1000 (- negative) 1000 0000 0000 0000 0000 0000 0000 0000 = 2**31 - 1 ------------------------------------------------- 0111 1111 1111 1111 1111 1111 1111 1111 = 2**31-1 => 2147483648 - 1 = 2147483647 Slide: 6.4.2 ------------ X: 1 X+1: 0 X+2: 0 X+3: 0 Y: 7FFF FFFF (+ positive) $t0: 1 (+ positive) + $t1: 7FFF FFFF (+ positive) ---------------- $a0: 8000 0000 = -2**31 7 => 0111 (+ positive) 8 => 1000 (- negative) 8000 0000 = 1000 0000 0000 0000 0000 0000 0000 0000 = -2**31 0111 1111 1111 1111 1111 1111 1111 1111 + 1 ----------------------------------------- 1000 0000 0000 0000 0000 0000 0000 0000 = 2**31 => -2**31 Slide: 6.4.1 ------------ X: 1 X+1: 0 X+2: 0 X+3: 0 Y: 7FFF FFFF $t0: 1 (+ positive) + $t1: 7FFF FFFF (+ positive) ---------------- 8000 0000 (- negative) 7 => 0111 (+ positive) 8 => 1000 (- negative) Slide: 6.3.3 ------------ $t0: -20 $t1: 20 <= -20 - $t0: -20 ------------ $a0: 40 Slide: 6.3.2 ------------ c: '7' => 55 $t0: 7 = 55 ('7') - 48 ('0') $a0: 7 Slide: 6.3.1 ------------ X: 10 X+1: 0 X+2: 0 X+3: 0 Y: -20: X+4 $t1: -20 - $t0: 10 ---------- $a0: -30 Slide: 6.2.3 ------------ i: 7 s: 55 => '7' s+1: 0 $t0: 7 => '7' => 55 = '0' (48) + 7 Slide: 6.2.2 ------------ X: 10 $t0: 10 + -20 ---------- $a0: -10 Slide: 6.2.1 ------------ X: 10 X+1: 0 X+2: 0 X+3: 0 Y: -20: X+4 $t0: 10 + $t1: -20 ---------- $a0: -10 Slide: 5.19.3 ------------- $a0: 00 01 00 00 => 1x2**16 = 65536 => 1x16**4 = 65536 Slide: 5.19.1 ------------- msg: C msg+1: l msg+2: a msg+3: s msg+4: s msg+5: , msg+6: msg+7: G msg+8: r msg+9: ... msg+10: msg+11: Slide: 5.18.3 ------------- X: 01 => 02 X+1: 02 => 01 X+2: 00 X+3: 00 $t0 = 00 00 00 01 $t1 = 00 00 00 02 0102: 0000 0001 0000 0010 = 1x2**8 + 2 = 256 + 2 = 258 a = 10 => 10 b = 20 => 20 t = a a = b b = t Slide: 5.18.2 ------------- X: 02 X+1: 01 => 00 X+2: 00 X+3: 00 Thursday, February 20, 2025 --------------------------- Slide: 5.18.1 ------------- X: 04 X+1: 03 X+2: 02 X+3: 01 $t0: X $a0: 3 Slide: 5.17.3 ------------- s: a s+1: b s+2: d s+3: 0 $t0: 00 00 00 d Slide: 5.17.2 ------------- X: 1 X+1: Y: 1: X+2 Y+1: : X+3 $t0: 00 00 00 01 $a0: 00 00 00 01 1111 1111 1111 1111 = -1 0000 0000 0000 0000 + 1 --------------------- 0000 0000 0000 0001 = 1 1111 1111 1111 1111 1111 1111 1111 1111 = -1 0000 0000 0000 0000 0000 0000 0000 0000 + 1 ----------------------------------------- 0000 0000 0000 0000 0000 0000 0000 0001 = 1 0000 0000 0000 0001 = 1 0000 0000 0000 0000 0000 0000 0000 0001 = 1 Slide: 5.17.1 ------------- X: 1 X+1: X+2: X+3: X+4: 1 X+5: X+6: X+7: Y: 3: X+8 Y+1: X+9 Y+2: X+10 Y+3: X+12 $t0: 1 $a0: 3 Slide: 5.17.6 ------------- val: 01 val+1: val+2: 02 val+3: 03 val+4: 04 val+5: 05 val+6: 06 val+7: 07 $t0: val+1 $a0: 3 Slide: 5.17.5 ------------- s: a s+1: b s+2: c s+3: 0 $t0: 2 $a0: s+2 Slide: 5.17.4 ------------- s: a s+1: b s+2: c s+3: 0 $t0: s+1 $a0: b Slide: 5.17.3 ------------- s: a s+1: b s+2: c s+3: 0 $t0: s+2 $a0: s+2 Slide: 5.17.2 ------------- val-1: 1 val: 2 val+1: 3 $a0: 00 00 00 01 Slide: 5.17.1 ------------- val: 00 val+1: 01 val+2: 10 val+3: 00 $a0: 00 00 00 10 = 16 Slide: 5.16.3 ------------- val: 1 val+1: val+2: 2 val+3: val+4: 3 val+5: val+6: val+7: $a0: 0 Tuesday, February 18, 2025 -------------------------- Slide: 5.16.2 ------------- val: 1 val+1: val+2: 2 val+3: val+4: 3 $a0: Slide: 5.16.1 ------------- s: a s+1: b s+2: c s+3: 0 $a0: s+1 Thursday, February 13, 2025 --------------------------- Slide: 5.15.3 ------------- val: -10 => F6 $t0 = 0000 0000 => 0000 00F6 $a0 = 0000 00F6 = 15x16 + 6 = 246 Slide: 5.15.2 ------------- val0: 0 = 00 val1: 1 = 01 val2: 2 = 02 $a0 = 0000 0000 => 0000 0100 = 16**2 = 256 Slide: 5.14.4 ------------- val: -10 => F6 $a0 = 0000 0000 => FFFF FFF6 = -10 Slide: 5.14.3 ------------- val: -10 => F6 val+1: 0 val+2: 0 val+3: 0 $a0 = 0000 0000 => 0000 00F6 = 15x16+6 = 246 0000 1010 = 10 1111 0101 + 1 ----------- 1111 0110 = F6 => -10 Slide: 5.14.2 ------------- val: F6 val+1: FF 0000 0000 0000 1010 = 10 1111 1111 1111 0101 + 1 --------------------- 1111 1111 1111 0110 = FFF6 => -10 $a0 = 0000 0000 => 0000 FFF6 => FFFF FFF6 FFFF FFF6 0000 0009 + 1 ----------- 0000 000A => -10 Slide: 5.12.6 ------------- X: 1 X+1: 0 Y: 2 : X+2 Y+1: 0 : X+3 Y+2: 0 : X+4 Y+3: 0 : X+5 ... $a0 = 0020 Wednesday, February 12, 2025 ---------------------------- Slide: 5.12.5 ------------- s: 100 $a0: 100 Slide: 5.12.4 ------------- X: 1 X+1: 0 Y: 2 : X+2 Y+1: 0 : X+3 .... Slide: 5.12.3 ------------- s: x s+1: y s+2: z s+3: 0 Slide: 5.12.2 ------------- s: x s+1: y s+2: z s+3: 0 Slide: 5.12.1 ------------- s: x s+1: y s+2: z s+3: 0 Tuesday, February 11, 2025 -------------------------- Slide: 5.8 ---------- 10000000 = 2**7 = 128 - 01111111 = -127 ----------------------- 00000001 = 1 11111111 = -1 00000000 + 1 ---------- - 00000001 10000000 = -128 01111111 + 1 ---------- 10000000 = -2**7 = -128 Slide: 5.8 ---------- 8 = 1000 A: 10 B: 11 C: 12 D: 13 E: 14 F: 15 75E0 = 7x16**3 + 5x16**2 + 14x16 = 28672 + 1280 + 224 = -30176 Slide: 5.8 ---------- 1462 / 16 = 91; R: 6 91 / 16 = 5; R: B 5 / 16 = 0; R: 5 Slide: 5.7 ---------- 38 = 32 + 4 + 2 = 00100110 Slide: 5.7 ---------- -15268 = 15268 / 16 = 954; R: 4 954 / 16 = 59; R: A 59 / 16 = 3; R: B 3 / 16 = 0; R: 3 Monday, February 10, 2025 ------------------------- Slide: 5.4 ---------- 100000000 = 1x2**8 = 256 - 1 = 1 -------------------------- 011111111 = 255 2*16 = 65536 - 1 = 1 -------------- = 65535 Thursday, February 6, 2025 -------------------------- Slide: 4.14.2 ------------- s: a s+1: b s+2: c s+3: 0 s+4: ... $a0: s $a1: 4 Wednesday, February 5, 2025 --------------------------- for ( i = 0; i < 1000; i++ ) { .... } Tuesday, February 4, 2025 ------------------------- Slide 4.14.1 ------------ s1: "abc"; s2: "xyz"; abcxyz0 print s1; "abc" => abc0 A => ($ra=A) B => ($ra=B) C => ($ra=C) D ... Runtime stak: A B C Monday, February 3, 2025 ------------------------ Slide 3.13 ---------- Average clock cycles per instruction (CPI) = CPU time / ( Instruction count × Cycle time ) = ( 400 sec / 1750x10**9 I ) / ( 0.25 x 10**(-9) sec / cycle ) = (0.23 x 10**(-9))/(0.25 x 10**(-9)) cycles / I = 0.914 cycles / I SPECratio = T(reference) / T(Computer) = 8660 / 400 = 21.65 ( Π SPECratioi )**1/n, where Π ai means the product a1×a2×...×an, i = 1 .. n = ( 21.65 x 8.5 )**(1/2) Thursday, January 30, 2025 -------------------------- Slide 3.10 ---------- Power ∝ ½ × Capacitive load × Voltage**2 × Frequency switched 0.8 = P2 / P1 = ( ½ × Capacitive_2 × Voltage_2**2 × Frequency_2 ) / ( ½ × Capacitive_1 × Voltage_1**2 × Frequency_1 ) = ( ½ × Capacitive_2 × Voltage_2**2 × Rate_2 ) / ( ½ × Capacitive_1 × Voltage_1**2 × Rate_1 ) = ( Capacitive_2 x 3x3 x 10**9 ) / ( Capacitive_1 x 6x6 x 0.5x10**9 ) = Capacitive_2 / (2xCapacitive_1) 1.6 = Capacitive_2 / Capacitive_1 Slide 3.8 --------- Time = Seconds / Program = ( Instructions / Program ) × ( Clock cycles / Instruction ) × ( Seconds / Clock cycle ) CPU times = ( Instruction count × CPI ) / Clock rate T(old) = I x CPI / R = 20 sec T(new) = 0.5 x I x 1.2 x CPI / R = 0.6 x I x CPI / R = 0.6 x 20 = 12 sec Slide 3.6 --------- CPU execution time for a program = CPU clock cycles for a program × Clock cycle time = CPU clock cycles for a program / Clock rate CPU clock cycles = Instructions for a program × Average clock cycles per instruction (CPI) C1 = 10000x0.3x1 + 10000x0.3x2 + 10000x0.4x3 = 3000 + 6000 + 12000 = 21000 C2 = 10000x0.3x2 + 10000x0.3x2 + 10000x0.4x2 = 6000 + 6000 + 8000 = 20000 T1 = 21000 cycles / (2x10**9 cycles/sec) = 10500x10**(-9) sec T2 = 20000 cycles / (1.5x10**9 cycles/sec) = 13333x10**(-9) sec Wednesday, January 29, 2025 --------------------------- Slide 3.5 --------- CPU execution time for a program = CPU clock cycles for a program × Clock cycle time = CPU clock cycles for a program / Clock rate CPU clock cycles = Instructions for a program × Average clock cycles per instruction (CPI) PerformanceX / PerformanceY = n PerformanceX / PerformanceY = Execution timeY / Execution timeX = n T1 = CPU clock cycles for P1 / Clock rate = Instructions for p1 × CPI(1) / R1 = I x 2 cycles / (2.5 x 10**9 cycles/sec) = 0.8x10**(-9) x I sec = 800x10**(-12) x I sec T2 = CPU clock cycles for P1 / Clock rate = Instructions for p1 × CPI(1) / R1 = I x 2.5 cycles / (3.0 x 10**9 cycles/sec) = 0.833x10**(-9) x I sec = 833x10**(-12) x I sec T2 / T1 = [ 833x10**(-12) x I ] / [800 x10**(-12) x I ] = 1.04 Slide 3.4.2 ----------- PerformanceX / PerformanceY = n PerformanceX / PerformanceY = Execution timeY / Execution timeX = n 5 = 30 / T(c) => T(C) = 30 / 5 = 6 Tuesday, January 28, 2025 ========================= CPU execution time for a program = CPU clock cycles for a program × Clock cycle time = CPU clock cycles for a program / Clock rate Slide 3.4.1 ----------- T(A) = 12 sec R(A) = 4 x 10**9 cycles/sec CPU execution time for a program = CPU clock cycles for a program × Clock cycle time = CPU clock cycles for a program / Clock rate = 12 sec = C(A) cycles / (4x10**9) cycles / sec C(A) cycles = 12 sec x (4x10**9) cycles / sec = 48x10**9 cycles T(B) = 8 sec R(B) = 2 x 10**9 cycles/sec CPU execution time for a program = CPU clock cycles for a program × Clock cycle time = CPU clock cycles for a program / Clock rate = 8 sec = C(B) cycles / (2x10**9) cycles / sec C(B) cycles = 8 sec x (2x10**9) cycles / sec = 16x10**9 cycles CPU execution time for a program = CPU clock cycles for a program × Clock cycle time PerformanceX = 1 / Execution timeX PerformanceX > PerformanceY ⇒ ( 1 / Execution timeX ) > ( 1 / Execution timeY ) ⇒ Execution timeY > Execution timeX PerformanceX / PerformanceY = n PerformanceX / PerformanceY = Execution timeY / Execution timeX = n Slide 3.1.1 ----------- PerformanceX / PerformanceY = Execution timeY / Execution timeX = n = Execution timeB / Execution timeA = 25 sec / 10 sec = 2.5 Slide 3.1.2 ----------- PerformanceX / PerformanceY = Execution timeY / Execution timeX = n = Execution timeB / Execution timeA = 3 => Execution timeB / 30 = 3 Execution timeB = 90 Slide 2.21 ---------- Cost per die = Cost per wafer / ( Dies per wafer × Yield ) Dies per wafer ≈ Wafer area / Die area Yield = 1 / ( 1 + Defects per area × Die area )n Yield = 1 / ( 1 + 0.02 x 3.14 x 10 x 10 / 120 )**2 = 1 / ( 1 + 0.0523)**2 = 1 / 1.1074 = 0.903 word b, c, a; // 1 word = 4 bytes lw $t1, 8($t6) // $t1 = a relocatable address $t6 = 1008 (1000 + 8) // base address = 1000 $t6 = 2008 (2000 + 8) // base address = 2000 4th generation: SQL: FIND ALL RECORDS WHERE NAME IS "SMITH" 3rd generation: for ( i = 0; i < 1000; i++ ) { if ( name[i] == "SMITH" ) print record[i] } CPU (with +, but no x) 1 + 2 = 3 Microarchitecture (without x) 2 x 3 = 6 = 2 + 2 + 2 (microcode or firmware) SIMD: Single Instruction/Multiple Data RISC: Reduced Instruction Set Computer CISC: Complex Instruction Set Computer MIPS: https://mips.com/ ARM: https://www.arm.com/products/silicon-ip-cpu Load-store computers Stored-program computers