You are on page 1of 20

WEEK 1

 Number System and Codes


NUMBER SYSTEMS
A Number System is a system that uses signs and
symbols to represent quantities. Number comes in
different base (“base” is also known as “radix”) as
follows:
Number System Base Number System Base
Binary 2 Decimal 10
Ternary 3 Undecimal 11
Quarternary 4 Duodecimal 12
Quinary 5 Tridecimal 13
Senary 6 Tetradecimal 14
Septenary 7 Pentadecimal 15
Octal 8 (0 - 7) Hexadecimal 16 (0 - F)
Nonary 9 A=10, B=11, C=12, D=13, E=14, F=15
Source: http://en.wikipedia.org/wiki/List_of_numeral_systems
EQUIVALENCES
Decimal Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1000 16 E
15 1111 17 F
16 10000 20 10
17 10001 21 11
NUMBER BASE CONVERSIONS

1.0 Conversion from decimal to any number system


1.1 Divide the decimal number by the
base of the desired number system.
1.2 Multiply the quotient by the divisor.
1.3 Subtract the product of step 1.2 from
the number to get the remainder.
1.4 Repeat steps 1.1, 1.2, and 1.3 until the
remainder becomes zero.
1.5 Develop the answer from the remainder
by reading upward.

Example: Convert 17910 to N8.


NUMBER BASE CONVERSIONS

2.0 Conversion from decimal to any number system


2.1 Multiply the decimal fraction by the base of
the desired number system.
2.2 If the product shows an overflow, write the
overflow; otherwise write zero.
2.3 Get the decimal fraction of step 2.2 and
repeat steps 2.1 and 2.2 until the number
becomes zero or the desired precision is
obtained.
2.4 Develop the answer from the overflow by
reading from top to bottom.

Example: Convert 0.2310 to N8.


NUMBER BASE CONVERSIONS

3.0 Conversion from base N to decimal


3.1 Multiply the given number by its base
raise to its corresponding coefficient.
3.2 Get the sum of step 3.1 as results.
Example: Convert 72348 to N10.

4.0 Conversion from base N fraction to decimal


4.1 Multiply the given number by its base
raise to its corresponding negative coefficient.
4.2 Get the sum of step 4.1 as results.
Example: Convert 0.10111012 to N10
NUMBER BASE CONVERSIONS
5.0 Conversion from binary to octal
5.1 Group the binary numbers into 3 bits per
group. Grouping will start from LSB to MSB.
5.2 Give its decimal equivalent
Example: Convert 11011111011001102 to N8.

6.0 Conversion from binary to hexadecimal


6.1 Group the binary numbers into 4 bits per
group. Grouping will start from LSB to MSB.
6.2 Give its decimal equivalent
Example: Convert 11011111011001102 to N8.
CODED NUMBERS
Numbers can be represented in terms of codes for a
various reasons like error detection, ease of use of
electronic circuits and convert alphanumeric symbols in
the series of 0’s and 1’s.
 Binary Coded Decimal (BCD) / 8421 Code

BCD is used to represent decimal number into its


convenient binary forms and to write the decimal digits to
BCD, it is necessary to use 4 binary digits.

Example: Convert 80110 to BCD


CODED NUMBERS
 Excess Three (+3) Code
It is derived in the same way as the BCD code except
that before conversion into binary, each digit is
increased by 3.
Example: Convert 80110 to +3
CODED NUMBERS
 Gray Code
It is a sequence of binary numbers in which one and only
one digit changes in successive numbers. It is also called
the unit distance code and is used in Karnaugh mapping.
1.0 Conversion from Binary to Gray Code
1.1 The first bit of the gray code is the same
as the first bit of the binary number.
1.2 The second bit of the gray code is equal to the
exclusive or of the 1st and 2nd binary bits, that is,
it will be a 0, if the binary bits are the same and
a 1 if they are different.

Example: Convert 10011012 to GC


CODED NUMBERS
2.0 Conversion from Gray Code to Binary
2.1 The first binary bit is the same as the
first gray bit.
2.2 If the second bit is a zero, the 2nd binary bit is
the same as the 1st . If it is 1, the 2nd binary
bit is the inverse of the 1st binary bit.

Example: Convert 1101011GC to N2.


CODED NUMBERS
 ASCII (American Standard Code for
Information Interchange)
It is the most common alphanumeric code used in
computer systems which uses 7 bits to code 128
characters.

Example: Decode the following ASCII code:


1001101 1000011 1001100
ARITHMETIC OPERATIONS
 Addition

Examples:
11010112 + 10101.12
23758 + 75238
29ABC16 + DEAF16
 Subtraction

Examples:
101012 - 1002
73458 – 654.748
1EBC16 – 32A16
ARITHMETIC OPERATIONS
 Multiplication

Examples:
10110.1012 × 1.012
1734.218 × 718
237A.2616 × 7.516
 Division

