CS计算机代考程序代写 mips Von Neumann and MIPS

Von Neumann and MIPS

The computer does not store different heap memory contents at consecutive locations, UNLIKE stack memory!
Remember C code syntax is not part of CSE12 syllabus! The only purpose here is to illustrate the concept of heap memory

Back to fractions…(only binary-decimal conversion)
• Fixed point fraction format:
• For CSE12 syllabus, we will only be dealing with unsigned Fixed point numbers
• Format: N + F fixed point
• N bits to represent integer
• F bits to represent fraction
• The “.” lies between the N bits and the F bits:
• Example: in 4+5 fixed point:
1011.00110 (4 bits for integer value 1011, 5 bits for fraction .00110) 0010.00101
1111.01111
………….
• How to convert from fixed point binary to decimal?? Example:
1011.00110
• Analyze the N bits and F bits separately:
• 1011=23 +21 +20 =11
• 00110=0 0 1 1 0 =2-3+2-4=0.1875 -1 -2-3-4 -5
• Therefore, 1011.001102 = 11.187510

Fixed Point Precision
• The smallest possible number you can represent in a Fixed point format
• Example: in 4+5 fixed point, it is 0000.000012 = 2-5 =0.0312510
• The next largest number after this will be 0000.000102 = 2-4=0.062510
• The next largest number after this will be 0000.000112= 2-4 + 2-5 = 0.0937510
• The next largest number after this will be 0000.001002= 2-3= 0.12510
• The ……………………………………
• So for example, if we were to convert 0.12610 to binary 4+5 fixed point, we would end up losing precision

Decimal to Binary fraction conversion
• First let us assume we have unlimited F bits to represent the fraction

Fixed Point Example 1:
 Convert to a 4+4 bit fixed point number  12 = 8+4 = 11002

Repeating Fractions
 Convert to a 4+4 bit fixed point number  .2 = ???

Repeating Fractions
• How to deal with 0.210 = 0.00112 in 4 + 4 fixed point??
• We will simply have to lose precision !
• Now, we know 0.00112 < 0.210. The question now is, is this number the closest we can express 0.210 in binary 4+4 fixed point? • Let’sfindout:0.0 0 1 1 =2-3 +2-4 =0.187510 -1 -2 -3 -4 • |0.210 – 0.187510| = 0.012510 = 6.25% precision loss • Let’s now go to the 4+4 number immediately higher than 0.210 = 0.0 1 0 0 2 = 2-2 = 0.2510 • |0.2510 - 0.210| = 0.0510 = 25% precision loss! • So obviously , we go with the earlier 4+4 number. • Therefore, 0.210 = 0.00112 in 4+4 fixed point with 6.25% precision loss