Sistem Bilangan Oleh : Sri Heranurweni.

Slides:



Advertisements
Similar presentations
HEXADECIMAL NUMBERS Code
Advertisements

Computer Structures Lecture 2: Working with 0’s and 1’s.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
1 CSE-221 Digital Logic Design (DLD) Lecture-1: Digital Systems & Number Systems.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
Mantıksal Tasarım – BBM231 M. Önder Efe
Number Systems Lecture 02.
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
Logic and Digital System Design - CS 303
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Ch. 10 – Fundamentals of Logic Circuits So far, the circuits we’ve discussed were analog circuits, meaning that circuit parameters such as voltage and.
مدار منطقي مظفر بگ محمدي Course Structure & Grading Homework: 25% Midterm: 30% Final:50% There is 5% extra! ( =105!) Textbook:
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
ECEN 301Discussion #19 – Binary Numbers1 Numbered Moses 1:33,35,37 33 And worlds without number have I created; and I also created them for mine own purpose;
Dr. Ahmed Telba EE208: Logic Design Lecture# 1 Introduction & Number Systems.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
Chapter 1: Digital Computers and Information Illustration at beginning of each Chapter Base 10 Binary Base 2 Octal Base 8 Hex bas
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
1 4. Computer Maths and Logic 4.1 Number Systems.
School of Computer and Communication Engineering, UniMAP Mohd ridzuan mohd nor DKT 122/3 - DIGITAL SYSTEM I Chapter.
Chapter 1: Binary Systems
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
Unit I From Fundamentals of Logic Design by Roth and Kinney.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
CHAPTER 5: Representing Numerical Data
Unit 1 Introduction Number Systems and Conversion.
Cosc 2150: Computer Organization
Backgrounder: Binary Math
Chapter 2 Binary Number Systems.
Bits, Data Types, and Operations
CHAPTER 9 COMPUTER ARITHMETIC - ALU
Digital Logic and Computer Organization
Digital Systems and Number Systems
Digital Systems and Binary Numbers
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Digital Systems and Binary Numbers
Data Representation in Computer Systems
Introduction The term digital is derived from the way computers perform operation, by counting digits. Application of digital technology: television, communication.
CHAPTER 4: Representing Integer Data
William Stallings Computer Organization and Architecture 7th Edition
University of Gujrat Department of Computer Science
Computer Organization and ASSEMBLY LANGUAGE
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
ECEG-3202 Computer Architecture and Organization
Digital Systems and Binary Numbers
Chapter 8 Computer Arithmetic
CSC 220: Computer Organization Signed Number Representation
COMS 161 Introduction to Computing
Presentation transcript:

Sistem Bilangan Oleh : Sri Heranurweni

Analogue vs Digital Analogue * Continuous range of value * Precision limited by Noise Digital * Discrete range of values * Precision limited by number of “Bit”

Analogue vs Digital Analogue Digital

Analogue vs Digital The real world is analogue ( by because all signal in world be shape analogue) But in controlling, Digital one had using for process. Both of signal had been converter each other

Analoge vs Digital Analogue Analogue Digital Processing D to A A to D Why Digital Only by using in Processing? ^ Adventure in integrated Circuit has made the complex processing of digital data. ^ Digital Control processing has made easier than analogue ^ Digital circuits are inherently more noise resistant

Digital and Boolean Digital represented by boolean logic Boolean is the name of mathematician’s expert Now boolean is called by conventional logic because there is new logic that called by fuzzy logic But all electronic still using boolean logic to processing the controlling system

Why Boolean It is convenient in electrical system to use a two-value system to represent value true/false, on/off, yes/no and 1/0 * Two voltage or current levels can be used * Easier to process and distribute reliably (diandalakan) * Don’t think of them as numbers (even though we often represent them as 0/1 for brevity(ketangkasan)) The need for binary numbers * Multi-value quantities need to be represented in the digital system. Therefore need numbers made up from the simple two value system

Positional Number System Decimal point 7x10-1 7x10-2 8x10-3 8 x 100 7 x 101 5 x 102 3 x 103 3578.778 Base 10, weigthing are powers of 10

Unsigned binary numbers Binary point 1 x 2-1 = 0.500 0 x 2-2 = 0.000 1 x 2-3 = 0.125 0 x 20= 0.000 0 x 21= 0.000 1 x 22= 4.000 1 x 23= 8.000 1100.101 Each bit of the Number may be Representaed by A Boolean value Binary, weightings are powers of 2

Multi-precision Arithmatic Additional of A and B A1 B1 A2 B2 + B3 Carry Flag Out In

Multi-precision Arithmatic Carry Flag Carry Out Carry In A1 B1 A2 B2 - A2 B3

Hexadecimal Numbers 660 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 A B C D E F 4 : 16 41 9 : 16 2 Hexadecimal : 294 Hex 215 13 : 16 7 Hexadecimal : 7D Hex

Hexadecimal Numbers 660 215 1 2 3 4 5 6 7 8 9 A B C D E F 0000 0001 1 2 3 4 5 6 7 8 9 A B C D E F 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 660 0010 1001 0100 2 9 4 215 0000 1101 0111 0 D 7

Decimal to Binary Generetee each digit by successive division Or multiplication. There is no guarantee the fraction will be finite Number = 36.375 Base = 2 Decimal Number Binary Digits Converter Number 0100100.0110 0.5 1 0100100.011 0.75 0100100.01 0.375 0100100.0 36 0100100 18 010010 9 01001 4 0100 010 01 Fractional part – Multiplication by base Whole part – divition by base

