Logic and Computer Design Fundamental

55
1 Logic and Computer Design Fundamental Chapter 1 Digital and Computer Information M. Mano & Charles R. Kime 2008, Pearson Education, Inc

description

Logic and Computer Design Fundamental. Chapter 1 Digital and Computer Information M. Mano & Charles R. Kime 2008, Pearson Education, Inc. Overview. Sistem Komputer dan Sistem Digital Representasi Informasi Sistem Bilangan [biner, oktal dan heksadesimal] Operasi Aritmatik - PowerPoint PPT Presentation

Transcript of Logic and Computer Design Fundamental

Page 1: Logic and Computer Design Fundamental

1

Logic and Computer Design Fundamental

Chapter 1Digital and Computer Information

M. Mano & Charles R. Kime2008, Pearson Education, Inc

Page 2: Logic and Computer Design Fundamental

2

Overview• Sistem Komputer dan Sistem

Digital • Representasi Informasi• Sistem Bilangan [biner, oktal dan

heksadesimal]• Operasi Aritmatik • Dasar Konversi• Kode Desimal [BCD (binary coded

decimal), parity]• Kode Gray• Kode Alphanumeric

Page 3: Logic and Computer Design Fundamental

3

Sistem Digital

• Mengambil satu set informasi diskrit inputs dan informasi diskrit internal (system state) dan menghasilkan satu set informasi diskrit outputs.

System State

DiscreteInformationProcessing

System

DiscreteInputs Discrete

Outputs

Page 4: Logic and Computer Design Fundamental

4

Tipe2 dari sistem digital

• Tanpa kondisi (No state present)– Sistem Logika kombinasi– Output = Fungsi (Input)

• Dengan kondisi(State present)– Kondisi di-updated pada waktu diskrit

=> Sistem Urutan Synchronous– Kondisi di-updated setiap waktu

=> Sistem Urutan Asynchronous– Kondisi/keadaan = Function (Keadaan,

Input)– Output = Fungsi (Keadaan)

atau Fungsi Keadaan (Keadaan, Input)

Page 5: Logic and Computer Design Fundamental

5

