0% found this document useful (0 votes)
2 views

Numeration systems and codes

This document discusses various numbering systems used in digital technology, including decimal, binary, octal, and hexadecimal systems, along with their conversions. It also covers the concept of coding, specifically weighted and unweighted binary codes, such as Natural Binary Code and BCD. The document provides examples and methods for converting between different bases and coding systems.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Numeration systems and codes

This document discusses various numbering systems used in digital technology, including decimal, binary, octal, and hexadecimal systems, along with their conversions. It also covers the concept of coding, specifically weighted and unweighted binary codes, such as Natural Binary Code and BCD. The document provides examples and methods for converting between different bases and coding systems.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

CHAPTER 1 :

NUMBERING SYSTEMS AND CODES


Target skills :
✓ Master the different numbering systems and the conversion between them;
✓ Master the different codes of the numbering system and make conversions between them;
✓ Perform operations in different databases ;
✓ Master the concepts of representing numbers in exact magnitude, 1's complement and 2's
complement

Lesson 1: NUMERATION SYSTEMS


Introduction
A numbering system is a way of representing or writing numbers. In digital technology, several
numbering systems, also known as bases, are used. The most common are decimal, binary, hexadecimal
and octal.

The base of a numbering system is the number of different digits or symbols used in that
system. A number N in any base B is given by (N)B .

I. Decimal system (base 10)


This everyday numbering system has 10 symbols (digits): 0; 1; 2; 3; 4; 5; 6; 7; 8; 9. The
weights assigned to the symbols are therefore powers of (10). A number N in base 10 is given by (N)10
or simply N

In general, a number N in any base B is written as follows:

N=𝐴𝑛𝐵𝑛
+ 𝐴𝑛-1𝐵𝑛-1 + 𝐴𝑛-2𝐵𝑛-2 + 𝐴𝑛-3𝐵𝑛-3 +......+𝐴0𝐵0 + 𝐴-1𝐵-1 + 𝐴-2𝐵-2 ... ... 𝐴-𝑚𝐵-𝑚 :

This representation is called a polynomial form Note: ∀ 𝒙 ∈ 𝑰𝑹, 𝒙𝟎 = 𝟏 and 𝒙−𝒎 =𝒙𝒎
𝟏

Example: 629 = 6 × 102 + 2 × 101 + 9 × 100 = 600 + 20 + 9

7238.596 = 7 × 103 + 2 × 102 + 3 × 101 + 8 × 100 + 5 × 10−1 + 9 × 10−2 + 6 × 10−3

II. Binary system (base 2)


This is the numbering system used in digital machines. It uses two symbols called BIT (Binary
digIT), namely 0 and 1. This base is very convenient for distinguishing the two fundamental logic
states.
A binary state is called a bit, and a bit can only take on two possible values 0 or 1. Successive
powers of 2 are called binary weights.
A byte is a set of 8 bits A quartet is a set of 4 bits
The most significant bit is called MSB (Most Significant Bit) and is most often found at
left of a binary number.

Page 3
DIGITAL CIRCUIT COURSES

The least significant bit is called LSB (Lest Significant Bit) and is most often found at
right-hand side of a binary number.
010011:

MSB LSB

Example: (1101)2

Bit 1 1 0 1
Rank 3 2 1 0
23 22 21 20
Weight
Weighting 8 4 2 1

(1101)2 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = (13)10 = 13

III. Octal system (base 8)


This numbering system uses eight symbols: 0; 1; 2; 3; 4; 5; 6 and 7. It is rarely used today,
since it was used to encode numbers in early-generation computers.

Example: (5𝑂2, 71)8

Sign 5 0 2 7 1
Rank 2 1 0 -1 -2
82 81 80 8-1 8-2
Weight
Weighting 64 8 1 1/8 = 0,125 1/82 = 0.015625

(5𝑂2, 71)8 = 5 × 82 + 0 × 81 + 2 × 80 + 7 × 8−1 + 3 × 8−2 = (322, 921875)10

IV. Hexadecimal system (base 16)


The development of microprogrammed systems has encouraged the use of this 16-symbol
numbering system: 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; A; B; C; D; E and F.