Binary Additional Easy Layaou ? 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 carry 1 Easy Layaou ?

Binary Addition 190 + 141 =331 Carry out of Each column 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 1 1 Carry out of 8-bit number

Binary Subtraction A borrow-out of 1 from This column becomes a borrow in of 2 in this column 229 – 46 = 183 2 2 2 2 2 1 1 1 0 0 1 0 1 Borrow in from Left column 0 0 1 0 1 1 1 0 1 1 1 1 1 Borrow out 1 1 1 1 1 1 Both rows subtracted

Exercise Convert to 8-bit binary and do the arithmetic operation * 120 + 54 * 110 + 100 * 224 – 134 * 200 + 20 * 112 – 89 * 111 – 25 Convert back to decimal and check the result

Binary Number Circle 4 – bit Binary Number Circle 11 1110 - 1 1 In real hardware there is a fixed number Of bits available. We often ignore leading zeros But they are still there! Examlpe : If we only use 4 bits then the binary Counting sequence “wraps around” At 15 ↔ 0 11 - 1 = 10 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 – bit Binary Number Circle 11 1110 - 1 1 10 1010

Binary Number Circle 4 – bit Binary Number Circle 8 1000 - 14 - 1110 Subtracting across the boundary Still “works” if you think of result As the distance on the number Circle. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 – bit Binary Number Circle (Module arithmetic – ignore The borrow /carry) 8 1000 - 14 - 1110 10 (-1)1010

Representing –ve Number Several choices for natation * sign + magnitude notation * 1’s complement * 2’s complement notation * various ‘excess codes ‘

Sign Number – sign + magnitude Notation Sign Bit Magnitude 0  +ve Simple binary number 1  - ve How about Null or Zero Problem ? + 0  0000 - 0  1000

Signed Numbers – Sign + magnitude Notation Arithmetic Difficult to do – have to work out that operation to perform 5 + -6 actually calculate –(6-5) i.e. exchange the operands and do subtraction! -5+ -6 actually calculate –(5+6) i.e. negate the addition of the negated numbers ! Required action depends the signs of the numbers and on which has the large magnitude. Natural for us –a bit hard for the computer since the only way it can work out the bigger number is to do a subtraction!

Sign + Magnitude Examples Value 4-bit sign + magnitude 8-bit sign + magnitude +7 0111 00000111 +6 0110 00000110 …… +1 0001 00000001 +0 0000 00000000 -0 1000 10000000 -1 1001 10000001 -2 1010 10000010 -7 1111 10000111

Sign Numbers – 2’s Complement As for straight binary numbers but with the weighting of the most significant bit being negative Example * 4 bit – weights are -8, 4,2,1 * 8 bit – weights are -128, 64,32,16,8,4,2,1 Need to know how many bits are being used to work out the value of the number – don’t omit leading zeroes

Sign Numbers – 2’s Complement Binary point 1 x 2-1 = 0.500 0 x 2-2 = 0.000 1 x 2-3 = 0.125 0 x 20= 0.000 0 x 21= 0.000 1 x 22= 4.000 1 x 23= -8.000 1100.101 Sign Bit -4.375 Binary, weightings are powers of 2

2’s Complement Examples Value 4-bit sign 2’s complement 8-bit sign complement +7 0111 00000111 +6 0110 00000110 …… +1 0001 00000001 +0 0000 00000000 -1 1111 11111111 -2 1110 11111110 -7 1001 11111001 -8 1000 11111000

2’s Complement Examples Example : -4 (decimal) Become 4 = 0100 ( binary) = 1x22 = 4 2’s Complement -4= 1100 (binary) = -(23) + 22 = -8 + 4 = -4

Exercise Converse decimal number above into negative (2’s complement) : -7 ( 4 digit ) 6. 6 (4 digit) -7 (8 digit) 7. 10 (8 digit) -12 (8 digit) 8. 30 (8 digit) -20 (8 digit) 9. 98 (digit) -100 (8 digit) 10. 126 (digit)

Addition 2’s Complement For 4 digit : 4 0100 3 + 0011 + 7 0111 22+21+20 = 4+2+1 =7

Addition 2’s Complement For 4 digit -1 1111 -2 + 1110 + -3 11101 -(8)+4 +0 + 1 = -3 Carry out

Exercise For 4 Digit : 7 + (-5) -6 + -1 3 + 4 2 + 3 -4 + 7 Converse all item to digital and addition. And then Converse to decimal again

Subtraction 2’s Complement + 7 0111 + 3 (0011)- 1101 + +4 10100 Discard

Subtraction 2’s Complement (-8) 1000 (-3) = 1101 - 0011 + -5 1011

Exercise for 4 digit . Converse decimal above to digit and subtraction. After that converse to decimal again : (+3) – (-3) (-4) – (+2) (-8)- (+4) (-3) – (-4) (7) – (5)

Condition code register (CCR) 2’s Complement ALU Addition and subtraction use the same rules as unsigned binary. Same hardware may be used for both Carry (C) is used for unsigned, overflow (v) for signed C=Carry V=overflow OP Signed Numbers Signed Numbers The same hardware OP C=Carry Signed Numbers V=overflow Arithmetic Flags in Condition code register (CCR)