HOME / ¹®¼°øÀ¯ / ¸®Æ÷Æ®/³í¹® / ±â¼ú°øÇÐ
0
0°ÇÀÇ Èı⺸±â(¿µ¹®) Computer Arithmetic¿¡ ´ëÇØ ±â¼úÇÑ ¸®Æ÷Æ® Âü°íÀÚ·áÀÔ´Ï´Ù.
arithmetic & logic unit roles of alu does the computations
everything else in the computer is there to service this unit handles integers
fpu (floating point unit)-arithmetic unit that handles floating point (real) numbers
implementation
all microprocessors has integer alus on-chip or off-chip fpu (co-processor)
alu inputs and outputs prentice hall inc.all rights reserved integer representation
only have 0 & 1 to represent everything two representative representations
sign-magnitude two¡¯s compliment sign-magnitude left most bit is sign bit 0 means positive 1 means negative example xxxx.xx.xx
-xxxx.xx.xx010
problems
need to consider both sign and magnitude in arithmetic two representations of zero (0 and-0)
2¡¯s complement given n, 2¡¯s complement of n with n bits
2n-n (2n-1)-n 1 bit complement of n 1 32 bit number
positive numbers : 0 (x 00) to xxx-xxx (x7fffffff) negative numbers :-1 (xffffffff) to-231 (x8 )
like sign-magnitude, msb represents the sign bit
examples 3 011 2 010 1 001 0
-1 111
-2 110
-3 101
-4 100
characteristics of 2¡¯s complement a single representation of zero
negation is fairly easy (bit complement of n 1)
3 11 boolean complement gives xxxx.xx.xx add 1 to lsb xxxx.xx.xx overflow occurs only
when the sign bit of two numbers are the same but the result has the opposite sign (v cn cn-1)
arithmetic works easily (see later)
to perform a-b, take the 2¡¯s complement of b and add it to a a (2n-b) a-b 2n (if a > b, ignore the carry)
2n-(b-a) (if b > a, 2¡¯s complement of b-a)
operation a b overflow condition a b
-
a b (ÀÌÇÏ »ý·«)
¹ÞÀº º°Á¡
0/5
0°³ÀÇ º°Á¡
¹®¼°øÀ¯ ÀڷḦ µî·ÏÇØ ÁÖ¼¼¿ä.
¹®¼°øÀ¯ Æ÷ÀÎÆ®¿Í Çö±ÝÀ» µå¸³´Ï´Ù.
Æ÷ÀÎÆ® : ÀÚ·á 1°Ç´ç ÃÖ´ë 5,000P Áö±Þ
Çö±Ý : ÀÚ·á 1°Ç´ç ÃÖ´ë 2,000¿ø Áö±Þ