Example: (𝐹59𝐵, 𝐴)16

Sign F 5 9 B A
Rank 3 2 1 0 -1
16-1
Weight 163 162 161 160
Weighting 4096 256 16 1 1/16 = 0,0625

(𝐹59𝐵, 𝐴)16 = 𝐹 × 163 + 5 × 162 + 9 × 161 + 𝐵 × 160 + 𝐴 × 16−1

= 15 × 4096 + 5 × 256 + 9 × 16 + 11 + 10 × 0, 0625 = (62875, 625)10

Page 4
DIGITAL CIRCUIT COURSES

V. CHANGE OF BASES: CONVERSION


Conversion consists in switching from one numbering system to another.
1) Correspondence table between different bases

Hexadecimal Decimal Octal Binary


0 0 0 0 0 0 0
1 1 1 0 0 0 1
2 2 2 0 0 1 0
3 3 3 0 0 1 1
4 4 4 0 1 0 0
5 5 5 0 1 0 1
6 6 6 0 1 1 0
7 7 7 0 1 1 1
8 8 10 1 0 0 0
9 9 11 1 0 0 1
A 10 12 1 0 1 0
B 11 13 1 0 1 1
C 12 14 1 1 0 0
D 13 15 1 1 0 1
E 14 16 1 1 1 0
F 15 17 1 1 1 1

2) Converting any base B to base 10


To convert a number from any base to base 10, we use the polynomial form.
Example:
(1101011)2 = 1x26 + 1x25 + 0x24 + 1x23 + 0x22 + 1x21 + 1x20 = 8 + 2 + 1 = (107)10
(275.31)8 = 2x82 +7x81 + 5x80 + 3x8-1 + 1x8-2 = 128 + 56 + 5 + 0.375 + 0.015625 = (189.390625)10

(A3F9)16 = 10 x163 + 3x162 + 15x161 + 9x160 = 40960 + 768 + 240 + 9 = (41977)10 = 41977

3) Decimal conversion (base 10) to any base B


To convert a decimal number to its equivalent in any base B, proceed by successively dividing
the number by B, then the new quotient by base B,... until the quotient becomes zero. The expression
sought is the set of successive remainders of the divisions, read backwards.

Page 5
DIGITAL CIRCUIT COURSES

Example: (107)10 = (?)2 (107)10 = (1101011)2


107 2
106 53 2
LSB 1 52 26 2
1 2 6 13 2
0 12 6 2
163 2
021 2
1 0 0
1
MSB

2ème method: 107 = 64+ 32 + 8 + 2 + 1 = 1x26 + 1x25 + 0x24 + 1x23 + 0x22 + 1x21 + 1x20
(41977)10 = ( ? )16 (41977)10 = ( A3F9 )16
(189)10 = ( ? )8 (189)10 = (275)8
41977 16
189 8 41968 2623 16
184 23 8 9 2608 163 16
5 16 28 15 160 10 16
0 0 3 0 0
7 F
2 10
A

Example 4: Convert (951.375)10 = ( ? )2


951 2
950 475 2 (951.375)10 = (1110110111.011)2
1 474 237 2
1 236 118 2
1 118 59 2
0 58 29 2
1 28 14 2
1 14 7 2
063 2
121 2
10 0
1

4) Octal → binary conversion and vis-versa


Note that 8 = 23 ; To convert an octal number to its binary equivalent, we code each digit of the
octal number to its 3-bit binary equivalent.
Octal-binary correspondence table Example 1: (527)8 = ( ? )2 = (101010111)2
Octal Binary
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
Example 2: (10110001010111)2 = ( ? )8 = (26127 )8
5 1 0 1
6 1 1 0
7 1 1 1

Page 6
DIGITAL CIRCUIT COURSES

5) hexadecimal → binary conversion and vice versa


In the same way, we can see that 16=24 Each digit of a hexadecimal number will therefore
correspond t o 4 bits of the corresponding binary number.
Example: (10110001010111)2 = (? )16 = (2C57)16
0010 1100 0101 0111
2 C 5 7
(A28)16 = (101000101000)2