Contoh Sistem Digital:Penghitung Digital (Digital Counter (e. g., odometer):

1 30 0 5 6 4Count Up

Reset

Inputs: Count Up, Reset Outputs: Visual Display State: "Value" of stored digits

Synchronous or Asynchronous?

Page 6: Logic and Computer Design Fundamental

6

Contoh Komputer Digital

Synchronous or Asynchronous?

Inputs: Keyboard, mouse, modem, microphone

Outputs: CRT, LCD, modem, speakers

Memory

Controlunit

Datapath

Input/Output

CPU

Page 7: Logic and Computer Design Fundamental

7

Sinyal

• Suatu variabel informasi yang dinyatakan dengan besaran fisik.

• Untuk Sistem digital, variabel diambil pada nilai diskrit.

• Dua level, atau nilai biner yang umum dipakai sebagai nilai pada sistem digital.

• Nilai Biner dinyatakan dengan :– digits 0 and 1– words (symbols) False (F) and True (T)– words (symbols) Low (L) and High (H) – and words On and Off.

• Nilai biner dapat juga dinyatakan dalam nilai atau range dari kwantitas fisik.

Page 8: Logic and Computer Design Fundamental

8

• Sebutkan physical quantities yang lain yang menyatakan 0 and 1?

– CPU Voltage– Disk– CD– Dynamic RAM

Nilai Biner: Kwantitas fisik yang lain

Magnetic Field DirectionSurface Pits/Light

Electrical Charge

Page 9: Logic and Computer Design Fundamental

Kedepan….Sistem Embedded

• Komputer sebagai bagian integral dari produk yang lain.

• Contoh dari komputer embedded– Microcomputers– Microcontrollers– Digital signal processors

Chapter 1 9

Page 10: Logic and Computer Design Fundamental

Sistem Embedded

• Contoh dari Aplikasi Sistem Embedded– Cell phones– Automobiles – Video games– Copiers– Dishwashers– Flat Panel TVs– Global Positioning Systems

Chapter 1 10

Page 11: Logic and Computer Design Fundamental

Embedded systems overview

• Sistem komputasi ada di-mana-mana.

• Umumnya orang hanya berpikir tentang komputer “desktop”– PC’s– Laptops– Mainframes– Servers

• Tetapi ternyata ada sistem yang lain dari tipe komputasi

• Sejauh ini yang lebih dikenal….....

Page 12: Logic and Computer Design Fundamental

• Sistem Komputasi Embedded – Computing systems

embedded within electronic devices

– Hard to define. Nearly any computing system other than a desktop computer

– Billions of units produced yearly, versus millions of desktop units

– Perhaps 50 per household and per automobile

Computers are in here...

and here...

and even here...

Lots more of these, though they cost a lot less each.

Page 13: Logic and Computer Design Fundamental

Sebagian daftar dari Sistem embedded.

Daftar ini akan berlanjut terus…sesuai perkembangan

Anti-lock brakesAuto-focus camerasAutomatic teller machinesAutomatic toll systemsAutomatic transmissionAvionic systemsBattery chargersCamcordersCell phonesCell-phone base stationsCordless phonesCruise controlCurbside check-in systemsDigital camerasDisk drivesElectronic card readersElectronic instrumentsElectronic toys/gamesFactory controlFax machinesFingerprint identifiersHome security systemsLife-support systemsMedical testing systems

ModemsMPEG decodersNetwork cardsNetwork switches/routersOn-board navigationPagersPhotocopiersPoint-of-sale systemsPortable video gamesPrintersSatellite phonesScannersSmart ovens/dishwashersSpeech recognizersStereo systemsTeleconferencing systemsTelevisionsTemperature controllersTheft tracking systemsTV set-top boxesVCR’s, DVD playersVideo game consolesVideo phonesWashers and dryers

Page 14: Logic and Computer Design Fundamental

Tiga kunci teknologi sistem embedded.

Teknologi Suatu penyelesaian tugas/pekerjaan

terutama dengan menggunakan technical processes, metode2, atau pengetahuan

Tiga kunci teknologi sistem embedded. – IC technology– Processor technology– Design technology

Page 15: Logic and Computer Design Fundamental

15

Representasi Sistem Bilangan

• Radix Positif, positional sistem bilangan• Suatu bilangan dengan radix r adalah

menyatakan untaian dari digit: An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m 1 A- m

yang mana 0 Ai < r dan . Adalah titik radix

• Untaian digit menyatakan urutan pangkat.

(Number)r = j = - m

jj

i

i = 0i rArA

(Integer Portion) + (Fraction Portion)

i = n - 1 j = - 1

Page 16: Logic and Computer Design Fundamental

16

Contoh – Sistem BilanganUmum Desimal Biner

Radix (Basis) r 10 2

Digits 0 => r - 1 0 => 9 0 => 1

0123

Pangkat dr 4

Radix 5-1-2-3-4-5

r0

r1

r2

r3

r4

r5

r -1

r -2

r -3

r -4

r -5

1101001000

10,000100,000

0.10.010.0010.00010.00001

124816320.50.250.1250.06250.03125

Page 17: Logic and Computer Design Fundamental

17

Pangkat Spesial dari 2

210 (1024) is Kilo, denoted "K"

220 (1,048,576) is Mega, denoted "M"

230 (1,073, 741,824)is Giga, denoted "G"

Page 18: Logic and Computer Design Fundamental

18

• Berguna sebagai dasar konversi.

Exponent Value Exponent Value 0 1 11 2,048 1 2 12 4,096 2 4 13 8,192 3 8 14 16,384 4 16 15 32,768 5 32 16 65,536 6 64 17 131,072 7 128 18 262,144

19 524,288 20 1,048,576 21 2,097,152

8 256 9 512

10 1024

Pangkat Positif dari 2

Page 19: Logic and Computer Design Fundamental

19

Decimal (Base 10)

Binary (Base 2)

Octal (Base 8)

Hexadecimal (Base 16)

00 00000 00 00 01 00001 01 01 02 00010 02 02 03 00011 03 03 04 00100 04 04 05 00101 05 05 06 00110 06 06 07 00111 07 07 08 01000 10 08 09 01001 11 09 10 01010 12 0A 11 01011 13 0B 12 01100 14 0C 13 01101 15 0D 14 01110 16 0E 15 01111 17 0F 16 10000 20 10

• Bagus…sebagai bahan pengingat.

Angka dengan dasar/basis yang berbeda

Page 20: Logic and Computer Design Fundamental

20

Hubungan pada Sistem Bilangan

Sifat-sifat Sistem Desimal :a. Terdiri dari 10 bilangan pokokb. Pangkat terkecil (0), makin kekiri

bertambah dengan 1c. Koefisien : 0,1,….10d. Jika dalam satu kolom koefisien

melebihi bil dasarnya pindah kekiri dengan penambahan 1

Page 21: Logic and Computer Design Fundamental

21

Hubungan penting yang harus diingat :

• Satu bilangan Oktal terdiri dari 3 bil biner

• Satu bilangan Heksadesimal terdiri dari 4 bil biner

Hubungan dapat digambarkan sbb : 161 160

82 81 80

2526 212428 23 22 2027

Page 22: Logic and Computer Design Fundamental

22

CARA MENGUBAH DARI MASING-MASING SISTEM BILANGAN :

1. Desimal ke Biner :

• Integer : Dibagi dengan 2 berturutan dan masing- masing sisanya merupakan bagian bil biner tersebut .

Contoh : Contoh : 11/211/2 5 sisa 1 5/2 2 sisa 1 (1011) 2

2/2 1 sisa 0

• Pecahan : Dikalikan dengan 2 berturutan dan bil bulatnya merupakan bil biner

Page 23: Logic and Computer Design Fundamental

23

Contoh :Contoh : 0,8125 x 2 = 1,6250 0,8125 x 2 = 1,6250 1 0,6250 x2 = 1,2500 1

0,2500x 2 = 0,5000 0 (1101)2

0,5000x2 = 1,0000 1

Jadi : (11,8125 ) 10 = ( 1011,1101)2

2. Biner ke Desimal• Integer : Masing-masing bilangan biner dikalikan 2 dengan pangkat paling belakang = 0 sedang makin kekiri bertambah dengan 1

Contoh : (100110) 2 = (-----) 10

Page 24: Logic and Computer Design Fundamental

24

(100110)2 = 1x25 + 0x24 +0x23+1x22+1x21+0x20

= 32 + 4 + 2 = 38

• Pecahan : Masing-masing bil biner dikalikan 2, dan pamgkatnya paling depan = 0, makin kekanan berkurang dengan 1

Contoh : (0.1101)2 + (………….) 10

(0.1101) 2 = 0x20+1x2-1+1x2-2+0x2-3+1x2-4

= 0,5 + 0,25 + 0,0625 = 0,8125

Page 25: Logic and Computer Design Fundamental

25

3. Oktal ke Biner: Masing-masing bil diterjemah- kan dalam biner dan tiap

bilangan harus terdiri dari 3 bil biner

Contoh : (7314) 8

7 3 1 4 (111) (011) (001) (100)

(111 011 001 100 )2

4. Desimal ke Oktal : Analog dengan butir 1 dengan bil dasar 85. Oktal ke Desimal : Analog dengan butir 2 dengan bil dasar 8

Page 26: Logic and Computer Design Fundamental

26

Untuk Heksadesimal ke Biner, Desimal ke Heksadesimal serta Heksadesimal ke Desimal

Analog dengan butir 3,4,5

CARA PERHITUNGAN PADA SISTEM BINER:Penjumlahan : Contoh :0+1 = 1 1 0 1 1 0 yang ditambah0+0 = 0 1 0 1 1 1 penambah1+0 = 1 1 0 1 1 0 1 Jumlah1+1 = (1) 0

Pengurangan : analogi dengan penjumlahan hanya ada ‘pinjaman’ bila diperlukan

Page 27: Logic and Computer Design Fundamental

27

Contoh : 1 0 1 1 0 1 Yang dikurang

1 0 0 1 1 1 Pengurang

0 0 0 1 1 0 Selisih

Perkalian :

1 0 1 1 Yang dikalikan 1 0 1 Pengali 1 0 1 1 0 0 0 01 0 1 11 1 0 1 1 1 Hasil perkalian

Page 28: Logic and Computer Design Fundamental

28

• Untuk mengkonversi ke desimal, gunakan aritmatika desimal untuk membentuk:

(digit × respective power of 2).• Example:Convert 110102 to N10:  

Konversi Biner ke Desimal

Page 29: Logic and Computer Design Fundamental

29

• Metode ke-1– Subtract the largest power of 2 that

gives a positive remainder and record the power.

– Repeat, subtracting from the prior remainder and recording the power, until the remainder is zero.

– Place 1’s in the positions in the binary result corresponding to the powers recorded; in all other positions place 0’s.

• Example: Convert 62510 to N2

Konversi Desimal ke Biner

Page 30: Logic and Computer Design Fundamental

30

Dasar Umum sistem bilangan

Nama Radix Digits

Biner 2 0,1

Oktal 8 0,1,2,3,4,5,6,7

Desimal 10 0,1,2,3,4,5,6,7,8,9

Heksadesimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Enam huruf (penambahan dari angka integer 10)

dalam heksadesimal menyatakan: A – F = 10 - 15

Page 31: Logic and Computer Design Fundamental

31

Konversi antar Dasar (basis)

Metode 2 Untuk mengkonversi dari satu basis ke yang lain.

1) Konversikan bag integer

