30000BC Palaeolithic peoples in central Europe and France record numbers on bones. 5000BC A decimal number system is in use in Egypt.
|
|
- Arron Scott
- 5 years ago
- Views:
Transcription
1 3BC Palaeolithic peoples in central Europe and France record numbers on bones. 5BC A decimal number system is in use in Egypt. 4BC Babylonian and Egyptian calendars in use. 34BC The first symbols for numbers, simple straight lines, are used in Egypt. 3BC The abacus is developed in the Middle East and in areas around the Mediterranean. A somewhat different type of abacus is used in China. 3BC Hieroglyphic numerals in use in Egypt. 3BC Babylonians begin to use a sexagesimal number system for recording financial transactions. It is a place-value system without a zero place value. 2BC Harappans adopt a uniform decimal system of weights and measures. 95BC Babylonians solve quadratic equations.
2 9BC The Moscow papyrus is written. It gives details of Egyptian geometry. 85BC Babylonians know Pythagoras's Theorem. 8BC Babylonians use multiplication tables. 75BC The Babylonians solve linear and quadratic algebraic equations, compile tables of square and cube roots. They use Pythagoras's theorem and use mathematics to extend knowledge of astronomy. 7BC The Rhind papyrus (sometimes called the Ahmes papyrus) is written. It shows that Egyptian mathematics has developed many techniques to solve problems. Multiplication is based on repeated doubling, and division uses successive halving. 36BC A decimal number system with no zero starts to be used in China. BC Chinese use counting boards for calculation. 54BC Counting rods used in China. 5BC The Babylonian sexagesimal number system is used to record and predict the positions of the Sun, Moon and planets.
3 Egyptian Numerals Egyptian number system is additive.
4
5 Mesopotamia Civilization Above: Babylonian sexagesimal (base 6) number. It is the first positional number system. Left: Oldest cuneiform writing by Sumerian.
6 Babylonian numerals
7 4359 Chinese numerals
8 Indian numerals
9 Greek number systems
10 Roman Numerals I II 2 III 3 IV 4 V 5 VI 6 VII 7 VIII 8 IX 9 X L 5 C D 5 M MMMDCCCLXXVIII 3878
11 Mayan mathematics 25 AD to 9 AD, this period was built on top of a civilization which had lived in the region from about 2 BC. [8;4;3;;2] represents 2 + x x 8 x x 8 x x 8 x 2 3 =
12 The numerals from al-sizji's treatise of 969
13 Abaci Chinese Abacus Boethius (Hindu-Arabic) vs Pythagoras (counting board)
14 Logarithm and Slide Rule John Napier of Scotland developed the concept of logarithm around AD 6. If a y =x, then y = log a x Slide rule based on the property of logarithm was invented in the late 7s. log (u v) = log (u) + log(v)
15 Decimal Numbers: Base Digits:,, 2, 3, 4, 5, 6, 7, 8, 9 Example: 327 = (3x 3 ) + (2x 2 ) + (7x ) + (x )
16 Numbers: positional notation Number Base B B symbols per digit: Base (Decimal):,, 2, 3, 4, 5, 6, 7, 8, 9 Base 2 (Binary):, Number representation: d 3 d 3... d d is a 32 digit number value = d 3 B 3 + d 3 B d B + d B Binary:, (In binary digits called bits ) b = = = 26 Here 5 digit binary # turns into a 2 digit decimal # Can we find a base that converts to binary easily? #s often written b
17 Hexadecimal Numbers: Base 6 Hexadecimal:,, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Normal digits + 6 more from the alphabet In C, written as x (e.g., xfab5) Conversion: Binary Hex hex digit represents 6 decimal values 4 binary digits represent 6 decimal values hex digit replaces 4 binary digits One hex digit is a nibble. Two is a byte Example: (binary) = x?
18 Decimal vs. Hexadecimal vs. Binary Examples: (binary) = xac3 (binary) = (binary) = x7 x3f9 = (binary) How do we convert between hex and Decimal? A B 2 C 3 D 4 E 5 F
19 What to do with representations of numbers? Just what we do with numbers! Add them Subtract them Multiply them Divide them Compare them Example: + 7 = 7 so simple to add in binary that we can build circuits to do it! subtraction just as you would in decimal Comparison: How do you tell if X > Y?
20 Which base do we use? Decimal: great for humans, especially when doing arithmetic Hex: if human looking at long strings of binary numbers, its much easier to convert to hex and look 4 bits/symbol Terrible for arithmetic on paper Binary: what computers use; you will learn how computers do +, -, *, / To a computer, numbers always binary Regardless of how number is written: 32 ten == 32 == x2 == 2 == b Use subscripts ten, hex, two in book, slides when might be confusing
21 BIG IDEA: Bits can represent anything!! Characters? 26 letters 5 bits (2 5 = 32) upper/lower case + punctuation 7 bits (in 8) ( ASCII ) standard code to cover all the world s languages 8,6,32 bits ( Unicode ) Logical values? False, True colors? Ex: locations / addresses? commands? MEMORIZE: N bits at most 2 N things Red () Green () Blue ()
22 How to Represent Negative Numbers? So far, unsigned numbers Obvious solution: define leftmost bit to be sign! +, - Rest of bits can be numerical value of number Representation called sign and magnitude MIPS uses 32-bit integers. + ten would be: And ten in sign and magnitude would be:
23 Shortcomings of sign and magnitude? Arithmetic circuit complicated Special steps depending whether signs are the same or not Also, two zeros x = + ten x8 = - ten What would two s mean for programming? Therefore sign and magnitude abandoned
24 Another try: complement the bits Example: 7 = 2-7 = 2 Called One s Complement Note: positive numbers have leading s, negative numbers have leadings s What is -? Answer: How many positive numbers in N bits? How many negative ones?
25 Shortcomings of One s complement? Arithmetic still a somewhat complicated. Still two zeros x = + ten xffffffff = - ten Although used for awhile on some computer products, one s complement was eventually abandoned because another solution was better.
26 Standard Negative Number Representation What is result for unsigned numbers if tried to subtract large number from a small one? Would try to borrow from string of leading s, so result would have a string of leading s» = With no obvious better alternative, pick representation that made the hardware simple As with sign and magnitude, leading s positive, leading s negative»...xxx is,...xxx is <» except is -, not - (as in sign & mag.) This representation is Two s Complement
27 Sign and Magnitude = + 4 Example: N = = High order bit is sign: = positive (or zero), = negative Remaining low order bits is the magnitude: () thru 7 () Number range for n bits = +/- 2 n- - Representations for? Operations: =, <, >, +, -???
28 Ones Complement (algebraically) N is positive number, then N is its negative 's complement N = (2 n - ) - N 4 2 = - = Example: 's complement of 7-7 = -7 in 's comp. Bit manipulation: simply complement each of the bits ->
29 Ones Complement on the number wheel = = Subtraction implemented by addition & 's complement Sign is easy to determine Closure under negation. If A can be represented, so can -A Still two representations of! If A = B then is A B ==? Addition is almost clockwise advance, like unsigned
30 Twos Complement number wheel like 's comp except shifted one position clockwise = + 4 = Easy to determine sign (?) Only one representation for Addition and subtraction just as in unsigned case Simple comparison: A < B iff A B < One more negative number than positive number - one number has no additive inverse
31 Twos Complement (algebraically) N* = 2 n - N Example: Twos complement of 7 sub 4 2 = 7 = = repr. of -7 Example: Twos complement of -7 Bit manipulation: sub 4 2 = -7 = = repr. of 7 Twos complement: take bitwise complement and add one -> + -> (representation of -7) -> + -> (representation of 7)
32 How is addition performed in each number system? Operands may be positive or negative
33 Sign Magnitude Addition Operand have same sign: unsigned addition of magnitudes result sign bit is the same as the operands' sign (-3) -7 Operands have different signs: subtract smaller from larger and keep sign of the larger
34 Ones complement addition Perform unsigned addition, then add in the end-around carry (-3) 7-7 End around carry End around carry
35 When carry occurs = + 4 = M N where M > N -M - N
36 Why does end-around carry work? Recall: N = (2 n - ) - N End-around carry work is equivalent to subtracting 2 n and adding n n M - N = M + N = M + (2 - - N) = (M - N) (when M > N) n n -M + (-N) = M + N = (2 - M - ) + (2 - N - ) n n = 2 + [2 - - (M + N)] - M + N < 2 n- after end around carry: n = (M + N) this is the correct form for representing -(M + N) in 's comp!
37 Twos Complement Addition Perform unsigned addition and 4-4 Discard the carry out (-3) 7-7 Overflow? Simpler addition scheme makes twos complement the most common choice for integer number systems within digital systems
38 Twos Complement number wheel = + 4 = M + -N where N + M 2n- -M + N when N > M
39 2s Comp: ignore the carry out -M + N when N > M: n n M* + N = (2 - M) + N = 2 + (N - M) Ignoring carry-out is just like subtracting 2 n -M + -N where N + M 2 n- n n -M + (-N) = M* + N* = (2 - M) + (2 - N) n n = 2 - (M + N) + 2 After ignoring the carry, this is just the right twos compl. representation for -(M + N)!
40 2s Complement Overflow How can you tell an overflow occurred? Add two positive numbers to get a negative number or two negative numbers to get a positive number = -8! -7-2 = +7!
41 2s comp. Overflow Detection Overflow Overflow No overflow No overflow Overflow occurs when carry in to sign does not equa l carry out
42 Two s Complement for N=32... two = ten... two = ten... two = 2 ten two = 2,47,483,645 ten... two = 2,47,483,646 ten... two = 2,47,483,647 ten... two = 2,47,483,648 ten... two = 2,47,483,647 ten... two = 2,47,483,646 ten two = 3 ten... two = 2 ten... two = ten One zero; st bit called sign bit extra negative:no positive 2,47,483,648 ten
43 Two s Complement Formula Can represent positive and negative numbers in terms of the bit value times a power of 2: d 3 x -(2 3 ) + d 3 x d 2 x d x 2 + d x 2 Example: two = x-(2 3 ) + x2 2 + x2 + x2 = = = = -3 ten
44 Two s Complement shortcut: Negation Change every to and to (invert or complement), then add to the result Proof: Sum of number and its (one s) complement must be... two However,... two = - ten Let x one s complement representation of x Then x + x = - x + x + = x + = -x Example: -3 to +3 to -3 x : two x : two +: two () : two +: two You should be able to do this in your head
45 Two s comp. shortcut: Sign extension Convert 2 s complement number rep. using n bits to more than n bits Simply replicate the most significant bit (sign bit) of smaller to fill new bits 2 s comp. positive number has infinite s 2 s comp. negative number has infinite s Binary representation hides leading bits; sign extension restores some of them 6-bit -4 ten to 32-bit: two two
46 What if too big? Binary bit patterns above are simply representatives of numbers. Strictly speaking they are called numerals. Numbers really have an number of digits with almost all being same ( or ) except for a few of the rightmost digits Just don t normally show leading digits If result of add (or -, *, / ) cannot be represented by these rightmost HW bits, overflow is said to have occurred. unsigned
47 Kilo, Mega, Giga, Tera, Peta, Exa, Zetta, Yotta physics.nist.gov/cuu/units/binary.html Name Abbr Factor SI size Kilo K 2 =,24 3 =, Mega M 2 2 =,48,576 6 =,, Giga G 2 3 =,73,74,824 9 =,,, Tera T 2 4 =,99,5,627,776 2 =,,,, Peta P 2 5 =,25,899,96,842,624 5 =,,,,, Exa E 2 6 =,52,92,54,66,846,976 8 =,,,,,, Zetta Z 2 7 =,8,59,62,77,4,33,424 2 =,,,,,,, Yotta Y 2 8 =,28,925,89,64,629,74,76,76 24 =,,,,,,,, Confusing! Common usage of kilobyte means 24 bytes, but the correct SI value is bytes Hard Disk manufacturers & Telecommunications are the only computing groups that use SI factors, so what is advertised as a 3 GB drive will actually only hold about 28 x 2 3 bytes, and a Mbit/s connection transfers 6 bps.
48 kibi, mebi, gibi, tebi, pebi, exbi, zebi, yobi en.wikipedia.org/wiki/binary_prefix Name kibi mebi gibi tebi pebi exbi zebi yobi Abbr Ki Mi Gi Ti Pi Ei Zi Yi Factor 2 =, =,48, =,73,74, =,99,5,627, =,25,899,96,842, =,52,92,54,66,846, =,8,59,62,77,4,33, =,28,925,89,64,629,74,76,76 International Electrotechnical Commission (IEC) in 999 introduced these to specify binary quantities. Names come from shortened versions of the original SI prefixes (same pronunciation) and bi is short for binary, but pronounced bee :-( Now SI prefixes only have their base- meaning and never have a base-2 meaning.
49 The way to remember #s What is 2 34? How many bits addresses (I.e., what s ceil log 2 = lg of) 2.5 TiB? Answer! 2 XY means X= --- X= kibi ~ 3 X=2 mebi ~ 6 X=3 gibi ~ 9 X=4 tebi ~ 2 X=5 tebi ~ 5 X=6 exbi ~ 8 X=7 zebi ~ 2 X=8 yobi ~ 24 Y= Y= 2 Y=2 4 Y=3 8 Y=4 6 Y=5 32 Y=6 64 Y=7 28 Y=8 256 Y=9 52 MEMORIZE!
50 Comparing the signed number systems Here are all the 4-bit numbers in the different systems. Positive numbers are the same in all three representations. Signed magnitude and one s complement have two ways of representing. This makes things more complicated. Two s complement has asymmetric ranges; there is one more negative number than positive number. Here, you can represent -8 but not +8. However, two s complement is preferred because it has only one, and its addition algorithm is the simplest. Decimal S.M. s comp. 2 s comp
51 And in Conclusion... We represent things in computers as particular bit patterns: N bits 2 N Decimal for human calculations, binary for computers, hex to write binary more easily s complement - mostly abandoned 2 s complement universal in computing: cannot avoid, so learn Overflow: numbers ; computers finite, errors!
52 Numbers represented in memory Memory is a place to store bits A word is a fixed number of bits (eg, 32) at an address Addresses are naturally represented as unsigned numbers in C = 2 k -
53 Signed vs. Unsigned Variables Java just declares integers int Uses two s complement C has declaration int also Declares variable as a signed integer Uses two s complement Also, C declaration unsigned int Declares a unsigned integer Treats 32-bit number as unsigned integer, so most significant bit is part of the number, not a sign bit
54 Binary Codes for Decimal Digits There are over 8, ways that you can chose elements from the 6 binary numbers of 4 bits. A few are useful: Decimal 8,4,2, Excess3 8,4,-2,
55 Binary Coded Decimal (BCD) Binary Coded Decimal or 8,4,2, Code. This code is the simplest, most intuitive binary code for decimal digits and uses the same weights as a binary number, but only encodes the first ten values from to 9. Examples: is 8 + = 9 is 2 + = 3 is 4 is an illegal code.
56 Other Decimal Codes The Excess-3 Code adds binary to the BCD code. The BCD (8,4, 2, ) Code, and the (8,4,-2,-) Code are examples of weighted codes. Each bit has a "weight" associated with it and you can compute the decimal value by adding the weights where a exists in the code-word. Example: in (8,4,-2,-) is (-2) + (-) = 9
57 Warning: Conversion or Coding? DO NOT mix up CONVERSION of a decimal number to a binary number with CODING a decimal number with a BINARY CODE. 3 = 2 (This is CONVERSION) 3 (This is CODING)
58 Binary Addition: Half Adder Ai Bi Sum Carry Ai Bi Ai Bi Sum = Ai Bi + Ai Bi Carry = Ai Bi A i Sum = Ai + Bi B i Half-adder Schematic Carry But each bit position may have a carry in
59 Full-Adder + Co Cin B A S A B CI S CO CI S CI A B A B S = CI xor A xor B CO CO = B CI + A CI + A B = CI (A + B) + A B Now we can connect them up to do multiple bits
60 Ripple Carry A3 B3 A2 B2 A B A B S3 C3 S2 C2 S C S
61 Full Adder from Half Adders (little aside) Standard Approach: 6 Gates A B S CI A B CI A B CO Alternative Implementation: 5 Gates A B Half Adder S CO A B A + B Half Adder S CO A + B + CI CI (A + B) S CI CO A B + CI (A xor B) = A B + B CI + A CI
62 Delay in the Ripple Carry Adder Critical delay: the propagation of carry from low to high order stages late @ A B CI @ two gate delays to compute CO C 4 stage adder A B A B C A 2 B 2 2 S C A 3 B 3 3 S C final sum and carry
63 Ripple Carry Timing Critical delay: the propagation of carry from low to high order stages S, C Valid S, C2 Valid S2, C3 Valid S3, C4 Valid + worst case addition T T2 T4 T6 T8 T: Inputs to the adder are valid T2: Stage carry out (C) T4: Stage carry out (C2) 2 delays to compute sum but last carry not ready until 6 delays later T6: Stage 2 carry out (C3) T8: Stage 3 carry out (C4)
64 Adders (cont.) Ripple Adder c7 c6 c5 c4 c3 c2 b a c s7 s6 FA Ripple adder is inherently slow because, in general s7 must wait for c7 which must wait for c6 T α n, Cost α n How do we make it faster, perhaps with more cost? Classic approach: Carry Look-Ahead c s Or use a MUX!!!
65 Carry Select Adder b7a7 b6a6 b5a5 b4 a4 b3a3 b2a2 ba ba c FA c8 b7a7 b6a6 b5a5 b4a4 s3 s2 s s FA s7 s6 s5 s4 T = T ripple_adder / 2 + T MUX COST =.5 * COST ripple_adder + (n+) * COST MUX
66 Extended Carry Select Adder b5-b2 a5-a2 b-b8 a-a8 b7-b4 a7-a4 b3-b a3-a 4-bit Adder 4-bit Adder 4-bit Adder cout 4-bit Adder 4-bit Adder 4-bit Adder 4-bit Adder cin What is the optimal # of blocks and # of bits/block? If # blocks too large delay dominated by total mux delay If # blocks too small delay dominated by adder delay per block N stages of N bits T α sqrt(n), Cost 2*ripple + muxes
67 Carry Select Adder Performance b5-b2 a5-a2 b-b8 a-a8 b7-b4 a7-a4 b3-b a3-a 4-bit Adder 4-bit Adder 4-bit Adder cout 4-bit Adder 4-bit Adder 4-bit Adder 4-bit Adder cin Compare to ripple adder delay: T total = 2 sqrt(n) T FA T FA, assuming T FA = T MUX For ripple adder T total = N T FA cross-over at N=3, Carry select faster for any value of N>3. Is sqrt(n) really the optimum? From right to left increase size of each block to better match delays Ex: 64-bit adder, use block sizes [ ] How about recursively defined carry select?
68 What really happens with the carries c7 c6 c5 c4 c3 c2 b a c FA s7 s6 c s A B Cout S Cin Cin ~Cin Carry action kill Propagate Ai Bi Gi Cin ~Cin Cin propagate generate Ai Bi Pi Carry Generate Gi = Ai Bi must generate carry when A = B = Carry Propagate Pi = Ai xor Bi carry in will equal carry out here All generates and propagates in parallel at first stage. No ripple.
69 Carry Look Ahead Logic Carry Generate Gi = Ai Bi must generate carry when A = B = Carry Propagate Pi = Ai xor Bi carry in will equal carry out here Sum and Carry can be reexpressed in terms of generate/propagate: Si = Ai xor Bi xor Ci = Pi xor Ci Ci+ = Ai Bi + Ai Ci + Bi Ci Ci Pi Si = Ai Bi + Ci (Ai + Bi) = Ai Bi + Ci (Ai xor Bi) = Gi + Ci Pi Gi Ci Pi Ci+
70 All Carries in Parallel Reexpress the carry logic for each of the bits: C = G + P C C2 = G + P C = G + P G + P P C C3 = G2 + P2 C2 = G2 + P2 G + P2 P G + P2 P P C C4 = G3 + P3 C3 = G3 + P3 G2 + P3 P2 G + P3 P2 P G + P3 P2 P P C Each of the carry equations can be implemented in a two-level logic network Variables are the adder inputs and carry in to stage!
71 CLA Implementation Ai Bi Ci gate delay 2 gate delays Adder with Propagate and Generate Outputs gate delay Increasingly complex logic C P G C P P G P G C C2 C P P P2 G P P2 G P2 G2 C3 C P P P2 P3 G P P2 P3 G P2 P3 G2 P3 C4 G3
72 How do we extend this to larger adders? A 5-2 B 5-2 A -8 B -8 A 7-4 B 7-4 A 3- B S 5-2 S -8 S 7-4 S 3- Faster carry propagation 4 bits at a time But still linear Can we get to log? Compute propagate and generate for each adder BLOCK
73 Cascaded Carry Lookahead C 6 A [5-2] B [5-2] C A [-8] B [-8] 4-bit Adder 2 C A [7-4] B [7-4] 4-bit Adder 8 C A [3-] B [3-] 4 C 4-bit Adder 4-bit Adder P G P G P G P S [5-2] S [-8] S [7-4] @3 C C 4 P 3 G 3 C 3 P 2 G 2 C 2 P G C P G Lookahead Carry Unit C P 3- G @5 4 bit adders with internal carry lookahead second level carry lookahead unit, extends lookahead to 6 bits One more level to 64 bits
74 Trade-offs in combinational logic design Time vs. Space Trade-offs Doing things fast requires more logic and thus more space Example: carry lookahead logic Simple with lots of gates vs complex with fewer Arithmetic Logic Units Critical component of processor datapath Inner-most "loop" of most computer instructions
75 2s comp. Overflow Detection Overflow Overflow No overflow No overflow Overflow occurs when carry in to sign does not equa l carry out
76 2s Complement Adder/Subtractor A 3 B 3 B 3 A 2 B 2 B 2 A B B A B B Sel Sel Sel Sel A B A B A B A B CO + CI CO + CI CO + CI CO + CI Add/Subtract S S S S S 3 S 2 S S Overflow A - B = A + (-B) = A + B +
77 Summary Circuit design for unsigned addition Full adder per bit slice Delay limited by Carry Propagation» Ripple is algorithmically slow, but wires are short Carry select Simple, resource-intensive Excellent layout Carry look-ahead Excellent asymptotic behavior Great at the board level, but wire length effects are significant on chip Digital number systems How to represent negative numbers Simple operations Clean algorithmic properties 2s complement is most widely used Circuit for unsigned arithmetic Subtract by complement and carry in Overflow when cin xor cout of sign-bit is
78 Basic Arithmetic and the ALU Now Integer multiplication» Booth s algorithm Integer division» Restoring, non-restoring Floating point representation Floating point addition, multiplication
79 Multiplication Flashback to 3 rd grade Multiplier Multiplicand x Partial products Final sum Base : 8 x 9 = 72 PP: = 72 How wide is the result? log(n x m) = log(n) + log(m) 32b x 32b = 64b result
80 Combinational Multiplier Generating partial products 2: mux based on multiplier[i] selects multiplicand or x 32 partial products (!) Summing partial products Build Wallace tree of CSA
81 Carry Save Adder A + B => S Save carries A + B => S, C out Use C in A + B + C => S, S2 (3# to 2# in parallel) Used in combinational multipliers by building a Wallace Tree c b a CSA c s
82 Wallace Tree f e d c b a CSA CSA CSA CSA
83 Multicycle Multipliers Combinational multipliers Very hardware-intensive Integer multiply relatively rare Not the right place to spend resources Multicycle multipliers Iterate through bits of multiplier Conditionally add shifted multiplicand
84 Multiplier (F4.25) x
85 Multiplier (F4.26) Start M ultiplier =. Test M ultip lier M ultiplier = a. Add m ultiplicand to product and place the result in Product register x 2. Shift the M ultiplicand register left bit 3. Shift the M ultiplier register right bit 32nd repetition? N o: < 32 repetitions Yes: 32 repetitions Done
86 Multiplier Improvements Do we really need a 64-bit adder? No, since low-order bits are not involved Hence, just use a 32-bit adder» Shift product register right on every step Do we really need a separate multiplier register? No, since low-order bits of 64-bit product are initially unused Hence, just store multiplier there initially
87 Multiplier (F4.3) x Multiplicand 32 bits 32-bit ALU Product 64 bits Shift right Write Control test
88 Multiplier (F4.32) Start Product =. Test P roduct Product = a. Add m ultiplicand to the left half of the product and place the result in the left half of the Product register x 2. Shift the Product register right bit 32nd repetition? No: < 32 repetitions Yes: 32 repetitions D one
89 Signed Multiplication Recall For p = a x b, if a< or b<, then p < If a< and b<, then p > Hence sign(p) = sign(a) xor sign(b) Hence Convert multiplier, multiplicand to positive number with (n-) bits Multiply positive numbers Compute sign, convert product accordingly Or, Perform sign-extension on shifts for F4.3 design Right answer falls out
90 Booth s Encoding Recall grade school trick When multiplying by 9: E.g.» Multiply by (easy, just shift digits left)» Subtract once» x 9 = x ( ) = » Converts addition of six partial products to one shift and one subtraction Booth s algorithm applies same principle Except no 9 in binary, just and So, it s actually easier!
91 Booth s Encoding Search for a run of bits in the multiplier E.g. has a run of 2 bits in the middle Multiplying by (6 in decimal) is equivalent to multiplying by 8 and subtracting twice, since 6 x m = (8 2) x m = 8m 2m Hence, iterate right to left and: Subtract multiplicand from product at first Add multiplicand to product after first Don t do either for bits in the middle
92 Booth s Algorithm Current bit Bit to right Explanation Example Operation Begins run of Subtract Middle of run of Nothing End of a run of Add Middle of a run of Nothing
93 Integer Division Again, back to 3 rd grade Quotient Divisor Dividend - - Remainder
94 Integer Division How does hardware know if division fits? Condition: if remainder divisor Use subtraction: (remainder divisor) OK, so if it fits, what do we do? Remainder n+ = Remainder n divisor What if it doesn t fit? Have to restore original remainder Called restoring division
95 Start Integer Division (F4.4). Subtract the Divisor register from the Remainder register and place the result in the Remainder register Remainder > Test Remainder Remainder < 2a. Shift the Quotient register to the left, setting the new rightmost bit to Quotient 2b. Restore the original value by adding the Divisor register to the Remainder register and place the sum in the Remainder register. Also shift the Quotient register to the left, setting the new least significant bit to Divisor Dividend - 3. Shift the Divisor register right bit - 33rd repetition? No: < 33 repetitions Remainder Yes: 33 repetitions Done
96 Integer Division Divisor - Quotient Dividend - Remainder Divisor Shift right 64 bits 64-bit ALU Quotient Shift left 32 bits Remainder 64 bits Write Control test
97 Division Improvements Skip first subtract Can t shift into quotient anyway Hence shift first, then subtract» Undo extra shift at end Hardware similar to multiplier Can store quotient in remainder register Only need 32b ALU» Shift remainder left vs. divisor right
98 S ta rt Improved Divider (F4.4). S h ift th e R e m a in d e r re g is t e r le ft b it 2. S u b tra c t t h e D iv is o r re g is te r fro m th e le f t h a lf o f th e R e m a in d e r re g is te r a n d p la c e th e re s u lt in th e le ft h a lf o f th e R e m a in d e r re g is te r R e m a in d e r > T e s t R e m a in d e r R e m a in d e r < 3 a. S h ift th e R e m a in d e r re g is te r to th e le ft, s e ttin g th e n e w rig h tm o s t b it to 3 b. R e s to re th e o rig in a l v a lu e b y a d d in g th e D iv is o r re g is te r to th e le ft h a lf o f th e R e m a in d e r re g is te r a n d p la c e th e s u m in th e le ft h a lf o f th e R e m a in d e r re g is te r. A ls o s h ift th e R e m a in d e r re g is te r to th e le ft, s e t tin g th e n e w rig h tm o s t b it to 3 2 n d re p e titio n? N o : < 3 2 re p e titio n s Y e s : 3 2 r e p e titio n s D o n e. S h ift le ft h a lf o f R e m a in d e r rig h t b it
99 Improved Divider (F4.4) Divisor 32 bits 32-bit ALU Remainder 64 bits Shift right Shift left Write Control test
100 Further Improvements Division still takes: 2 ALU cycles per bit position» to check for divisibility (subtract)» One to restore (if needed) Can reduce to cycle per bit Called non-restoring division Avoids restore of remainder when test fails
101 Non-restoring Division Consider remainder to be restored: R i = R i- d < Since R i is negative, we must restore it, right? Well, maybe not. Consider next step i+: R i+ = 2 x (R i ) d = 2 x (R i d) + d Hence, we can compute R i+ by not restoring R i, and adding d instead of subtracting d Same value for R i+ results Throughput of bit per cycle
102 NR Division Example Iteration Step Divisor Remainder Initial values Shift rem left 2: Rem = Rem - Div 3b: Rem < (add next), sll 2 2: Rem = Rem + Div 3b: Rem < (add next), sll 3 2: Rem = Rem + Div 3a: Rem > (sub next), sll 4 Rem = Rem Div Rem > (sub next), sll Shift Rem right by
103 2 s Complement Number line : N = N- non-negatives 2 N- negatives one zero how many positives?......
104 So what about subtraction? Develop subtraction circuit using the same process Truth table for each bit slice Borrow in from slice of lesser significance Borrow out to slice of greater significance Very much like carry chain Homework exercise
105 Finite representation? What happens when A + B > 2 N -? Overflow Detect?» Carry out What happens when A - B <? Negative numbers? Borrow out?
106 Number Systems Desirable properties: Efficient encoding (2 n bit patterns. How many numbers?) Positive and negative» Closure (almost) under addition and subtraction Except when overflow» Representation of positive numbers same in most systems» Major differences are in how negative numbers are represented Efficient operations» Comparison: =, <, >» Addition, Subtraction» Detection of overflow Algebraic properties?» Closure under negation?» A == B iff A B == Three Major schemes: sign and magnitude ones complement twos complement (excess notation)
107 Booth s Encoding Really just a new way to encode numbers Normally positionally weighted as 2 n With Booth, each position has a sign bit Can be extended to multiple bits Binary + - -bit Booth bit Booth
108 2-bits/cycle Booth Multiplier For every pair of multiplier bits If Booth s encoding is -2» Shift multiplicand left by, then subtract If Booth s encoding is -» Subtract If Booth s encoding is» Do nothing If Booth s encoding is» Add If Booth s encoding is 2» Shift multiplicand left by, then add
109 Booth s Example Negative multiplicand: -6 x 6 = -36 x, in Booth s encoding is +- Hence: x x x x + Final Sum: (-36)
110 Booth s Example Negative multiplier: -6 x -2 = 2 x, in Booth s encoding is - Hence: x x x x Final Sum: (-2)
Overview. ELEC2041 Microprocessors and Interfacing. Lecture 7: Number Systems - II. March 2006.
ELEC2041 Microprocessors and Interfacing Lecture 7: Number Systems - II http://webct.edtec.unsw.edu.au/ March 2006 Saeid@unsw.edu.au Overview Signed Numbers: 2 Complement representation Addition, Subtraction
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #2 Number Representation 2007-01-19 There is one handout today at the front and back of the room! Lecturer SOE Dan Garcia www.cs.berkeley.edu/~ddgarcia
More informationEE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring
EE 260: Introduction to Digital Design Arithmetic II Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Integer multiplication n Booth s algorithm n Integer division
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #1 Introduction & Numbers 2005-06-20 Andy Carle CS 61C L01 Introduction + Numbers (1) Are Computers Smart? To a programmer: Very complex
More informationProcessor. Lecture #2 Number Rep & Intro to C classic components of all computers Control Datapath Memory Input Output
CS61C L2 Number Representation & Introduction to C (1) insteecsberkeleyedu/~cs61c CS61C : Machine Structures Lecture #2 Number Rep & Intro to C Scott Beamer Instructor 2007-06-26 Review Continued rapid
More informationAre Computers Smart? To a programmer: Lecture #1 Introduction & Numbers Andy Carle. Are Computers Smart? What are Machine Structures?
CS 61C L01 Introduction + Numbers (1) insteecsberkeleyedu/~cs61c CS61C : Machine Structures Lecture #1 Introduction & Numbers 2006-06-26 Are Computers Smart? To a programmer: Very complex operations/functions:
More information1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #2 Number Representation 2014-09-03! There is one handout today at the entrance!!!senior Lecturer SOE Dan Garcia!!!www.cs.berkeley.edu/~ddgarcia!
More informationBits, bytes and digital information. Lecture 2 COMPSCI111/111G
Bits, bytes and digital information Lecture 2 COMPSCI111/111G Today s lecture Understand the difference between analogue and digital information Convert between decimal numbers and binary numbers Analogue
More informationComputer Architecture Set Four. Arithmetic
Computer Architecture Set Four Arithmetic Arithmetic Where we ve been: Performance (seconds, cycles, instructions) Abstractions: Instruction Set Architecture Assembly Language and Machine Language What
More informationChapter 3 Arithmetic for Computers
Chapter 3 Arithmetic for Computers 1 Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: Implementing the Architecture operation
More informationProcessor. Lecture #2 Number Rep & Intro to C classic components of all computers Control Datapath Memory Input Output }
CS61C L2 Number Representation & Introduction to C (1) insteecsberkeleyedu/~cs61c CS61C : Machine Structures Lecture #2 Number Rep & Intro to C 2005-08-31 There is one handout today at the front and back
More informationModule 2: Computer Arithmetic
Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N
More informationWeek 7: Assignment Solutions
Week 7: Assignment Solutions 1. In 6-bit 2 s complement representation, when we subtract the decimal number +6 from +3, the result (in binary) will be: a. 111101 b. 000011 c. 100011 d. 111110 Correct answer
More informationIntroduction to the Use of Computers
Introduction to the Use of Computers Christophe Rhodes crhodes@goldacuk Autumn 2012, Fridays: 10:00 12:00: WTA & 15:00 17:00: WHB 300 Bits and Bytes Bits A bit: 0 or 1; ( binary digit, or a digit in base
More informationTailoring the 32-Bit ALU to MIPS
Tailoring the 32-Bit ALU to MIPS MIPS ALU extensions Overflow detection: Carry into MSB XOR Carry out of MSB Branch instructions Shift instructions Slt instruction Immediate instructions ALU performance
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #2 Number Rep & Intro to C 2005-08-31 There is one handout today at the front and back of the room! Lecturer PSOE, new dad Dan Garcia www.cs.berkeley.edu/~ddgarcia
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.
UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive integer number (powers of ): DIGIT 3 4 5 6 7 8 9 Number:
More informationWhere are we? Compiler. translating source code (C or Java) Programs to assembly language And linking your code to Library code
Where are we? Compiler Instruction set architecture (e.g., MIPS) translating source code (C or Java) Programs to assembly language And linking your code to Library code How the software talks To the hardware
More informationEECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3
EECS15 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3 October 8, 22 John Wawrzynek Fall 22 EECS15 - Lec13-cla3 Page 1 Multiplication a 3 a 2 a 1 a Multiplicand b 3 b 2 b
More informationCOMP 303 Computer Architecture Lecture 6
COMP 303 Computer Architecture Lecture 6 MULTIPLY (unsigned) Paper and pencil example (unsigned): Multiplicand 1000 = 8 Multiplier x 1001 = 9 1000 0000 0000 1000 Product 01001000 = 72 n bits x n bits =
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-278: Digital Logic Design Fall Notes - Unit 4. hundreds.
ECE-78: Digital Logic Design Fall 6 UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive integer number (powers
More informationPrinciples of Computer Architecture. Chapter 3: Arithmetic
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 3: Arithmetic 3-2 Chapter 3 - Arithmetic 3.1 Overview Chapter Contents 3.2 Fixed Point Addition
More informationData Representation Type of Data Representation Integers Bits Unsigned 2 s Comp Excess 7 Excess 8
Data Representation At its most basic level, all digital information must reduce to 0s and 1s, which can be discussed as binary, octal, or hex data. There s no practical limit on how it can be interpreted
More informationHomework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures
Homework 3 Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) 1 CSCI 402: Computer Architectures Arithmetic for Computers (2) Fengguang Song Department
More informationDIGITAL SYSTEM DESIGN
DIGITAL SYSTEM DESIGN UNIT I: Introduction to Number Systems and Boolean Algebra Digital and Analog Basic Concepts, Some history of Digital Systems-Introduction to number systems, Binary numbers, Number
More informationMore complicated than addition. Let's look at 3 versions based on grade school algorithm (multiplicand) More time and more area
Multiplication More complicated than addition accomplished via shifting and addition More time and more area Let's look at 3 versions based on grade school algorithm 01010010 (multiplicand) x01101101 (multiplier)
More informationLecture 8: Addition, Multiplication & Division
Lecture 8: Addition, Multiplication & Division Today s topics: Signed/Unsigned Addition Multiplication Division 1 Signed / Unsigned The hardware recognizes two formats: unsigned (corresponding to the C
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2010 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review, but we will go over it for
More informationNumber Systems and Computer Arithmetic
Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text
More informationLecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)
Lecture Topics Today: Integer Arithmetic (P&H 3.1-3.4) Next: continued 1 Announcements Consulting hours Introduction to Sim Milestone #1 (due 1/26) 2 1 Overview: Integer Operations Internal representation
More informationComputer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers
Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Bits and Bytes and Numbers Number Systems Much of this is review, given the 221 prerequisite Question: how high can
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationMIPS Integer ALU Requirements
MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set
More informationVTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y
Arithmetic A basic operation in all digital computers is the addition and subtraction of two numbers They are implemented, along with the basic logic functions such as AND,OR, NOT,EX- OR in the ALU subsystem
More informationCPE300: Digital System Architecture and Design
CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10122011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Fixed Point Arithmetic Addition/Subtraction
More informationWhere we are going (today)
Where we are going (today) Q: How do we arrange bits in the memory of the computer? (why do we care? we want the computer to store many individual numbers) A: bytes and words 10110000 00001110 01000010
More informationCPS 104 Computer Organization and Programming
CPS 104 Computer Organization and Programming Lecture 9: Integer Arithmetic. Robert Wagner CPS104 IMD.1 RW Fall 2000 Overview of Today s Lecture: Integer Multiplication and Division. Read Appendix B CPS104
More informationDivide: Paper & Pencil
Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or
More informationComputer Architecture and Organization
3-1 Chapter 3 - Arithmetic Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 3 Arithmetic 3-2 Chapter 3 - Arithmetic Chapter Contents 3.1 Fixed Point Addition and Subtraction
More informationDIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute
DIGITAL TECHNIC Dr. Bálint Pődör Óbuda University, Microelectronics and Technology Institute 4. LECTURE: COMBINATIONAL LOGIC DEIGN: ARITHMETIC (THROUGH EXAMPLE) 2nd (Autumn) term 28/29 COMBINATIONAL LOGIC
More informationECE 30 Introduction to Computer Engineering
ECE 30 Introduction to Computer Engineering Study Problems, Set #6 Spring 2015 1. With x = 1111 1111 1111 1111 1011 0011 0101 0011 2 and y = 0000 0000 0000 0000 0000 0010 1101 0111 2 representing two s
More informationChapter 3: Arithmetic for Computers
Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering
More informationComputer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2
Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2011 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review for most of you, but we start
More informationChapter 3: part 3 Binary Subtraction
Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary adder-subtractors Signed binary
More informationChapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides
Chapter 3 Arithmetic for Computers 1 Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationMicrocomputers. Outline. Number Systems and Digital Logic Review
Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded
More information10.1. Unit 10. Signed Representation Systems Binary Arithmetic
0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system
More informationReview 1/2 MIPS assembly language instructions mapped to numbers in 3 formats. CS61C Negative Numbers and Logical Operations R I J.
CS61C Negative Numbers and Logical Operations cs 61C L7 Number.1 Lecture 7 February 10, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson) www-inst.eecs.berkeley.edu/~cs61c/schedule.html Review 1/2
More informationComputer Organization
Computer Organization Register Transfer Logic Number System Department of Computer Science Missouri University of Science & Technology hurson@mst.edu 1 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5,
More informationReview of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline
Today s Outline San Jose State University EE176-SJSU Computer Architecture and Organization Lecture 5 HDL, ALU, Shifter, Booth Algorithm Multiplier & Divider Instructor: Christopher H. Pham Review of Last
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationDLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 3 DLD P VIDYA SAGAR
DLD UNIT III Combinational Circuits (CC), Analysis procedure, Design Procedure, Combinational circuit for different code converters and other problems, Binary Adder- Subtractor, Decimal Adder, Binary Multiplier,
More informationRepresenting Information. Bit Juggling. - Representing information using bits - Number representations. - Some other bits - Chapters 1 and 2.3,2.
Representing Information 0 1 0 Bit Juggling 1 1 - Representing information using bits - Number representations 1 - Some other bits 0 0 - Chapters 1 and 2.3,2.4 Motivations Computers Process Information
More informationExcerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997
Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since ten-fingered humans are addicted to the decimal system, and since computers
More informationECE468 Computer Organization & Architecture. The Design Process & ALU Design
ECE6 Computer Organization & Architecture The Design Process & Design The Design Process "To Design Is To Represent" Design activity yields description/representation of an object -- Traditional craftsman
More informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 9: Binary Addition & Multiplication Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Pop Quiz! Using 4 bits signed integer notation:
More informationCOMP2121: Microprocessors and Interfacing. Number Systems
COMP2121: Microprocessors and Interfacing Number Systems http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Positional notation Decimal, hexadecimal, octal and binary Converting
More informationECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017
ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 Combinational Logic Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke) Last
More informationNUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah
NUMBER OPERATIONS Mahdi Nazm Bojnordi Assistant Professor School of Computing University of Utah CS/ECE 3810: Computer Organization Overview Homework 4 is due tonight Verify your uploaded file before the
More informationAt the ith stage: Input: ci is the carry-in Output: si is the sum ci+1 carry-out to (i+1)st state
Chapter 4 xi yi Carry in ci Sum s i Carry out c i+ At the ith stage: Input: ci is the carry-in Output: si is the sum ci+ carry-out to (i+)st state si = xi yi ci + xi yi ci + xi yi ci + xi yi ci = x i yi
More informationKinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other
Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers
More informationArithmetic Logic Unit
Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,
More informationLecture 2: Number Systems
Lecture 2: Number Systems Syed M. Mahmud, Ph.D ECE Department Wayne State University Original Source: Prof. Russell Tessier of University of Massachusetts Aby George of Wayne State University Contents
More informationInteger Multiplication and Division
Integer Multiplication and Division COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline
More information361 div.1. Computer Architecture EECS 361 Lecture 7: ALU Design : Division
361 div.1 Computer Architecture EECS 361 Lecture 7: ALU Design : Division Outline of Today s Lecture Introduction to Today s Lecture Divide Questions and Administrative Matters Introduction to Single cycle
More informationNumber Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010
Contents Number systems and conversion Binary arithmetic Representation of negative numbers Addition of two s complement numbers Addition of one s complement numbers Binary s Readings Unit.~. UNIT NUMBER
More informationArithmetic Circuits. Nurul Hazlina Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit
Nurul Hazlina 1 1. Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit Nurul Hazlina 2 Introduction 1. Digital circuits are frequently used for arithmetic operations 2. Fundamental
More informationBinary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T.
Binary Arithmetic Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. MIT 6.004 Fall 2018 Reminder: Encoding Positive Integers Bit i in a binary representation (in right-to-left order)
More informationCOMPUTER ARITHMETIC (Part 1)
Eastern Mediterranean University School of Computing and Technology ITEC255 Computer Organization & Architecture COMPUTER ARITHMETIC (Part 1) Introduction The two principal concerns for computer arithmetic
More informationWhere we are going (today)
Where we are going (today) Q: How do we arrange bits in the memory of the computer? (why do we care? we want the computer to store many individual numbers) A: bytes and words 10110000 00001110 01000010
More information(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)
COMPUTER ARITHMETIC 1. Addition and Subtraction of Unsigned Numbers The direct method of subtraction taught in elementary schools uses the borrowconcept. In this method we borrow a 1 from a higher significant
More informationComputer Organization and Structure. Bing-Yu Chen National Taiwan University
Computer Organization and Structure Bing-Yu Chen National Taiwan University Arithmetic for Computers Addition and Subtraction Gate Logic and K-Map Method Constructing a Basic ALU Arithmetic Logic Unit
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationRepresentation of Non Negative Integers
Representation of Non Negative Integers In each of one s complement and two s complement arithmetic, no special steps are required to represent a non negative integer. All conversions to the complement
More informationDIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS
C H A P T E R 6 DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS OUTLINE 6- Binary Addition 6-2 Representing Signed Numbers 6-3 Addition in the 2 s- Complement System 6-4 Subtraction in the 2 s- Complement
More informationCombinational Logic Use the Boolean Algebra and the minimization techniques to design useful circuits No feedback, no memory Just n inputs, m outputs
Combinational Logic Use the Boolean Algebra and the minimization techniques to design useful circuits No feedback, no memory Just n inputs, m outputs and an arbitrary truth table Analysis Procedure We
More informationBINARY SYSTEM. Binary system is used in digital systems because it is:
CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System
More informationBasic Arithmetic (adding and subtracting)
Basic Arithmetic (adding and subtracting) Digital logic to show add/subtract Boolean algebra abstraction of physical, analog circuit behavior 1 0 CPU components ALU logic circuits logic gates transistors
More informationCS/COE 0447 Example Problems for Exam 2 Spring 2011
CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4-bit numbers 3 and 5 with the fast shift-add multipler. Use the table below. List the multiplicand (M) and product
More informationDLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR
UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error
More informationCS 64 Week 1 Lecture 1. Kyle Dewey
CS 64 Week 1 Lecture 1 Kyle Dewey Overview Bitwise operation wrap-up Two s complement Addition Subtraction Multiplication (if time) Bitwise Operation Wrap-up Shift Left Move all the bits N positions to
More informationArithmetic Processing
CS/EE 5830/6830 VLSI ARCHITECTURE Chapter 1 Basic Number Representations and Arithmetic Algorithms Arithmetic Processing AP = (operands, operation, results, conditions, singularities) Operands are: Set
More information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides
More informationChapter 3 Arithmetic for Computers (Part 2)
Department of Electr rical Eng ineering, Chapter 3 Arithmetic for Computers (Part 2) 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Depar rtment of Electr rical Eng ineering, Feng-Chia Unive
More informationCS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29
CS 31: Introduction to Computer Systems 03: Binary Arithmetic January 29 WiCS! Swarthmore Women in Computer Science Slide 2 Today Binary Arithmetic Unsigned addition Subtraction Representation Signed magnitude
More informationSlide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng
Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section
More informationWhere we are going (today)
Where we are going (today) Q: How do we arrange bits in the memory of the computer? (why do we care? we want the computer to store many individual numbers) A: bytes and words 10110000 00001110 01000010
More informationCAD4 The ALU Fall 2009 Assignment. Description
CAD4 The ALU Fall 2009 Assignment To design a 16-bit ALU which will be used in the datapath of the microprocessor. This ALU must support two s complement arithmetic and the instructions in the baseline
More informationData Representation 1
1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationCS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader
CS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader Number representation (See: Lecture 2, Lab 1, HW#1) KNOW: Kibi (2 10 ), Mebi(2 20 ), Gibi(2 30 ), Tebi(2
More informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many
More informationNumber Systems. Readings: , Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs
Number Systems Readings: 3-3.3.3, 3.3.5 Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches Missing: Way to implement
More informationLec-6-HW-3-ALUarithmetic-SOLN
Lec-6-HW-3-ALUarithmetic-SOLN Reading, PP, Chp 2: 2.1 (Bits and datatypes) 2.2 (signed and unsigned integers) 2.3 (2's complement) 2.4 (positional notation) 2.5 (int. add/sub, signed/unsigned overflow)
More informationCS6303 COMPUTER ARCHITECTURE LESSION NOTES UNIT II ARITHMETIC OPERATIONS ALU In computing an arithmetic logic unit (ALU) is a digital circuit that performs arithmetic and logical operations. The ALU is
More information