6) hexadecimal - octal conversion and vis-versa


To convert a hexadecimal number to its octal equivalent and vice-versa, we use base 2 and then
perform 3-bit or 4-bit groupings, depending on whether we want to find its octal or hexadecimal
equivalent.
Example: Converting the octal number 670312 to hexadecimal
(67052)8 = ( ? )16
67 0 5 2
(67052)8 = (7E2A)16
0110 111 000 101 010
7 E 2 A
7) conversion from base B1 to base B2
If X and Y are not all powers of 2, then to perform such a conversion, we first go through base 10.

Base B1 Base 10 Base B2

Example: (3042)5 = (? )16

(3042)5 = 3 × 53 + 0 × 52 + 4 × 51 + 2 = (397)10

(𝟑𝟎𝟒𝟐)𝟓 = (𝟏𝟖𝑫)𝟏𝟔

Page 7
DIGITAL CIRCUIT COURSES

Lesson 2: NUMBERING SYSTEM


CODES
Introduction
Coding is the process of associating any character (letter, number, sign, etc.) with a specific
symbol or set of symbols, called a code. To code information is to associate it with a symbol or
combination of symbols that allow it to be communicated. There are weighted binary codes (natural or
pure binary code, DCB code, etc.) and non-weighted binary codes (code Majoré de 3, GRAY code).

I. weighted binary codes


A binary code is said to be weighted when a bit can be given a weight (a value) according to its
position or rank in the number.

I.1) Natural binary code (or pure binary code)


The binary numbering system (base 2) is considered a natural or pure binary code, allowing
numbers to be represented in binary form.
Example: the decimal 107 corresponds to the natural binary (1101011)2

I.2) BCD code:


BCD: Binary Coded Decimal is the most widely used code. In this code, each decimal digit is
represented by its four-digit binary equivalent.
(4) bits. This code is also called code 8.4.2.1, which are the respective weights of the bits in each quartet.
Decimal - DCB correspondence table For example:

Decimal DCB
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
(238)10 = (0010 0011 1000)DCB
3 0 0 1 1
4 0 1 0 0
NB: To code any other number from another
5 0 1 0 1
system (binary, octal or hexadecimal) in DCB,
6 0 1 1 0
7 0 1 1 1 first convert it to decimal and then find its 4-bit
8 1 0 0 0 binary equivalent (DCB).
9 1 0 0 1

II. unweighted binary codes


Thoseare codes that give each combination a decimal equivalence, and in which each binary element
rank has no precise weight. These are: the GRAY code, a code with a 3-fold increase.
II.1) Excess 3 code.
This code is found in the same way as the DCB code, except that 3 is added to each decimal digit
before conversion.

Page 8
DIGITAL CIRCUIT COURSES

This code is also called code 8.4.2.1, which are the respective weights of the bits in each quartet.
Correspondence table Decimal - Pure binary - Increased by 3

Decimal DCB Increased by 3


0 0 0 0 0 0 0 1 1
1 0 0 0 1 0 1 0 0
2 0 0 1 0 0 1 0 1
3 0 0 1 1 0 1 1 0
4 0 1 0 0 0 1 1 1
5 0 1 0 1 1 0 0 0
6 0 1 1 0 1 0 0 1
7 0 1 1 1 1 0 1 0
8 1 0 0 0 1 0 1 1
9 1 0 0 1 1 1 0 0

9 2 +7
Decimal code
+ +
3 3 3
(𝟗𝟐𝟕)𝟏 𝟎 = (𝟏𝟏𝟎𝟎𝟎𝟏𝟎𝟏𝟏𝟎𝟏𝟎)𝑴𝒂𝒋𝒐𝒓é 𝟑
12 5 10

1100 0101 1010 Corresponding code 3

II.2) GRAY code (reflected binary code)


a) Correspondence table Decimal - Pure Binary - Gray (Reflected Binary)

Decimal Pure binary Increased by 3


