Cours Struct M Chapitre1
Cours Struct M Chapitre1
Computer structure
1
• Mr BOUKRA Abdelmadjid
• Teacher-researcher at the university of sciences
• and technology Houari Boumediene (USTHB)
Email : [email protected]
𝑵𝑵𝑩𝑩 = 𝒂𝒂𝒏𝒏 . 𝑩𝑩𝒏𝒏 + 𝒂𝒂𝒏𝒏−𝟏𝟏 . 𝑩𝑩𝒏𝒏−𝟏𝟏 + ⋯ + 𝒂𝒂𝟎𝟎 . 𝑩𝑩𝟎𝟎 + 𝒂𝒂−𝟏𝟏 . 𝑩𝑩−𝟏𝟏 + 𝒂𝒂−𝟐𝟐 . 𝑩𝑩−𝟐𝟐 …
𝟎𝟎 ≤ 𝒂𝒂𝒊𝒊 < 𝑩𝑩
𝑵𝑵𝟏𝟏𝟏𝟏 = � 𝒂𝒂𝒊𝒊 . 𝟏𝟏𝟏𝟏𝒊𝒊 𝑎𝑎𝑖𝑖 𝜖𝜖 {0,1,2,3,4,5,6,7,8,9, 𝐴𝐴, 𝐵𝐵, 𝐶𝐶, 𝐷𝐷, 𝐸𝐸, 𝐹𝐹}
𝒊𝒊=𝟎𝟎
c) Binary system
B=2 𝒏𝒏
• 1227= (2 3 1 3)8
• B1 B2
• 10
• + 1 0 1 100
• = 11 0 0 001
2020/2021 Abdelmadjid Boukra 15
Binary subtraction
0-0=0
0 - 1 = 1 carry 1
1-0=1
1-1=0
Example
11 01 01 11 0 1 1
- 1 0 1 111
= 0 0 1 1 100
6. Notion of Code.
The computer only recognizes 0 and 1, so to manipulate the user's objects
(number, character, image, etc.), coding is necessary.
6.1 Some existing codes
Natural binary code
To represent integers, we can use the natural binary code, which is the
binary equivalent of the integer.
In this representation,
A positive number +N is represented by its n-bit binary value,
A negative number -N is represented by the two's complement of its
positive equivalent +N.
The most significant bit is the sign bit (0 +) (1 -).
For example, let's represent +33 and - 33 in the 2's complement
representation.
+33 is positive, so its 8-bit representation is 00100001
-33 is negative, we calculate C2(00100001)=11011111.
so -33 will be represented in the 2’s complement representation by
11011111
Concerning the (CP) and the (CS), the same considerations for
representation in C1 also hold for C2. When adding two numbers Q and N,
the table used for checking the carries for overflow errors still holds:
C2 code allows us to execute additions regardless of the sign of the addends by using a normal binary adder
with no need to make corrections to the result (unlike with C1).
• Remarks
• We have only one representation of the 0 00000000
• Range of representable signed numbers
• If N is represented on n bits
• -(2𝑛𝑛−1 ) ≤ 𝑁𝑁 ≤ +(2𝑛𝑛−1 − 1)
• For 8 bits
• -128≤ N ≤ +127
• In this representation, we can transform a subtraction into an
addition because A-B is equivalent to A+C2(B)
2020/2021 Boukra
Abdelmadjid
Abdelmadjid
Boukra
(USTHB) 45
• The UNICODE code (Universal code)
• UNICODE uses 16 bits. It can therefore code 65 536 characters
Unicode adopts the ASCII coding for the main characters, using 16
bits.
2020/2021 Boukra
Abdelmadjid
Abdelmadjid
Boukra
(USTHB) 46