2) Konversikan bag pecahan

3) Gabung kedua hasil dengan radix point

Page 32: Logic and Computer Design Fundamental

32

Konversi secara detail

• Mengkonversi bag integer.Berulang bagilah angka dengan radix yang baru dan simpan sisanya.Digit dengan radix baru adalah sisa yang didapat dengan di-urutkan berlawanan. Bila radix yang baru > 10, kemudian konversikan semua sisa > 10 ke digit A, B, …

• Mengkonversi bag integer.pecahan

Berulang kalikan bag pecahan dengan radix yang baru dan simpan hasil yang integer. Digit untuk radix yang baru adalah digit integer sesuai urutan . Apabila radix yang baru > 10, kemudian konversikan integer> 10 ke digit A, B, …

Page 33: Logic and Computer Design Fundamental

33

Contoh:

• Konversikan 46.687510 ke basis 2

• Konversikan 46 ke basis 2

• Konversikan 0.6875 ke basis 2 :

• Gabungkanlah hasilnya dengan radix point:

Page 34: Logic and Computer Design Fundamental

34

Keterangan Tambahan- Bag Pecahan

• Catatan bahwa dalam mengkonversi, bag pecahan akan menjadi 0 sebagai hasil dari pengulangan

• Umumnya , bisa terjadi tetapi bisa juga tidak terjadi.