0 0 0 0 0 0 0 0 0
The Gray code was established to
1 0 0 0 1 0 0 0 1
avoid transition problems when changing 2 0 0 1 0 0 0 1 1
from one word to the next; each time the 3 0 0 1 1 0 0 1 0
decimal digit, only one bit of the 4 0 1 0 0 0 1 1 0
equivalent binary number (word) 5 0 1 0 1 0 1 1 1
6 0 1 1 0 0 1 0 1
changes value with respect to the
7 0 1 1 1 0 1 0 0
preceding binary number.
8 1 0 0 0 1 1 0 0
The table opposite shows the 9 1 0 0 1 1 1 0 1
GRAY code for decimal numbers 10 1 0 1 0 1 1 1 1
between 0 and 15. 11 1 0 1 1 1 1 1 0
12 1 1 0 0 1 0 1 0
13 1 1 0 1 1 0 1 1
14 1 1 1 0 1 0 0 1
15 1 1 1 1 1 0 0 0

Page 9
DIGITAL CIRCUIT COURSES

b) Decimal to pure binary conversion - Gray


To code a decimal number to its Gray equivalent, we first convert the decimal number to its
natural binary equivalent, then reproduce the most significant bit, then add the neighboring bits 2 by 2
from the MSB, and in each case retain the result of the addition without any carry.

Example: (14)10 = (? )𝐺𝑟𝑎𝑦

14 (1 1 1 0
+ + +
)2 (𝟏𝟒)𝟏𝟎 = (𝟏𝟏𝟎)𝟐 = (𝟏𝟎𝟎𝟏)𝑮𝒓𝒂𝒚

(1 0 0 1 )Gray
To decode a number in GRAY code to its decimal equivalent, we first convert the Gray number
to its natural binary equivalent and then reproduce the most significant bit, then proceed as follows:

Example: (1001)𝐺𝑟𝑎𝑦 = (? )10


(1110)2 = 1x23 + 1x22 + 1x21 + 0x20
(1 0 0 1 )GRAY =8+4+2
+ + + = (14)10

(1 1 1 0 )2 (𝟏𝟎𝟎𝟏)𝑮𝒓𝒂𝒚 = (𝟏𝟏𝟏𝟎)𝟐 = (𝟏𝟒)𝟏𝟎

c) ASCII code
ASCII code (American Standard Code for Information Interchange).
This is a widespread code used in virtually all computers to exchange information between a
CPU and peripherals such as keyboards, printers, consoles, etc... It is part of one of the alphanumeric
codes and is widely used to code the keyboard keys of these digital machines. It generally comprises 7
bits of information and offers 27 , i.e. 128 possible characters. (And sometimes 1 parity bit).

Page 10
DIGITAL CIRCUIT COURSES

7-bit ASCII code

Example
Keyboard keys ASCII code Keyboard keys ASCII code
0 0110000 a 1100001
1 0110001 b 1100010
2 0110010 s 1110011
9 0111001 ( 0101000
A 1000001 & 0100110
B 1000010 = 0111101
C 1000011 + 0101011
D 1000100 DEL 1111111
E 1000101 ! 0100001
Y 1011001 ? 0111111

Several other codes are used, such as Barre, Aïken, Unicode, EIA (Electronic Industries
Association)...

Page 11
DIGITAL CIRCUIT COURSES

Lesson 3: ARITHMETIC OPERATIONS AND


NOTATION OF BINARY NUMBERS
I. ARITHMETIC OPERATIONS

I.1. Operation of binary numbers


a) Addition
The addition of two binary numbers is summarized by the following properties:

Operations Results Reservoirs Examples


0+0 = 0 0 1 1 11111
0+1 = 1 0 11011 111011
+ +
1+0 = 1 0 10010 10110
1+1 = 0 1
101101 1010001
1+1+1 = 1 1

b) Subtraction

Operations Results Reservoirs Examples


0-0 = 0 0 10011 101011
0-1 = 1 1
- -
1110 10110
1-0 = 1 0 11 1 1
1-1 = 0 0 0010 10 1 0 1 0
1
1-1-1 = 1 1

c) Multiplication

It is performed in the same way as in decimal.

Operations Results Example


0X0 = 0 11011
X
0X1 = 0 11
11111
1X0 = 0 11011
1X1 = 1 11011
1010001

