1 Digital Systems and Binary Numbers

Loading...

Digital Logic Design

Yarmouk University

Computer Engineering Department

ID= Chapter 1 - Binary Systems

1

Digital Systems and Binary Numbers

Computer=ALU+Control+Memory (RAM, ROM, Flash/disk), Input(kbd)/Output(screen) plus busses for data, control and address.

1.1

Digital Systems

Bit can take 1-bit of info: 1/0, t/f, y/n, on/off. Nibble/ nybble/nyble 4-bits Byte 8-bits Word computer dependent. Smallest addressable location in memory is the byte. Register Transfer Logic (Computer Architecture)

1.2

Binary Numbers

• Decimal • Binary • Octal

1.3

Number Base Conversions Examples on Number Conversion

1.1 (41)10 = (?)2 1 41 2 = 20 + 2 ⇒ a0 = 1 20 0 2 = 10 + 2 ⇒ a1 = 0 10 0 2 = 5 + 2 ⇒ a2 = 0 5 1 2 = 2 + 2 ⇒ a3 = 1 2 0 2 = 1 + 2 ⇒ a4 = 0 1 1 2 = 0 + 2 ⇒ a5 = 1 (41)10 = (101001)2 In MatLab we can use bin2dec, oct2dec, hex2dec, dec2bin, dec2base, dec2hex. dec2bin(41) ⇒ 101001 1.2 (153)10 = (?)8 1 153 8 = 19 + 8 ⇒ a0 = 1 3 19 8 = 2 + 8 ⇒ a1 = 3 2 2 8 = 0 + 8 ⇒ a2 = 2 (153)10 = (231)8 1.3 (0.6875)10 = (?)2 0.6875 ∗ 2 = 1.3750 ⇒ a−1 = 1 0.375 ∗ 2 = 0.75 ⇒ a−2 = 0 0.75 ∗ 2 = 1.5 ⇒ a−3 = 1 0.5 ∗ 2 = 1.0 ⇒ a−4 = 1 (0.6875)10 = (.1011)2 1.4 (0.513)10 = (?)8 0.513 ∗ 8 = 4.104 ⇒ a−1 0.104 ∗ 8 = 0.832 ⇒ a−2 0.832 ∗ 8 = 6.656 ⇒ a−3 0.656 ∗ 8 = 5.248 ⇒ a−4 0.248 ∗ 8 = 1.984 ⇒ a−5

=4 =0 =6 =5 =1

Page 1 of 4

Please go on to the next page. . .

CPE230 Digital Logic Design

Chapter 1 - Binary Systems

Dr. Abdel-Rahman Jaradat

0.984 ∗ 8 = 7.872 ⇒ a−6 = 7 Ex1.1 plus Ex1.3: (41.6875)10 = (101001.1011)2 Ex1.2 plus Ex1.4: (153.513)10 = (231.406517)8

1.4

Octal and Hexadecimal Numbers 3

8 = 2 , 16 = 24 Decimal (base 10) Binary (base 2) Octal (base 8) Hexa (base 16)

00 0000 00 0

01 0001 01 1

02 0010 02 2

03 0011 03 3

04 0100 04 4

05 0101 05 5

06 0110 06 6

07 0111 07 7

08 1000 10 8

09 1001 11 9

10 1010 12 A

11 1011 13 B

12 1100 14 C

13 1101 15 D

14 1110 16 E

• Bin2Oct: (10 110 001 101 011.111 100 000 110)2 = (26153.7406)8 • Bin2Hex: (10 1100 0110 1011.1111 0000 0110)2 = (2C6B.F 06)16 • Oct2Hex: (673.124)8 = (?)16 this is done in 2 steps: – Oct2Bin: (673.124)8 = (110 111 011.001 010 100)2 – Bin2Hex: (110 111 011.001 010 100)2 = (1 1011 1011.0010 1010 0)2 = (1BB.2A)16 • Hex2Oct: (306.D)16 = (?)8 this is done in 2 steps: – Hex2Bin: (306.D)16 = (0011 0000 0110.1101)2 – Bin2Oct: (0011 0000 0110.1101)2 = (001 100 000 110.110 100)2 = (1406.64)8 13 12 1 1 4 as a check (.D)16 = 16 = 16 + 16 = 86 + 16 = 86 + 64 = (0.64)8 and 3 2 (1406)8 = 1 ∗ 8 + 4 ∗ 8 + 0 + 6 = 512 + 256 + 0 + 6 = (774)10 , check: hex2dec(’306’) ⇒ (774)10 In MatLab, dec2base(443,8) ⇒ ans = 673 and dec2base(443,16) ⇒ ans = 1BB