• Contoh:Konversikan 0.6510 ke N2

– 0.65 = 0.1010011001001 …– Bag pecahan akan berulang setiap 4

step dan mengulang 1001 selamanya!

• Penyelesaian: Pastikan jumlah bit yang benar, bulatkan atau hilangkan yang lain.

Page 35: Logic and Computer Design Fundamental

35

Mengecek hasil konversi

•Untuk mengkonversi balik,jumlahkan perkalian digit dengan pangkat yang sesuai dari r.

•Dari konversi yang lalu: 46.687510

1011102 = 1·32 + 0·16 +1·8 +1·4 + 1·2

+0·1 = 32 + 8 + 4 + 2 = 460.10112 = 1/2 + 1/8 + 1/16

= 0.5000 + 0.1250 + 0.0625 = 0.6875

Page 36: Logic and Computer Design Fundamental

36

Oktal (Heksadesimal) ke Biner dan sebaliknya

• Oktal (Heksadesimal) to Biner:– Buatlah setiap Oktal (heksadesimal)

menjadi tiga(empat) digit biner mulai dari radix point ke-kedua arah.

• Biner ke Oktal (Heksadesimal):– Group-kan digit biner menjadi tiga

(empat) bit group mulai dari radix point ke-kedua arah. Tambahkan nol bila dibutuhkan pada bag pecahan.