Page 12
DIGITAL CIRCUIT COURSES

c) Division

Operations Results Example

0/0 = Impossible 1010001 11


11
11011
0/1 = 0 0100
11
1/0 = Impossible 010
00
1/1 = 1 100
11
011
11
00
I.2. Hexadecimal number operation
a) Addition
To add two hexadecimal numbers, the procedure is as follows:

✓ Begin addition with the least significant digits as in decimal, mentally replacing letters with
their decimal equivalents.
✓ If the sum is ≥ 16, subtract 16 from this sum and transfer 1 seizaine to the left-hand row.

Example: perform (58E)16 + (A22)16 = (? )16 ; (7AD45)16 + (B0CF8)16 = (? )16

1 1 1 1

58E 7AD45
+ +
A22 B0CF8
FB0 12BA3D
b) Subtraction: The procedure is the same as for decimal.
Note: (-1)10 = (FFFFF...)16

Example: perform (CD0)16 - (4E5)16 = ( ? )16 ; (3D58)16 - (29F7)16 = ( ? )16

-CD0 3D58
4E5 0 -5: impossible,
1 -29F7
1 We borrow 1 seizaine from D,
80B which
1361 which makes (0 + 16) - 5 = 11 = B

Page 13
DIGITAL CIRCUIT COURSES

c) Multiplication 3XA = 30 = (16 x 1) +14. We write E and retain 1 seizaine.


5C9A 3x9 = 27 + 1 seizaine borrowed; which = 28 = (16 x 1) +12; We

x writes C and retains 1 seizaine

1F3
1 1 1
3xC +1= 37 = (16 x 2) + 5, We write 5 and retain 2 seizaines.
3x5 + 2 = 16 = (16x1) + 1; We write 1 and retain 1 seizaine and this 1

1
115CE will be brought forward because the operation is complete.

56D06 FxA = 150 = (16 x 9) + 6; We write 6 and retain 9 seizaines.


Fx9 = 135+ 9 seizaine borrowed = 144 = (16x9) + 0; We write 0 and
5C9A retain 9 seizaines
FxC = 180 + 9 = 189 = (16 x 11) +13, We write D and retain B = 11
B4802 F x 5 + 11 = 86 = (16 x 5) + 6; We write 6 and retain 5 seizaine and

E
this retained 5 will be brought forward because operation completed.

Etc ...

I.3) Operation of numbers in base 8


The principle remains the same as before.

Carry out the following operations: (237)8 x (63)8 = (17655)8

3X7 = 21 = (8 x2) + 5. We write 5 and retain 2 eightaines


3 x 3 = 9 + 2 eight borrowed; which = 11 = (8 x 1) + 3; We write
3 and we retain 1 week
3x2 = 6 + 1 7; operation completed.
Etc ...

I.3) Number operation in DCB


Remember that each decimal digit is assigned a 4-bit code between 0000 and 1001. Two cases
can arise when adding two decimal digits.

a) The sum of two digits is ≤ 9 :


In this case, no sum of two decimal digits exceeds 9, so there are no decimal carryovers. In this
situation, BCD addition is a direct process equivalent to normal binary addition.

5
+ + 0101 253
+421 +
0010 0101 0011
3 0011 0100 0010 0001
8 1000 674 0110 0111 0100
6 7 4
b) The sum of two digits > 9:
By adding two BCD-coded digits, we can obtain six forbidden or invalid representations. These
are: 1010, 1011, 1100, 1101, 1110, 1111. These representations do not exist in BCD code.

Page 14
DIGITAL CIRCUIT COURSES

In such a case, the sum must be corrected by adding 6 (0110) to take into account the fact that six
invalid coded presentations have been skipped.

For example:

5 0101 45 0100 0101


+ +
7 0111 89 1000 1001
12 +1100 Invalid code 134 1100 1110
O110 + 0110 1st correction
0001 0010 Valid result + 11010100
0110 2nd correction
1 2
000100110100
1 3 4

In some cases, the carry can be transferred from the first least significant quartet to the next at the
very first stage of the operation.

Example:

78 0111 1000
+
39 0011 1001
117 1011 0001
+ 0110 1st correction
+1011 0111
0110 2nd correction
00010001 0111
1 1 7
c) Recapitulation of addition in BCD:

✓ Ordinary binary addition of BCD representations of all ranks.


✓ For rows where the sum is equal to or less than 9, no correction is necessary and the sum is a
valid BCD representation.
✓ When the sum of the two digits is greater than 9, a correction of 0110 is added to obtain the exact
BCD representation. There is always a carryover to the digit immediately to the left, except
during the initial addition (first step), when a correction is made.

II. SIGNED BINARY NUMBER NOTATION

II.1) Exact size notation


Most computers process both positive and negative numbers. Up to now, the operations we have
carried out have mainly involved positive numbers. By

Page 15
DIGITAL CIRCUIT COURSES

In addition, there are a number of notations for handling these numbers. Negative numbers will be
represented on the same word length as positive numbers.

A certain convention must be adopted to represent the sign of a number; to do this, another bit is
added to the number, called the sign bit or number bit, and placed at the extreme left of the binary
number. Positive numbers will have "0" as their sign bit, and negative numbers "1".

Example: If +3 and -3 are to be represented as exact 4-bit values

+3 = 0011 ; -3 = 1011

II.2) Notation in addition to 1


To express a number in 1's complement notation, we replace each 1 by 0 and each 0 by 1
making up this number (in other words, make the bit-by-bit complement of this number).
Example: Give the 1's complement representation of the decimal number 24

24 = (11000)2 ; C1 (24) = (00111)

II.3) Notation in addition to 2

The 2's complement is widely used as the natural representation of negative numbers. The 2's
complement of a number is obtained by adding 1 (to the LSB) to its 1's complement.

C2 (N) = C1 (N) + 1

Example: Give the 2's complement representation of the decimal number 24

24 = (11000)2 ; C2 (24) = C1 (24) + 1

24 = (11000)2 = ( 0 0 1 1 1 ) C1
+ 1
( 0 1 0 0 0 ) C2

Note: Two's complement is used to represent negative binary numbers.

II.4) Studying signed binary numbers in 2's complement

Here's how to write signed binary numbers using 2's complement notation.
✓ If the number is positive, its magnitude is the exact binary magnitude and its sign bit is
a 0 in front of the most significant bit.

Example: C2 (+45) =

(+45) =10 0 1 0 1 1 0 1
Sign bitExact size

Page 16
DIGITAL CIRCUIT COURSES

✓ If the number is negative, its magnitude is the 2's complement of the exact magnitude
and its sign bit is a 1 to the left of the most significant bit.

(- 45) =10 1 0 1 0 0 1 1
Sign bitComplement to 2 of 45

NB: The 2's complement of a signed number transforms a positive number into a negative number and
vice versa. (The 2's complement of the 2's complement of a number gives the number itself).

C2 (45) = - 45 andC2 (- 45) = 45

II.5) Addition of signed binary numbers

a) Two positive numbers

+9 0 1001
+
+4 0 0100
+ 13 0 1101

Sign bit
b) Case of a positive number and a smaller negative number
Add +9 and -4 over 5 bits

+9 = 0 1001 ; 4 = 0100 ; C1 (4) = 1011 andC2 (4) = 1100 hence- 4 = 11100

1 1

+9 0 1001
+
-4 1 1100
+5 1 0 0101
Overflow Sign bit
( Not taken into
consideration)
Note that the sign bits are also added. In fact, a carry is produced when the last row is added.
This carryover is still called overflow and is always rejected, hence the final sum of 00101, i.e. the
decimal number +5.

c) Case of a positive number and a larger negative number.

Let be the addition of -9 and +4:

9 = 1001 ; C1 (1) = 0110 andC2 (9) = 0111 hence- 9 = 1 0111

Page 17
DIGITAL CIRCUIT COURSES

-9 1 0111
+
+4 0 0100
-5 1 1011
Sign bit

