13.07.2015 Views

2 nin kuvvetleri Ilgili prefixes ler

2 nin kuvvetleri Ilgili prefixes ler

2 nin kuvvetleri Ilgili prefixes ler

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Kucuk<strong>ler</strong>• milli one thousandth 10 ^ -3• micro one millionth 10 ^ -6• nano one billionth 10 ^ -9• pico one trillionth 10 ^ -12• Start with small letters• Speed of light is 1 foot per nanosecond• Decimal• Octal• Hexadecimal•BinaryNumber systems56Decimal system, base 10• History -- we have 10 fingers• 253 means 2*100 + 5*10 + 3*1• 1,10,100 (from R to L) are the “weights”• 10 digits, values 0 through 9• After 9 comes 10 (double digits)Octal system, base 8• Mickey Mouse has 8 fingers• 253 means 2*64 + 5*8 + 3*1• 1, 8, 64 agirliklari gosterir• 8 digits, deger<strong>ler</strong> 0 dan 7 ye kadar• 7 den sonra 10 gelir• Octal system bazi eski bilgisayarda bellekaddress <strong>ler</strong>i<strong>nin</strong> gosterimi icin kullanilirdiOrnek: 17746278


Hexadecimal system, base16• 16 digits, deger<strong>ler</strong> 0 - 9 ve A-F• 3B6 = 3*256 + B*16 + 6*1• Agirliklar 1, 16, 256• F den sonra 10 gelir• Modern bilgisayarlarda bellek address <strong>ler</strong>inigostermek icin kullanilmaktadirOrnek: 3C0F95EABinary system, base 2• 2 digits, deger<strong>ler</strong> 0 ve 1• 1011 = 1*8 + 0*4 + 1*2 + 1*1• Agirliklar: 1, 2, 4, 8• 1 den sonra 10 gelir• 0 1 10 11 100 101 110 111 1000910Binary system, base 2• Bilgisayarlarda hesaplamalar binary systeme gore olur• Bellege ve diske instruction ve data <strong>nin</strong>depolanmasinda kullanilir• Insanlar icin pratik degildir• 100101011101 = 4701Nnumber systems• Bilgisyarda hesaplamalar binary systeme goreyapilir• Kullanici icin input/output decimal systemegore gerceklenir• Software binary i decimal e ve decimal i debinary e cevirir1112


Convert Binary to DecimalConvert Decimal to Binary• Binary Value 10101 2• 1*16 + 0*8 + 1*4 + 0*2 + 1*1 = 21 1053 10 = 110101 2• Aasgidaki<strong>ler</strong>i cevir:• 1100 = ?• 1001 = ?• 0111 = ?1353 21 5 164 32 16 8 4 2 11 1 0 1 0 118 10 = ?31 10 = ?14Decimal notation with fractions• 72.53 10 = 7*10 + 2*1 + 5*.1 + 3*.01• “.” decimal point i gosterir• Agirliklar 100 10 1 “.” .1 .01 .001• Bu scientific notation degil• Bu floating point gosterimi degilBinary notation with fractions• 110.10 2 =1*4 + 1*2 + 0*1 + 1*.5 + 0*.25 = 6.5 10• “.” binary point i gosterir• Agirliklar 8 4 2 1 “.” 1/2 1/4 1/8• Bu scientific notation degil• Bu floating point gosterimi degil• 11.11 10 = ? decimal1516


Decimal, Hexadecimal, OctalDec Hex Oc Dec Hex Oct0 0 000 8 8 10001 1 001 9 9 10012 2 010 10 A 10103 3 011 11 B 10114 4 100 12 C 11005 5 101 13 D 11016 6 110 14 E 11107 7 111 15 F 1111Convert Binary to Power 2 base• Very easy -- convert digit-by-digit• A27F 1010 0010 0111 1111 (Hex-Bin)• 327 011 010 111 (Octal-Binary)• B4C5 = ?• 1010 0110 1001 = ?1718Binary-coded decimal (BCD)• Defn: Store each decimal digit in binary• Ornek: 259 stored as 0010 0101 1001• Pro: digit-by-digit conversion is easy• Con: Takes 4 bits per digit, uses only 10,• 16 degerden 6 tanesi kullanilmaz, 62 pctefficient• Eski makinalarda, ozellikle malihesaplamalarda kullanilirdiBits Bytes Words• Bit<strong>ler</strong> nasil birlestirilmeliki pratiktekullanilabilir sey<strong>ler</strong> yapilabilsin?1920


Binary Digit (Bit)• Bilgi depolamada temel birim• 2 durum soz konusu: 0-1, T-F, umkunOn-Off, High-Low• A coin flip is a binary digit: Head or Tail• A light switch is a binary digit: Off or On• Iki deger alabilen herhengi bir seyi 1 bitletemsil etmekCombi<strong>nin</strong>g bits• 1 bit in 2 durumu var: 0 1• 2 bit in 4 duumu var : 00 01 10 11• 3 bit in 8 durumu var:000 001 010 011 100 101 110 111• N bit in 2 N durumu var2122Byte• 8 bit ten olusan grup• 256 durumu var• 1 byte 256 fakli durumu temsil edebilir• Disk ve memory kapasite<strong>ler</strong>i byte olarakifade edilirCombine bytes into words• Yaygin kullanilan word buyukluk<strong>ler</strong>i:– 16 bits (2 bytes) 64K degisik durumu temsil eder– 32 bits (4 bytes) 4 billion degisik durum– 64 bits (8 bytes) 16 quintillion degisik durum• Word size standard degil, bilgisyardanbilgisayara degisebilir– MIPS word <strong>ler</strong>i 32 bits2324