– Konversikan masing2 group dari tiga (empat) ke oktal (heksadesimal) digit.

Page 37: Logic and Computer Design Fundamental

37

Oktal to Heksadesimal lewat Biner

• Konversikan oktal ke biner. • Gunakan grouping empat bit dan

konversikan seperti diatas ke heksadesimal digits.

• Contoh: Oktal ke Biner ke Heksadesimal

( 6 3 5 . 1 7 7 ) 8

• Bagaimana konversi ini bisa bekerja?

Page 38: Logic and Computer Design Fundamental

38

Catatan Terakhir Konversi

• Sebetulnya dapat pula dilakukan aritmatika dalam basis yang lain, tapi harus dsangat hati2.

• Contoh: Konversikan 1011102 ke basis 10 menggunakan aritmatika biner :Step 1 101110 / 1010 = 100 r 0110Step 2 100 / 1010 = 0 r 0100Converted Digits are 01002 | 01102

or 4 6 10

Page 39: Logic and Computer Design Fundamental

39

Kode Biner untuk digit Desimal

Decimal 8,4,2,1 Excess3 8,4,-2,-1 Gray 0 0000 0011 0000 0000 1 0001 0100 0111 0100 2 0010 0101 0110 0101 3 0011 0110 0101 0111 4 0100 0111 0100 0110 5 0101 1000 1011 0010 6 0110 1001 1010 0011 7 0111 1010 1001 0001 8 1000 1011 1000 1001 9 1001 1100 1111 1000

Lebih dari 8,000 jalan yang dapat dipilih dari 10 elements ke 16 bilangan biner 4 bits. Yang sering digunakan adalah:

Page 40: Logic and Computer Design Fundamental

40

Binary Coded Decimal (BCD)

• Kode BCD adalah kode 8,4,2,1 .• This code is the simplest, most intuitive

binary code for decimal digits and uses the same powers of 2 as a binary number, but only encodes the first ten values from 0 to 9.

• Example: 1001 (9) = 1000 (8) + 0001 (1)

• How many “invalid” code words are there?

• What are the “invalid” code words?

Page 41: Logic and Computer Design Fundamental

41

Kode Excess 3 dan Kode 8, 4, –2, –1

Decimal Excess 3 8, 4, –2, –1

0 0011 0000

1 0100 0111

2 0101 0110

3 0110 0101

4 0111 0100

5 1000 1011

6 1001 1010

7 1010 1001

8 1011 1000

9 1100 1111

Page 42: Logic and Computer Design Fundamental

42

• What special property does the Gray code have in relation to adjacent decimal digits?

Gray Code

Decimal 8,4,2,1 Gray 0 0000 0000 1 0001 0100 2 0010 0101 3 0011 0111 4 0100 0110 5 0101 0010 6 0110 0011 7 0111 0001 8 1000 1001 9 1001 1000

Page 43: Logic and Computer Design Fundamental

43

B0

111

110

000

001

010

011100

101

B1

B2

(a) Binary Code for Positions 0 through 7

G0

G1

G2

111

101

100 000

001

011

010110

(b) Gray Code for Positions 0 through 7

Gray Code (Continued)

• Does this special Gray code property have any value?

• An Example: Optical Shaft Encoder

Page 44: Logic and Computer Design Fundamental

44

Gray Code (Continued)

• How does the shaft encoder work?

• For the binary code, what codes may be produced if the shaft position lies between codes for 3 and 4 (011 and 100)?

• Is this a problem?

Page 45: Logic and Computer Design Fundamental

• Answer 1: The encoder disk contains opaque and clear areas.

• Opaque represents a 0 and clear a 1. Light shining through each ring of the encoder corresponding to a bit of the code strikes a sensor to produce a 0 or a 1.

• Answer 2: In addition to the correct code, either 011 or 100, the codes 000, 010, 001, 110, 101, or 111 can be produced.

• Answer 3: Yes, the shaft position can be completely UNKNOWN!

45

Page 46: Logic and Computer Design Fundamental