Examples:
101011012 ÷ 1002
765438 ÷ 458
6A2516 ÷ 1216
COMPLEMENTING
Complementing is an alternative way in subtracting number system.
1.0 1’s Complement is subtracting the number from its highest
possible number
1.1 Get the 1’s complement of a subtrahend
1.2 Add the 1’s complement of the subtrahend to the
minuend
1.3 If the outmost carry over in step 1.2 is “1”, add this to
the least significant digit obtained in step 2. If “0”, get
the 1’s complement of the result in step 2 and prefix
the negative sign.
1.4 The obtained result is the difference between the two
numbers.

Examples: Perform the operation using 1’s complement:


10110 2 - 11012
5310 - 7510
COMPLEMENTING
2.0 2’s Complement is adding one(1) to the least significant
digit of a 1’s complement of a number.
2.1 Get the 2’s complement of a subtrahend
2.2 Add the 2’s complement of the subtrahend to
the minuend
2.3 If the outmost carry over in step 2.2 is “1”,
drop it . If “0”, get the 2’s complement of the
result in step 2.2 and prefix the negative
sign.
2.4 The obtained result is the difference between
the two numbers.

Examples: Perform the operation using 2’s complement:


10110 2 - 11012
5310 - 7510
END OF DISCUSSION
Lesson 1: Number System and Codes
TEXTBOOK AND REFERENCES
Textbook:
Mano, Morris M. and Ciletti, Michael D. (2013). Digital Design
with Introduction to the Verilog HDL, 5th Edition, Pearson
Prentice-Hall.
References:
Arntson, Amy E. (2006). Digital Design: Basics, Thomson /
Wadsworth.
Ayers, John E. (2010). Digital Integrated Circuits, 2nd Edition,
CRC Press.
Bignell, James W. and Donovan, Robert (2007). Digital
Electronics, 5th Edition, Delmar Learning (Thomson).
Brown, Stephen and Vranesic, Zvonko (2009). Fundamentals of
Digital Logic with VHDL design, Third Edition. McGraw-Hill
Companies, Inc.
Chartrand, Leo (2004). Digital Fundamentals: Experiments and
Concepts with CPLD (with accompanying CD), Delmar
Learning (Thomson).
TEXTBOOK AND REFERENCES
Clive "Max" Maxfield, Clive “Max” ( ). FPGAs
Cofer, R. C. (2006). Rapid system prototyping with FPGAS, Amsterdam : Elsevier
Dueck, Robert K. (2005). Digital Design With CPLD Applications And VHDL, 2nd Edition,
Delmar Learning (Thomson).
Floyd, Thomas L.(2006). Digital fundamentals (with accompanying CD), 9th Edition,
Pearson Prentice Hall.
Harris, David Money and Harris, Sarah L. (2013). Digital design and computer
architecture.
Hwang, Enoch O. (2006). Digital Logic and Microprocessor Design With VHDL. Thomson.
Lee, Sunggu (2006). Advanced Digital Logic Design Using Verilog, State Machines, and
Synthesis for FPGA's.
Lin, Ming-Bo (2008) .Digital system designs and practices : using Verilog HDL and
FPGAs, John Wiley & Sons
Mano, Morris M. and Ciletti, Michael D. (2007). Digital Design, 4th Edition, Pearson
Prentice-Hall.
Mano, Morris M. and Ciletti, Michael D. (2012). Digital Design with Introduction to the
Verilog HDL, 5th Edition, Pearson Mano, M. Morris, Kime, Charles R. (2008). Logic and
Computer Design Fundamentals, 4th edition, Pearson Education, Inc.
Mano, M. Morris, Kime, Charles R. (2008). Digital System Designs and Practices: using
Verilog HDL and FPGAs, 4th edition, Pearson Prentice-Hall.
TEXTBOOK AND REFERENCES
Marcovitz, Alan(2008). Introduction to logic and computer
design (with accompanying CD), International edition. McGraw-
Hill Education (Asia).
Marcovitz, Alan(2010). Introduction to logic design, 3rd Edition,
McGraw-Hill.
Oklobdzija,Vojin G.(2008). Digital Systems and Applications,2nd
Edition, CRC Press Taylor & Francis Group
Rafiquzzaman, M. Ph.D. (2005). Fundamentals of Digital Logic
and Microcomputer Design(with accompanying CD),5th Edition,
John Wiley and Sons, Inc.
Roth, Charles H. Jr., Kinney, Larry L.(2010). Fundamentals of
Logic Design, Sixth Edition, Cengage Learning.
Tocci, Ronald J., Widmer, Neal S. and Moss, Gregory L. (2007).
Digital systems : principles and applications (with accompanying
CD),10th Edition, Pearson Prentice Hall.
Tokheim, Roger (2008). Digital Electronics: Principles and
Applications, 7th Edition, McGraw-Hill.

You might also like