Most, LeastSignificantBitLabel bit positionsMSBLSB10011010010110110 151001101001011011StandardCommonBus, buses• Bus: big vehicle you ride in (otobus)• Bus (computers): collection of wires15 01001101001011011Less commonMIPS2526Bus nasil temsil edilir?MSBLSB100110100101101116To somewhereBit<strong>ler</strong> sunu temsil edebilir<strong>ler</strong>…….• addresses•integers• floating point numbers• characters• instructions• states, e.g., that a calculated result is negative2728


Addressing individual itemsMSB10011LSB5Memory32 LocationsLinearAddress00000Page2Addressing pages and items10 011Location3Page 08 items,numbered 0-7Page 1LinearAddress000000-OriginRange 0-311111129Memory4 pages8 items per pagePage 2Page 38 items,numbered 0-71111130Memory: important message• Memory (paged) bir linear array (dizi) olarakdusunulebilir• Dolayisiyle onceki iki slides gercekte ayni seyi ifadeeder<strong>ler</strong>• Farklilik sadece onlari nasil dusundugumuzdenkaynaklanmakta• Difference is only in how we think about them• Daha sonra instruction ve data <strong>nin</strong> memory e(DRAM) page <strong>ler</strong> halinde getirildik<strong>ler</strong>ini gorecegizBit<strong>ler</strong> sunu temsil edebilir…….• addresses•integers• floating point numbers• characters• instructions• states, e.g., that a calculated result is negative3132


Use 3 bits for an integer• 8 fakli durum temsil edilebilir• Her bir durum farkli bir bit permutasyonuile temsil edilir331-Origin, 3-bit integerbits represent000 1001 2010 3011 4100 5101 6110 7111 8Natural count 1-88 is highest valueNo zero representedNo negative numbers340-Origin, 3-bit integerSign and Magnitude, 3-bit integerbits represent000 0001 1010 2011 3100 4101 5110 6111 7Unnatural count 0-77 is highest valueGreat for addressingZero is representedNo negative numbers35bits represent111 -3110 -2101 -1100 -0000 0001 1010 2011 3Neg ve Pos deger<strong>ler</strong>Dogal olmayan sayma2 tane 0 var3 en buyuk degerMSB sign bit i gosterirCarpma islemindekolaylikBazi ozel durumlardakullanilir36


One’s complement, 3-bit integerTwo’s complement, 3-bit integerbits represent100 -3101 -2110 -1111 -0000 0001 1010 2011 3Neg ve Pos numbersFlip bits to negate (sayi<strong>nin</strong>egative ini bulmak icin1 <strong>ler</strong> 0 lara 0 lar 1 <strong>ler</strong>edonusturulur)Unnatural countingIki tane 0 varEn buyuk deger 3MSB sign bit idir37Nadiren kullanilirbits represent100 -4101 -3110 -2111 -1000 0001 1010 2011 3Neg ve Pos numbersNatural countingTek bir 0 varWeights: -4 2 1En yuksek deger 3MSB sign bit ini gosterirToplama icin buyukkolaylikStandard for computers38Two’s complement, 16-bit integerbitsrepresent1000 0000 0000 0000 -327681000 0000 0000 0001 -327671111 1111 1111 1110 -21111 1111 1111 1111 -10000 0000 0000 0000 00000 0000 0000 0001 1Two’s complement icin araliklar• 4 bits, range: -8 ……+7• 16 bits, range: -32768 …… +32767• N bits, range: -2^(N-1) …… 2^(N-1) - 10111 1111 1111 1111 327673940


Negate a number in 2’s comp• Butun bit<strong>ler</strong>i flip (invert) et ve 1 ekle• Negate 3: 0011 1101• Negate -3: 1101 0011• Negate 6 ? Negate -8 ?• Negate -6 ?• Negate 0 ?Largest negative 2’s comp value• En kucuk negative sayi<strong>nin</strong> positive i yokcunku bu positive sayi belirlenen alana sigmaz• Eger algorithmayi uygularsak?–4 bits:– Negate -8 1000 (flip) 0111 (add 1) 1000– Baslangictaki deger elde edildi!4142Invert ve Negate• Invert: Her bir bit flip ( 0 sa 1, 1 se 0 sifir)edilir. Ayni zamanda bu isleme“Complement” de denir• Negate (sayiyi negative lemek anlaminagelir) sayiyi flip le ve sonra 1 ekle2’s complement inde kac tanesign bit i var?• 5– 0101 (4 bit)– 000101 (6 bit)– 00000101 (8 bit)• Sign bit MSB ile ayni• -5:– 1011 (4 bit)– 111011 (6 bit)– 11111011 (8 bit)4344


