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

Machine Structure Chapter 01

The document outlines the curriculum for the Machine Structure 1 module at Abdalhafid Boussouf University Center, covering various numbering systems, information representation, and Boolean algebra. Key topics include decimal, binary, octal, and hexadecimal systems, as well as methods for converting between these systems and performing arithmetic operations. The module aims to deepen understanding of information encoding and logical operations in digital electronics.

Uploaded by

mouinkendel3
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Machine Structure Chapter 01

The document outlines the curriculum for the Machine Structure 1 module at Abdalhafid Boussouf University Center, covering various numbering systems, information representation, and Boolean algebra. Key topics include decimal, binary, octal, and hexadecimal systems, as well as methods for converting between these systems and performing arithmetic operations. The module aims to deepen understanding of information encoding and logical operations in digital electronics.

Uploaded by

mouinkendel3
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

1

Machine
Structure-1

Abdalhafid Boussouf University Center, Mila 2022/2023


The content of the module :
 Module : Machine Structure 1
 Teaching Unit : Fundamental
 Credits : 5
 Coefficient : 3
 Teaching Objectives :
The aim of this module is to introduce and deepen the
concepts related to different numbering systems as well as
the presentation of information, whether it is numeric or
character-based.
The basics of Boolean algebra are also covered in-depth.
The content of the module :
Subject Content:
 Chapter 1 :
General Introduction.
 Chapter 2 : Numbering Systems
Definition
- Presentation of systems:
Decimal, Binary, Octal, and Hexadecimal.
- Conversion between these different systems.
- Basic Operations in the Binary systems :
Addition, Substraction, Multiplication, Division.
The content of the module :
Chapter 3 : information representation
 Representation of numbers :
1-Integer Numbers : Unsigned Representation , Sign and
Absolute Value Representation, One’s Complement , Two’s
Complement.
2- Fractional numbers : Fixed point, Floating Point.
 Binary coding: Pure Binary Code, Reflected Binary Code,
Gray Code, DCB code , Excess-3 Code.
 Character Representation : EBCDIC Code, ASCII Code,
UTF.
The content of the module :
Chapter 4 : Binary Boolean Algebra
 Definition of Boolean Algebra: (Theorems and Properties).
 Logical operators: (AND, OR, negation, NAND and NOR,
Exclusive OR) Schematic Representation,
 Truth table, Logical Expressions and Fonctions, Algebraic
representation of a function in both the first and second normal
forms, Expression of a logical function using NAND or NOR
gates..
 Logical function diagram. Simplification of a logical function:
(Algebraic Method, Karnaugh Maps, Quine-McCluskey
Method)..
2

Chapter 1 : Numertion Systems


 Introduction
 Information Encoding,
 Numeration Systems
- The Decimal System
- The binary System, octal, Hexadecimal
 The transcoding (Base conversion) .
 Arithmetic opérations .
3

Objectives

 Understanding what information


encoding is.
 Learning transcoding (conversion from
one base to another).
 Learning to perform arithmetic operations
in binary,
4
Introduction
• The information processed by computers
comes in various forms: numbers, text,
images, sounds, videos, programs, ...

• In a computer, they are always represented in


binary form (BIT: Binary digIT) as a
sequence of 0 s and 1 s.
7
5
Information Encoding :
Definition:
• Encoding allows establishing an unambiguous
correspondence between an external representation of
information and another representation (called
internal), typically in binary form, using a set of
precise rules.
• Example: The number 35: 35 is the external
representation of the number thirty-five.
• The internal representation of 35 will be a sequence of
0s and 1s (100011).
• We have become accustomed to representing numbers
using ten different symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
This system is called the decimal system (decim
means ten).
• However, there are other numeral systems that operate
using a different number of distinct symbols.
• For example:
 Binary system (bi: two),
 The octal system (oct: eight),
 The hexadecimal system (hexa: sixteen). ...
• In a numeral system, the number of distinct symbols is
called the base of the numeral system.
7

Number systems
Number systems:
 A number system describes how numbers are
represented.
 A number system is defined by:

 A base
 An alphabet A: a set of symbols or digits
 Rules for representing numbers
Number Systems:
 The number systems used in the fields of digital
electronics and computing are as follows:

 Binary System (Base 2)


 Octal System (Base 8)
 Hexadecimal System (Base 16)

 In addition to the Decimal System (Base 10) used by