In this case, the sign bit of the sum is 1, indicating a negative number. As the sum is a negative
number, the answer is the 2's complement of the exact magnitude. So 1011 is actually the 2's complement
of the sum. To find the exact magnitude of the sum, we need to take the 2's complement of 1011, which
gives 0101 = (5); the answer is therefore 11011 = -5.

The result can also be checked by adding the weight of each bit, with the sign bit worth -2N,
where N is the number of bits of magnitude.

d) Two negative numbers


1 1

-9 1 0111
+
-4 1 1100
- 13 1 1 0011
Overflow Sign bit
( Not taken into
consideration)
The final result was again negative (-13).

Notes : A subtraction operation involving numbers expressed in 2's complement notation is in reality an
addition operation that differs little from the cases examined above.

Example: 9 - 4 = (+9) + (-4)

Page 18
DIGITAL CIRCUIT COURSES

TD N°1: NUMBERING SYSTEMS AND CODES


Exercise 1
1) Write the decimal number 193685.457 in its polynomial form
2) Coding the decimal number 2567, 125
a) In pure binaryb ) In hexadecimalc ) In DCBd ) In code plus 3c ) In GRAY code
3) What's the difference between bit and byte?
4) What's the difference between a weighted and an unweighted numerical code?
5) What is the largest decimal number that can be represented with an 8-bit binary number?
6) Consider a decimal number X that can be transcribed into an N-bit binary number. If we double X,
how many bits are needed to write the corresponding binary number?
7) What is the largest positive decimal number that can be written with 6 bits, including the sign bit?
8) Give the range of signed binary numbers that can be represented on a byte
9) When are two binary numbers said to be adjacent?

Exercise 2
1) A microcomputer can store 16 bits in each of its memory locations. If the range of memory
addresses is from (0000)16 to (𝐹𝐹00)16, say how many memory locations this computer has.
2) Another microcomputer has 10240 memory locations. Give its address range in hexadecimal,
starting at address (1000).16
Exercise 3 Exercise 5:
Perform the following conversions: Perform the following operations in the
a) (1101011)2 = (? )16 = (? )10 = (? )8 indicated bases
b) (10110111,0110)2 = (? )3 = (? )5 1) (3𝐷7𝐸)16 × (𝐵2𝐴)16
c) (2567)10 = (? )2 = (? )8 = (? )16 2) (5𝐵𝐹)16 + (4𝐶𝐵)16
d) (1936,45)10 =?2 = (? )16 = (? )𝐷𝐶𝐵 3) (4756)8 + (3527)8
e) 107.8125 = ( ? )8 = ( ? )2 = ( ? )16 4) (175214)8 - (152405)8
f) (2𝐴𝐸𝐶)16 = (? )𝐺𝑅𝐴F = (? )𝐷𝐶𝐵 = (? )𝐸𝑋𝐶𝑒𝑠𝑠 3 5) (2)𝐵𝐶𝐷 + (5)𝐵𝐶𝐷
g) (0.09375)10 =?2 6) (6)𝐵𝐶𝐷 + (4)𝐵𝐶𝐷
h) (3623.71)16 = ( ? )10 = ( ? )8
7) (08)𝐵𝐶𝐷 + (09)𝐵𝐶𝐷
i) (𝐹2𝐴)16 =?2 =?𝐷𝐶𝐵 =?8 =?𝐺𝑅𝐴F
8) (47)𝐵𝐶𝐷 + (35)𝐵𝐶𝐷
j) (1001100111111)𝐷𝐶𝐵 =?10 =?8 =?16
Exercise 4: Exercise 6:
1) Perform the following operations in base 2 1) Write the following numbers in 8-bit 2's
a) 0,1011 + 0,111 complement code: +1 ; -1 ; -55 ; 22,
b) 1011,110 + 11,1 +127, - 127, -128 ; +129 ; - 129.
c) 0011 - 1111 2) Perform the following 8-bit signed
d) 1110 -1011 integer operations, including the sign bit
e) 1011 x 1011 a) (+17) + (-12)
f) 101,101 x 0,1101 b) (-63) + (+28)
g) 111111 / 1001 c) (+63) + (-28)
d) (+35) + (+65)
e) (-35) + (-28)

Page 19

You might also like