1.5

Complements

• Diminished Radix Complement: n−digit number N in radix r: subtract the number N from rn − 1 – 9’s complement: subtract the number from 99...9 6-digit number: 9’s complement of 546700=999999-546700=453299 and 6-digit number: 9’s complement of 012398=999999-012398=987601 – 1’s complement: subtract then number from 11...1 (or 1 ⇒ 0, 0 ⇒ 1) 7-digit number: 1’s complement of 1011000=1111111-1011000=0100111 and 7-digit number: 1’s complement of 0101101=1111111-0101101=1010010 • Radix Complement: n−digit number N in radix r: subtract the number N from rn r equivalently find the diminished radix complement and add 1. • 10’s complement: n−digit number N in radix 10: subtract the number N from 210 10’s complement of 4-digit decimal 2389=(7610)+1=7611 or 104 − 2389 = 7611. • 2’s complement of 6-digit binary 101100=(010011)+1=101100 or 26 − 101100 = 1000000 − 0101100 = 010100

Page 2 of 4

Please go on to the next page. . .

15 1111 17 F

CPE230 Digital Logic Design 1.5.1

Chapter 1 - Binary Systems

Dr. Abdel-Rahman Jaradat

subtraction with Complements

• Subtract two n−digit unsigned numbers M − N in base r: M − N = M + (rn − N ) = M − N + rn – if M ≥ N , an end carry rn produced and must be discarded. – if M < N , no end carry and the answer is rn − (N − M ) = −r′ s complement of (N − M ). • Examples: subtract using r’s complement 1.5 72532-3250=72532+10’s(3250)=72532+96750=169282=69282 after discarding the end carry. 1.6 3250-72532=3250+10’s(72532)=3250+27468=30718=-10’s(30718)=-69282 (answer -ve since no end carry). 1.7 Binary numbers X = 1010100, Y = 1000011, X − Y = 1010100 + 2′ s(1000011) = 1010100 + (0111100 + 1) = 10010001 = 0010001 after discarding end carry. Y − X = 1000011 + 2′ s(1010100) = 1000011 + (0101011 + 1) = 1000011 + 0101100 = 1101111 = −2′ s(1101111) = −(0010000 + 1) = −0010001 • Examples: subtract using (r-1)’s complement 1.7 same X, Y from last example. X −Y = 1010100+1′ s(1000011) = 1010100+(0111100) = 10010000 = 0010000+1 = 0010001 after adding end carry. Y − X = 1000011 + 1′ s(1010100) = 1000011 + (0101011) = 1101110 = −1′ s(1101110) = −0010001 -ve since no end carry

1.6

Signed Binary Numbers

Signed-magnitude, signed-1’s, signed-2’s. Represent -9 as 8 digit number (sign bit plus 7 digits) in the three representations Left most bit 0 ⇒ +ve, 1 ⇒ −ve • signed-magnitude representation -9=-(00001001)=10001001 • signed-1’s-complement representation -9=-(00001001)=11110110 • signed-2’s-complement representation -9=-(00001001)=11110110+1=11110111 Example Table 1.3 page 31, 4-bit signed number system: • in signed magnitude there are +0 and -0 and 1..7 and -7..-1. The sequence -7..+7 is given by: 1111,1110,1101,1100,1011,1010,1001,1000,0000,0001,0010,0011,0100,0101,0110,0111 • in 1’s complement there are +0 and -0 and 1..7 and -7..1. The sequence -7..+7 is given by: 1000,1001,1010,1011,1100,1101,1110,1111,0000,0001,0010,0011,0100,0101,0110,0111 • in 2’s complement there are only one ’0’ and 1..7 and -8..1. The sequence -8..+7 is given by: 1000,1001,1010,1011,1100,1101,1110,1111,0000,0001,0010,0011,0100,0101,0110,0111