humans to communicate with the machine.
The decimal system:
 Suppose we have 15 tokens, if we form groups of 10
tokens, we will get one group, and there will be 5
tokens left:
The decimal system:
The decimal system's alphabet consists of ten different
digits: A = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. Any combination of
the symbols {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} gives us a number.
The decimal system:
 Take the number 1982, this number can be written
in the following form:
(1982)10=2+80+900+1000 =1*2+8*10+9*100+1*1000
(1982)10=2*100+8*101+9*102+1*103

This form is called the polynomial form. A real number


can also be written in polynomial form.

(978,265)10 = 8*100 + 7 *101 + 9 *102 + 2*10-1 + 6*10-2 + 5*10-3


Decimal counting :
 On a single position: 0 ,1,2,3,4,5,….9= 101-1
 On two positions: 00 , 01,02, …..,99=102-1
 On three positions : 000,001,……,999=103-1

 On n positions:
• Minimum 0
• Maximum 10n-1
• Number of combinations10n
The binary system:
All communication within the computer is done with
electrical signals.
An electrical signal has only two states:
   absence of an electrical signal
   presence of an electrical signal

 A unit of information (0 or 1) is called a bit (from


the English term 'binary digit').
The binary system :
Let's suppose we have 15 tokens, and we form groups
of 2 tokens, then continue forming groups of 2
consecutively:

 The number 1111 is the representation of the decimal


number '15' in base 2.
The binary system :
In the binary system, to express any value, only 2 symbols
are used: A = {0, 1}.

A number in base 2 can also be written in polynomial form.


(1101)2= 1*20 + 0*21 + 1*22 +1*23
(110,101)2= 0*20 + 1*21 + 1*22 + 1*2-1 + 0*2-2 + 1*2-3
Binary counting
17
On 4 Bits
On 3 Bits
Exemple 222120
• on a single bit : 0 , 1
• On 2 bits :

4 combinaisons= 22

8 combinaisons= 23

16 combinaisons= 24
The Binary Counting:
 With one bit, we can encode two states; with 2 bits, four
states... With each new bit, the number of possible
combinations doubles.
 Using n bits, we can form 2n different numbers, and the
largest among them is equal to (2n-1). For example, if n=
8, Nmax = (28-1) = 255, We can form 256 different
numbers from:
(0)10 =(00000000)2 -to- (255)10 =(11111111)2
 Note: A group of eight bits is called a byte
The octal system:
It is the base-8 system
Eight (8) symbols are used in this system:
A={ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 }
 Example of polynomial form :
(237)8 = 7*80 + 3*81 + 2*82
(53,948)8 = 3*80 + 5*81 + 9*8-1 + 4*8-2 + 8*8-3
 Exemple 2 :
The number (1289) does not exist in base 8 since the
symbols 8 and 9 do not belong to the octal base.
The hexadecimal system:
It is the base-16 system
Sixteen different symbols are used:
{0,1,2,3,4,5,6,7,8,9,A, B, C, D,E, F}

Exemple of polynomial form:


(A4C)16 = 12*160 + 4*161 + 10*162
(14,2B)16 = 4*160 + 1*161 + 2*16-1 +11*16-2
Generalization: System B:
 In a base B,
 B distinct symbols are used to represent numbers.
 The value of each symbol must be strictly less than
the base B.
 Every number in a base B can be written in its
polynomial form.

NB= (an-1 an-2 …. a2 a1 a0 , a-1…. a-m)B = a0.B0+ …. + an-2


.Bn-2 + an-1.Bn-1 + a-1.B-1 + ….+ a-m.B-m =N10
Transcoding:
(Base Conversion)
Definition of transcoding :
 Transcoding (or base conversion): is the operation that
allows us to switch from the representation of a
number expressed in one base to the representation of
the same number but expressed in another base.

 Next, we will see the following base conversions:

 Decimal to Binary, Octal, and Hexadecimal


 Binary to Decimal, Octal, and Hexadecimal
Conversion from base B to base 10:
 This conversion is quite simple because all you need
to do is to: expand this number in polynomial form in
base B and then add them up.
 Exemples :
 (1101)2= 1*20 + 0*21 + 1*22 + 1*23 = (13)10
 (1A7)16 = 7*160 + 10*161 + 1*162 = (423)10
 (1101,101)2= 1*20 + 0*21 + 1*22 + 1*23 + 1*2-1 + 0*2-2
