von Neumann model The model defines a computer
- Slides: 15
von Neumann model The model defines a computer as four subsystems: memory, arithmetic logic unit, control unit, and I/O Sequential execution of instructions The data and program are stored as binary patterns in memory
ASCII Code 32 40 48 56 64 72 80 88 96 104 112 120 ( 0 8 @ H P X ` h p x 33 41 49 57 65 73 81 89 97 105 113 121 ! ) 1 9 A I Q Y a i q y 34 42 50 58 66 74 82 90 98 106 114 122 " * 2 : B J R Z b j r z 35 43 51 59 67 75 83 91 99 107 115 123 See Also: EBCDIC # + 3 ; C K S [ c k s { 36 44 52 60 68 76 84 92 100 108 116 124 $ , 4 < D L T d l t | 37 45 53 61 69 77 85 93 101 109 117 125 % 5 = E M U ] e m u } 38 46 54 62 70 78 86 94 102 110 118 126 &. 6 > F N V ^ f n v ~ 39 47 55 63 71 79 87 95 103 111 119 127 ' / 7 ? G O W _ g o w
One’s complement integers q. Range: -(2 N-1 -1) … +(2 N-1 -1) # of Bits Range --------------------------------8 -127 -0 +0 +127 16 -32767 -0 +0 +32767 32 -2, 147, 483, 647 -0 +0 +2, 147, 483, 647 q. Storing one’s complement integers process: 1. The number is changed to binary; the sign is ignored 2. 0 s are added to the left of the number to make a total of N bits 3. If the sign is positive, no more action is needed. If the sign is negative, every bit is complemented.
Two’s complement integers q. Range: -(2 N-1) … +(2 N-1 -1) # of Bits Range -------------------------------8 -128 0 +127 16 -32, 768 0 +32, 767 32 -2, 147, 483, 648 0 +2, 147, 483, 647 q. Storing two’s complement integers process: 1. The number is changed to binary; the sign is ignored 2. If the number of bits is less than N, 0 s are added to the left of the number so that there is a total of N bits. 3. If the sign is positive, no further action is needed. If the sign is negative, leave all the rightmost 0 s and the first 1 unchanged. Complement the rest of the bits.
Summary of integer representation Contents of Memory ------0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Unsigned ------0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Sign-and. Magnitude ----+0 +1 +2 +3 +4 +5 +6 +7 -0 -1 -2 -3 -4 -5 -6 -7 One’s Complement ----+0 +1 +2 +3 +4 +5 +6 +7 -7 -6 -5 -4 -3 -2 -1 -0 Two’s Complement -------+0 +1 +2 +3 +4 +5 +6 +7 -8 -7 -6 -5 -4 -3 -2 -1
Example 17 Transform the fraction 0. 875 to binary Solution Write the fraction at the left corner. Multiply the number continuously by 2 and extract the integer part as the binary digit. Stop when the number is 0. 0. 0. 875 1. 750 1. 5 1. 0 0. 0 0 . 1 1 1
IEEE standards
Example 21 Represent 81. 5625 in IEEE standard Solution 8110 = 010100012 ; 0. 5625 = 0. 10012 1010001. 1001 = + 26 x 1. 0100011001 Exponent 6 is expressed in Excess_127 as 133 = 100001012 0 10000101 01000110010000000
Variable Types in BASIC • Numeric – CODE=67 – A=-5 – Pi=3. 14159 • String – S$=“N” – School_name$=“National Chi Nan University”
Operators • • ^ */ MOD += (equality) <> (inequality) < > • • • >= <= NOT AND OR XOR
Condition • 140 REM --- Is this a leap year? • 150 IF Y MOD 4 = 0 THEN LEAP = 1 ELSE LEAP = 0 • 160 IF Y MOD 100 = 0 THEN LEAP = 0 • 170 IF Y MOD 400 = 0 THEN LEAP = 1
What day is today?
Loop • FOR … NEXT • DO WHILE
Sorting 20 REM Sorting 30 DATA 1, 3, 5, 7, 2, 4, 6 40 K=7 50 DIM A(K) 60 FOR I=1 TO K 70 READ A(I) 80 NEXT I 85 GOSUB 200 90 FOR I=1 TO K-1 100 FOR J=I+1 TO K 110 IF A(I) > A(J) THEN TEMP=A(I): A(I)=A(J): A(J)=TEMP 120 NEXT J 125 GOSUB 200 130 NEXT I 150 END 200 REM --- Print out the array --210 FOR H=1 TO K 220 PRINT A(H); 230 NEXT H 240 PRINT 250 RETURN
Two’s Complement
- Von neumann model components
- Sexitillion
- Von neumann model components
- Non von neumann model
- Mar von neumann
- John von neumann institute
- John von neumann random number generator
- John von neumann počítač
- Gargalo de von neumann
- Von neumann poker
- Jon von neumann
- John von neumann university
- John louis von neumann
- John louis von neumann
- Modello di von neumann spiegazione semplice
- Von neumann