1.7

Binary Codes

Binary-Coded Decimal (BCD) is a 4-bit representation of the numbers 0..9 are 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001 and unused 1010,1011,1100,1101,1110,1111 BCD addition: when adding two BCD digits, if answer > 9 or end carry, then add 6 to the result. Example: 8+9=1000+1001=10001 and adding the correction factor 0110 we get (10111 = 0001 0111)BCD = (17)10 . Example: (184)BCD + (576)BCD = (760)BCD . If in binary representation, we add 4-bits at a time from right to left. 0001 1000 0100 184 0101 0111 0110 576 ==================== 0111 0000 1010

Page 3 of 4

Please go on to the next page. . .

CPE230 Digital Logic Design

Chapter 1 - Binary Systems

Dr. Abdel-Rahman Jaradat

0000 0110 0110 add 6 ================ 0111 0110 0000 760 BCD 1.7.1

other Decimal Codes

BCD 8:4:2:1, 2:4:2:1, Excess-3, 8:4:-2:-1

1.7.2

Gray Code

: one bit change from one number to the next. 0=0000,1=0001,2=0011,3=0010,4=0110,5=0111,6=0101,7=0100, 8=1100,9=1101,10=1111,11=1110,12=1010,13=1011,14=1001,15=1000

1.7.3

ASCII character code

: 1.7.4

Error-Detecting Code

even and odd parity.

1.8

Binary Storage and Registers

Register and Register transfer.

1.9

Binary Logic

Gates: AND (x.y), two series switches OR (x + y), two parallel switches NOT (x′ ), inverter

0−− > 0.8 logic 0 2.4 −− > logic 1 > 0.8 and < 2.4 don’t care/ transition region. In MatLab/ Octave and(a,b), or(a,b), not(a)

Page 4 of 4

.krowemoH fo dnE

Loading...

1 Digital Systems and Binary Numbers

Digital Logic Design Yarmouk University Computer Engineering Department ID= Chapter 1 - Binary Systems 1 Digital Systems and Binary Numbers Comp...

92KB Sizes 6 Downloads 24 Views

Recommend Documents

Digital Systems and Binary Numbers
Digital Systems. ▫ Binary Numbers. ▫ Number-Base Conversions. ▫ Octal and Hexadecimal Numbers. ▫ Complements. â–

Digital Systems and Binary Numbers
[PDF]Digital Systems and Binary Numbershttp://eclass.duth.gr/.../Pages%20from%20DIGITAL%20SYSTEM%20DESIGN%20...CachedTh

Chapter 1 Digital Systems and Binary Numbers | Binary Coded
Digital Logic Design I. Chapter 1. Digital Systems and Binary Numbers. Title: Digital Design Code: Lecture: 3. Pre-Requi

Chapter 1: Digital Systems and Binary Numbers - PDF - DocPlayer.net
Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many sc

PPT – Chapter 1 Digital Systems and Binary Numbers PowerPoint
Electronic calculators, PDA's. Digital TV. Discrete information-processing systems ... Decimal (Fraction) to Binary Conv

Number systems Digital The basics: Binary numbers Binary → hex
CSE370, Lecture 2. Number systems. ◇ Last lecture. ▫ Course overview. ▫ The Digital Age. ◇ Today's lecture. ▫

Lecture 2: Digital Systems and Binary Numbers - Classes
Lecture 2: Digital Systems and Binary Numbers. Matthew Shuman. October 2nd, 2009. 1 Complements — 1-5 in Text. The mea

Digital Systems and Binary Numbers - ppt video online download
Digital Systems Can you give me an example of an electronic device that is not digital? What advantages do digital syste

Chapter 1 Binary Systems 1-1. Digital Systems
Binary Numbers. ▫ A number with decimal point represented by a series of coefficients as follow: a5 a4 a3 a2 a1 a0 .a-

Digital System And Binary Numbers - Unacademy
This course would contain basics of the digital system starting from number system, conversion from one form to another