+ 1*2-3 = (13,625)10
 (43,2)5 = 3*50 + 4*51 + 2*5-1 = (23,4)10
Conversion from decimal to base B:

 Principle:

 Division by B for the integer part.

 Multiplication by B for the fractional part.


Conversion from base 10 to base 2:
 The principle consists of performing successive
divisions of the number by 2, and taking the
remainders of the divisions in reverse order.

 Exemple : (35)10=(?)2

 After division :
 you obtain :(35)10 = (100011)2
Conversion from base 10 to base 2:
 (in the case of a real number): A real number consists of
two parts:
 The integer part and the fractional part. The integer part is
transformed by performing successive divisions.
 The fractional part is transformed by performing
successive multiplications by 2.
 Exemple 1: 35,625=(?)2
0,625 * 2 =1,250
I . P =35 = (100011)2,
0,25* 2 = 0 ,50
0,5* 2 = 1 ,0,
F.P= 0,625) = (0,101)2,
Donc 35,625=(100011,101)2
Conversion from base 10 to base 2:
 Exemple 2:
 Perform the following conversion, (0,7)10=(?)2
(in the case of a real
0,7 * 2 = 1,4 number)
0,4 * 2 = 0,8
0,8 * 2 = 1,6 (0,7)= (0,10110)2
0,6 * 2 = 1,2
0,2 * 2 = 0,4

 The number of bits after the decimal point will determine


the precision.
Conversion from base 10 to base 2:
 Note: Sometimes, when multiplying the decimal part by Base B, we
may not be able to convert the entire integer part. This is mainly due
to the fact that the number being converted does not have an exact
equivalent in Base B, and its decimal part is cyclic.
 0,15*2=0,3
 0,3*2=0,6
 0,6*2=1,2
 0,2*2=0,4
 0,4*2=0,8
 0,8*2=1,6
 0,6*2=1,2
 The result is, therefore : (0,15)10= (0, 0010011001...)2. It is said that
(0,15)10 is cyclic in Base 2 with a period of 1001.
 Note: After several multiplications, we stop the calculations.
Conversion from decimal to base X
28

• The conversion is done by taking the remainders of


successive divisions in base X in reverse order.
Example: Perform the following 35 3
conversions: 2 11 3
2
3 3
(35) 10 = (?)3
0 1 3
(37) 10 = (?)3
1 0
37 3
1 12 3
0
4 3
(35) 10 = (1022)3 1 1 3
(37) 10 = (1101)3 1 0
29 Conversion from decimal to base X
43 2
• Exercise: Perform the following transformations.
1 21 2 (43)10=(?)2=(?)5 =(?)8 =(?)16
1 10 2
0 5 2
1 2 2
0 1 2
(101011)2
1 0
30 Conversion from base b1 to base b2
• To go from one base b1 to another base b2 directly
(usually there is no method!!)
• The idea is to convert the number from base b1 to base 10,
and then convert the result from base 10 to base b2.
Conversion
31 from base b1 to base b2
Exercise: Perform the following conversion.
( 34)5=(?)7

( 34 ) 5  3 * 5 1  4 * 5 0  15  4  (19 ) 1 0  (?) 7

19 7

5 2 7
2 0

(34)5 =(19)10=(25)7 (34)5=(25)7


Octal to binary conversion :
 In octal, each symbol of the base is represented by 3 bits in
binary. The basic idea is to replace each symbol in the octal
base with its 3-bit binary value (performing expansions into 3
bits).
 Exemples : (345)8=?; (65,76)8=?; (35,34)8=?

 Note: The replacement is done from right to left for the integer
part and from left to right for the fractional part.
Octal to binary conversion :

 The basic idea is to group the bits in sets of 3 starting from the
least significant bit.
 Then, replace each group with the corresponding octal value.

 Exemples : (11001010010110)2 =?; (110010100,10101)2 =?


(11001010010110)2 = (011 001 010 010 110)2 = (31226)8
(110010100,10101)2 = (110 010 100 , 101 010)2 = (624,52)8
<--- ---->
 Note: Grouping is done from right to left for the integer part
and from left to right for the fractional part.
Hexadecimal to binary conversion:
 In hexadecimal, each symbol in the base is represented
