Presentation is loading. Please wait.

Presentation is loading. Please wait.

William Sandqvist It could be pedagogical to study a small 4 bit nibble computer in order to understand how real numbers are stored and.

Similar presentations


Presentation on theme: "William Sandqvist It could be pedagogical to study a small 4 bit nibble computer in order to understand how real numbers are stored and."— Presentation transcript:

1 William Sandqvist It could be pedagogical to study a small 4 bit nibble computer in order to understand how real numbers are stored and handled! Normaly 32 bit registers are used, but the principles from the nibble computer will remain the same.

2 William Sandqvist The first microprocessor Intel was a 4 bit (nibble) processor. The customer Busicom wanted a dedicated calculator chip, but the disobedient engineers created a general purpose processor.

3 William Sandqvist 4.3 Imagine a ”Nibble” computer Computer registers are ”rings”. A four bit register can hold 2 4 = 16 numbers. Either 8 positive (+0…+7) and 8 negative (-1…-8) ”signed numbers”, or 16 (0…F) ”unsigned numbers”. If a result is bigger than 16, the register overflows. (In some processors indicated with a Carry-flag).

4 William Sandqvist Real numbers in Nibble computer Imagine a ”Nibble” floating point format! Imagine a ”Nibble” fixed point format, Q 3 !

5 William Sandqvist Q 3 [b 3 b 2 b 1 b 0 ] Fixed point format The Q-format is the same as the signed numbers but downscaled: -1 < Q 3 < 1-b 0 The step between numbers is the weight of b Fixed point circle!Fixed point number line!

6 William Sandqvist Floating point (Nibble) Floating point format Sign b 3 Significand 1.b = = Exponent b 2 b 1 -1 (exess1) = = = =  0.5 =  1 =  2 =  4 =  0.5 =  1 =  2 =  4 =  0.5 =  1 =  2 =  4 =  0.5 =  1 =  2 =  4 = -6 Floating point number line!

7 William Sandqvist Quantisation error Maximum Quantisation Error MQE: Fixed point: (2 -3 )/2 = 2 -4 = 0.125/2 = Float: (6-4)/2 = 1

8 William Sandqvist The number Zero In fixed point formats the number zero is represented as [0000] In floating point format, there is no representation for zero! We could use, 0000 as +0 and 1000 as –0, as in the IEEE standard format! The IEEE 32 and 64 bit float standard Floating point circle!

9 William Sandqvist Converting Real numbers to Binary Hawe you forgotten how?

10 William Sandqvist 4.4 Six bit float Significand 1.b 2 b 1 b = = = = = = = = Exponent b 4 b 3 -1 (exess1) 00-1 = = = = = = = = = =  2 -2 exponent -2 not representable = =  2 -1 representable -1, = =  2 0 representable = =  2 2 significand not representable = =  2 2 representable

11 William Sandqvist Float Addition Algorithm: 1. Check for zeroes 2. Align significands 3. Add/Sub significands 4. Normalize result a =   b =   Align significands. 10 > 01 shift smaller number a to right to get same exponent: Significand exponent 10 Add significands: Normalize result: exp 10  exp 11 Rounding: ~ Result: a = b = 2.5 a+b = 4.5 (4.375)

12 William Sandqvist Float Multiplication Simpler than addition! Algorithm: 1. Check for zeroes 2. Add exponents and subtract Bias 3. Multiply significands 4. Normalize Exponents: Bias = 1 exp = = 10 Multiply significands Normalize result: exp 10  exp 11 Rounding: ~ Result: a = b = 2.5 a*b = 4.5 (4.6875)

13 William Sandqvist IEEE – 32 bit float Dec  IEEE-754 By using the exess–127 format for the exponent, we can compare floats as if they were sign and magnitude integers!

14 William Sandqvist

15 5-4 Cache conflict misses for (i = 0; i < 50; i++) for(j = 0; j < 4; j++) x[i][j] = a[i][j] * c[i]; Data cache 1 k Word (Word = 32 bit). Cache line 4 Words. Conflict misses depending on memory placement of x and a ?

16 William Sandqvist Memory – Cache adressmapping Memorys are often Byte- organized, but we could draw it as if it was organized in Memory-lines with the same size as the Cache-line. Direct addressmapping: Memory-line: i  Cache-line: j = i % K If the CPU needs a data-item in a line, the whole line is transfered fom memory to cache.

17 William Sandqvist a and x always conflict miss … Conflict miss if the distans between the startaddress in memory of a and of x is a multiple of 1 k Words, 4096 Bytes. for(j = 0; j < 4; j++) x[i][j] = a[i][j] * c[i];

18 William Sandqvist a and x conflict miss 1:4 … for(j = 0; j < 4; j++) x[i][j] = a[i][j] * c[i]; Conflict miss 1:4 if the distans between the startaddress in memory of a and of x is a multiple of 1 k Words  3 Words, 4096 Bytes  12 Bytes.

19 William Sandqvist a and x no conflict miss … for(j = 0; j < 4; j++) x[i][j] = a[i][j] * c[i]; No conflict miss if the distans between the startaddresses in memory of a and of x is not a multiple of 1 k Words, and not a multiple of 1 k Words  3,  2,  1 Words!

20 William Sandqvist

21 8-1 Arbitration 3 Masters and 4 Slaves are connected to a classical bus. Read access pattern: M1M2M3 Rd S1Rd S2Rd S4 Rd S1Rd S3 Rd S2 Sequential execution, 7 cycles needed. 1. M1  Rd S1 2. M2  Rd S2 3. M3  Rd S4 4. M2  Rd S3 5. M3  Rd S3 6. M2  Rd S2 7. M1  Rd S1 Many other alternatives are possible!

22 William Sandqvist Slave side arbitration Weighted round robin slave-side arbitration. S1S2S3S4 M11--- M2-12- M3--11 Best case execution time (3 cycles) 1.M1  Rd S1 ; M2  Rd S2 ; M3  Rd S4 2.M1  Rd S1 ; M2  Rd S3 ; 3. ; M2  Rd S2 ; M3  Rd S3 Worst case execution time (4 cycles) 1.M1  Rd S1 ; M2  Rd S2 ; M3  Rd S4 2.M1  Rd S1 ; ; M3  Rd S3 3. ; M2  Rd S3 ; 4. ; M2  Rd S2 ; Connections and weights: M1M2M3 Rd S1Rd S2Rd S4 Rd S1Rd S3 Rd S2


Download ppt "William Sandqvist It could be pedagogical to study a small 4 bit nibble computer in order to understand how real numbers are stored and."

Similar presentations


Ads by Google