2’s comp icin sign extension• Eger bir degeri daha genis bir formatakopyalarsak, sign bit I sola dogru extend edilir• 0100– 0100– 00000100– 00000000 00000100– 00000000 00000000 00000000 00000100• 1101– 1101– 11111101– 11111111 11111101– 11111111 11111111 11111111 1111110145Bit <strong>ler</strong> sunu temsil edebilir …….• addresses•integers• floating point numbers• characters• instructions• states, e.g., that a calculated result is negative46Decimal formatta scientificnotation• Buyuk sayi: 6.02 x 10 23• Kucuk sayi: 1.32 x 10 -9• 3 digit mantissa, 2 digit exponent• Very wide range, inexact representation,• imperfect accuracy, exponent can be + or -• Can shift: 0.602 x 10 24• Normalized form: one digit to left of dec point47Normalized Number• 0.000000001 10 = 1.0 10 x 10 -9• 3,155,760,000 10 = 3.15576 10 x 10 9• Yukaridaki iki sayi scientific notation dayazilmistir (Nokta <strong>nin</strong> solunda sadece bir digitvar)• Normalized number : en solda 0 bulundurmayanscientific notation da yazili number a denir.–1.0 10 x 10 -9 normalized scientific notation–0.1 10 x 10 -8 normalized scientific notation da degil– 10.0 10 x 10 10 normalized scientific notationda degil48


Floating Point Number• Binary tabanli ve normalized duzende yazilisayilara Floating Point Number (FPN) denir• C dilinde float ile declare edilir<strong>ler</strong>•1.0 2 x 2 -1• 1.xxxxxxx 2 x 2 yyyyy– xxxxxxx fraction kismini olusturur– yyyyy exponent kismini olusturur49IEEE 754 Standard• IEEE 754 Standard modern bilgisyarlarda floatingpoint number lar temsil etmek icin kullanilanstandard dir.• 1980 den sonra cikan hemen hemen tumbilgisayarlar bu standardi kullanir• Iki tur standard var– 32 bits ( single precision) ( C de float)• 1 bit sign, 8 bit exponent, 23 bit significant (mantissa)– 64 bits (double precision) ( C de double)• 1 bit sign, 11 bit exponent, 52 bit significant (mantissa)• Her ikisinde de exponent <strong>ler</strong> icin biased noatationkullanilir– 127: singleprecision50– 1023: double precisionOrnekSExponentSignificandS17.1517 .1510001 .001001E10001.00100141.0001001001. 20 10000011 00010010011001100110011F.15 *2 = 0.3 0.3 * 2 = 0.6 0.6 * 2 = 1.2 1.2 * 2 = 0.4 0.4 * 2 = 0.8 0.8 * 2 = 1.6 1.6 * 2 = 1.2 1510 10000011 00010010011001100110011Binary conversion:(-1) s x (1+Significand) x 2(Exponent – Bias)(-1) 0 x (1 + 2 -4 + 2 -7 +2 -10 + 2 -11 + 2 -14 + 2 -15 + 2 -18 + 2 -19 + 2 -22 + 2 -23 )x 2 (131-127) ¡ 17.1552


-0.75 100.75 x 2 = 1.50.5 x 2 = 1.0-0.75 10 = - 0.11 = - 1.1 x 2 -11 01111110 10000000000000000000000 Single precision1011111111101000000000000000000000000000000000000000000000000000Double precisionBit<strong>ler</strong> sunu temsil edebilir<strong>ler</strong>…….• addresses•integers• floating point numbers• characters• instructions• states, e.g., that a calculated result is negative5354Characters• Character <strong>ler</strong> ASCII code unda temsil edilir<strong>ler</strong>• ASCII–American Standard Code for Information Interchange• Her bir character 1 byte la temsil edilir– ABC 65 10 66 10 67 10 0x414243• String <strong>ler</strong> ASCII null character i ile sonlanir– Null in ASCII kod karsiligi 0 (0x00) dir• For string, terminate with ASCII null, code 0• Full table in H&P, page 14255Bit <strong>ler</strong> sunu temsil edebilir<strong>ler</strong>…….• addresses•integers• floating point numbers• characters• instructions• states, e.g., that a calculated result is negative56


From the Three levels of language• Machine Language• op code addr 1 addr 2• 10100101 1011010, 1010010• 10010101 1101101, 1110101• 10010101 1101001, 1110101• 11101101 1101100, 1101101• Instructions ve addresses bit <strong>ler</strong>le temsil edilirAll these bits can represent…….• addresses•integers• floating point numbers• characters• instructions• states, e.g., that a calculated result is negative5758Storage of state information• Processor da current instruction (executeedilmekte olan instruction ) in address i<strong>nin</strong>bilinmesi gerekli– Bu address bilgisi PC denen (Program Counter)registerinda tutulur.• Hesap sonucuyla ilgili durum bilgi<strong>ler</strong>i– CarryOut, Negative, Overflow• Microcode un current step i– Microcoded instructions larda instruction in executeolmasi bir cok adimdan gecer59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!