using 4 bits. The basic idea is to replace each symbol with
its 4-bit binary value (performing splitting into 4 bits).

 Exemples :(757F)16=? ; (BA3,5F7)16 =?

(757F)16=(0111 0101 0111 1111)2


(BA3,5F7)16 = ( 1011 1010 0011 , 0101 1111 0111 ) 2
Hexadecimal to binary conversion:
 The basic idea is to group the bits into sets of 4,
starting from the least significant bit. Then, replace each
group with the corresponding hexadecimal value.
 Exemples :
 (11001010100110)2=?
 (110010100,10101)2 = ?

(11001010100110)2=(0011 0010 1010 0110)2=(32A6)16


(110010100,10101)2 = (0001 1001 0100,1010 1000)2 =(194,A8)16
"Conversion from base B1 to base B2

Both bases are powers of 2 (base 8 and 16).


The base 2 is used as an intermediate base.

Base B1 → Base 2 → BaseB2

Both bases are not powers of 2.


The base 10 is used as an intermediate base.

Base B1 → Base 10 → Base B2


37

Arithmetic
operations
Arithmetic operations

 General principle:

 The rules of arithmetic operations in decimal are also


valid for arithmetic operations in any base.
Binary Addition
 To add two binary numbers, we proceed exactly as in
decimal, but taking into account the following elementary
addition table:

 0+0 = 0 carry 0
 0+1 = 1 + 0 = 1 carry 0
 1 + 1 = 0 carry 1
 1 + 1 + 1 = 1 carry 1
Binary Addition
 Exemple:
Arithmetic operations in binary
 Exercice: Perform the following operation
(1100011)2 +(10001011)2 =(?)2 :

The resultat : (11101110)2


Arithmetic operations in octal
Exercice: Perform the following operation :
(4365)8 +(451)8 =(?)8 (4865)16 +(7A51)16 =(?)16

Octal Operations Hexadecimal Operations

The result : (5036)8 The result : (C2B6)16


binary subtraction
 In binary subtraction, when the quantity to subtract is greater
than the quantity being subtracted from, we borrow 1 from the
left neighbor. In binary, this 1 adds 2 to the quantity being
subtracted from, while in decimal, it adds 10.
Table de soustraction binaire :
 0 - 0 = 0 Carry 0
 1 - 0 = 1 Carry 0
 0 - 1 = 1 Carry 1 is subtracted
from the left neighbor digit
 0 - 1 - 1 = 0 Carry 1 is subtracted
from the left neighbor digit
binary subtraction

 Exemple
binary subtraction

 Exemple
Binary Multiplication
 Binary multiplication is performed in a similar way to decimal
multiplication. Here are the calculation rules to use:

 Note: When an operation


results in more than two
partial products, add these
products together in pairs
to reduce the risk of errors.
Binary Multiplication

 Exemple
Binary Multiplication

 Exemple
Binary Multiplicaion

 Exemple
Binary Multiplication

 Exemple
binary Division
 Binary division is performed using subtractions and
shifts, similar to decimal division, except that the
quotient digits can only be 1 or 0. The quotient bit is 1 if
the divisor can be subtracted, otherwise it is 0.
binary Division
Exemple
binary Division
Exemple
binary Division
Exemple
binary Division
Exemple
Arithmetic Operations in Octal:
 The addition
 Just like in the binary system, the same rules apply to
octal numbers. However, in this case, we will have a
carry-over '1' to the left whenever the sum exceeds the
value of 7 because 7(8) + 1(8) = 10(8).
 Example of addition in octal base:
Arithmetic Operations in Octal:
 Subtraction
 Similar to decimal subtraction but limited to 7 (octal).
 Exemple:
Arithmetic Operations in Octal:
 Subtraction
 Similar to decimal subtraction but limited to 7 (octal).
 Exemple:
Hexadecimal Arithmetic Operations
 Addition
 Similar to decimal addition, hexadecimal addition is
performed digit by digit. However, in this case, there will
be a carry '1' to the left each time the sum exceeds the
value F because: (F16+116)=10(16).
Hexadecimal Arithmetic Operations
 The substraction in hexadecimal:
 Exemple:
Hexadecimal Arithmetic Operations
 The substraction in hexadecimal :
 Exemple:
Hexadecimal
Division
Exemple: find division of:
3DE5 / A
Thanks a lot

You might also like