46

Gray Code (Continued)

• For the Gray code, what codes may be produced if the shaft position lies between codes for 2 and 6 (010 and 110)?

• Is this a problem?

• Does the Gray code function correctly for these borderline shaft positions for all cases encountered in octal counting?

Page 47: Logic and Computer Design Fundamental

• Answer 1: Only the correct codes, either 010 or 110

• Answer 2: No, the shaft position is known to be either 3 or 4 which is OK since it is halfway in between.

• Answer 3: Yes, since an erroneous code cannot arise. This includes between 0 and 7 (000 and 100).

47

Page 48: Logic and Computer Design Fundamental

48

Perhatian: Konversi atau Coding?

• Jangan Bingung antara konversi dari bilangan desimal ke biner dengan coding suatu bilangan desimal ke BINARY CODE. 

• 1310 = 11012 (Ini adalah konversi) 

• 13 0001|0011(Ini adalah coding)

Page 49: Logic and Computer Design Fundamental

49

Aritmatika BCD Suatu BCD code, dijumlahkan dengan aritmatika biner:

8 1000 Eight +5 +0101 Plus 5 13 1101 is 13 (> 9)

Catatan bahwa hasik adalah > 9, seharusnya dinyatakan

dalam 2 digitUntuk mengkoreksi, tambahkan 6 modulo 16.

8 1000 Eight +5 +0101 Plus 5 13 1101 is 13 (> 9)

+0110 so add 6 carry = 1 0011 leaving 3 + cy

0001 | 0011 Final answer (two digits) If the digit sum is > 9, add one to the next significant digit

Page 50: Logic and Computer Design Fundamental

50

Contoh penjumlahan BCD

•Tambahkan 2905BCD dg 1897BCD

Tunjukkan simpanan dan koreksi digit.

0001 1000 1001 0111+ 0010 1001 0000 0101

0

Page 51: Logic and Computer Design Fundamental

51

Error-Detection Codes• Redundancy (e.g. extra information),

in the form of extra bits, can be incorporated into binary code words to detect and correct errors.

• A simple form of redundancy is parity, an extra bit appended onto the code word to make the number of 1’s odd or even. Parity can detect all single-bit errors and some multiple-bit errors.

• A code word has even parity if the number of 1’s in the code word is even.

• A code word has odd parity if the number of 1’s in the code word is odd.

Page 52: Logic and Computer Design Fundamental

52

4-Bit Parity Code Example

• Fill in the even and odd parity bits:

• The codeword "1111" has even parity and the codeword "1110" has odd parity. Both can be used to represent 3-bit data.

Even Parity Odd Parity Message - Parity Message - Parity

000 - 000 - 001 - 001 - 010 - 010 - 011 - 011 - 100 - 100 - 101 - 101 - 110 - 110 - 111 - 111 -

Page 53: Logic and Computer Design Fundamental

53

ASCII Character Codes

• American Standard Code for Information Interchange

• This code is a popular code used to represent information sent as character-based data. It uses 7-bits to represent:– 94 Graphic printing characters.– 34 Non-printing characters

• Some non-printing characters are used for text format (e.g. BS = Backspace, CR = carriage return)

• Other non-printing characters are used for record marking and flow control (e.g. STX and ETX start and end text areas).

(Refer to Table 1 -4 in the text)

Page 54: Logic and Computer Design Fundamental

54

ASCII Properties

ASCII has some interesting properties: Digits 0 to 9 span Hexadecimal values 3016 to 3916 . Upper case A-Z span 4116 to 5A16 . Lower case a-z span 6116 to 7A16 .

• Lower to upper case translation (and vice versa) occurs by flipping bit 6.

Delete (DEL) is all bits set, a carryover from when punched paper tape was used to store messages.

Punching all holes in a row erased a mistake!

Page 55: Logic and Computer Design Fundamental

55

UNICODE

• UNICODE extends ASCII to 65,536 universal characters codes

– For encoding characters in world languages

– Available in many modern applications

– 2 byte (16-bit) code words

– See Reading Supplement – Unicode on the Companion Website http://www.prenhall.com/mano