Internet Windows Android

Binary arithmetic presentation. Binary arithmetic (continued)

Calculate the algebraic sum -5 - 1.

Bit grid overflow symptom:

When adding two numbers algebraically,

fit into the bit grid, may arise

overflow, that is, an amount is formed that requires

its representation is one bit more,

than the discharge grid of the terms. It is assumed that

positive numbers are represented in direct code, and

negative in complementary.

Overflow is indicated by the presence of a transfer in

sign digit of the sum in the absence of carry from

signed bit (positive overflow) or

the presence of a transfer from the sign digit of the sum at

no transfer to the sign bit (negative

overflow).

If the overflow is positive, the result of the operation

positive, and with negative overflow -

negative.

If both the signed and the signed digit of the sum

Physics of computers 2011

there are hyphens or there are no hyphens, then

L.A. Zolotorevich

there is no overflow.

These codes differ from the forward, reverse and complementary codes in that two digits are allocated to the image of the sign: if the number is positive - 00, if the number is negative - 11. Such codes turned out to be convenient (from the point of view of constructing an ALU) for detecting overflow of the bit grid. If the signed bits of the result take the value 00 and 11, then there was no overflow of the bit grid, and if 01 or 10, then there was

overflow.

Note:

It should be borne in mind that only the basic principles of performing arithmetic operations have been considered, from which it can be seen that all arithmetic operations with binary numbers can be reduced to two operations - the operations of summing binary numbers in the direct or

complementary codes, as well as shift operations

binary number to the right or to the left. Real algorithms

Operations Physics of computer multiplication and division 2011 in modern

Computers are rather bulky L.A. Zolotorevich is not considered here.

Higher precision arithmetic requires more memory to store the same amount of data

and more intensive work of the processor.The increase in the amount of memory required is obvious enough.

Consider very briefly the sequence of operations for adding numbers with triple precision. It is no longer enough to extract two words from memory, to form the sum in the accumulator.

and send the result to memory.

First, you need to make an appeal to the least significant word of each number.

After addition, the result is written into memory, and possible transfers are subject to temporary storage.

Then the average words are extracted, they are added, and the carry bits obtained as a result of the previous operation are added to the sum. The result is written into memory in a place specially reserved for the middle word of the sum.

They do the same with the senior word.

Thus, triple precision arithmetic requires three times more memory and addition time than arithmetic.

single precision. Physics In addition to the computer, in the event of an interruption in 2011, it is necessary to L temporarily. A. Gold revich to store the contents

Methods for speeding up multiplication.

The considered approach to multiplication shows that multiplication is a rather long operation, consisting of N summations and shifts, as well as separating the next digits of the factor. This implies the urgency of the problem of minimizing the time spent on the multiplication operation, especially for systems operating in real time.

In modern computers, multiplication acceleration methods can be divided into:

1) hardware;

2) logical (algorithmic);

3) combined.

Hardware methods.

1. Parallelization of computational operations. For example, time alignment of summation and shift.

2. Tabular multiplication.

Physics of computers 2011 L.A. Zolotorevich

Table multiplication is a fairly common way to implement various functions. Let's dwell on it in more detail.

Let X and Y be 1-byte integers. It is necessary to calculate Z = X * Y. You can use 65K bytes of memory and enter the Z values ​​for all possible combinations of X and Y, and use the X and Y factors as the address. It turns out a kind of table of the following form:

Physics of computers 2011 L.A. Zolotorevich

Combined methods.

Let's look at an example. Let X and Y be 16-bit numbers. It is necessary to calculate the product of the form: Z = X * Y. It will not be possible to use the table method directly, since this will require a very large amount of memory. However, you can think of each factor as the sum of two 16-bit terms, each of which represents a group of the most significant and least significant bits of the factors. In this case, the work will take the form:

Z = X * Y = (x15 ... x0) * (y15 ... y0) =

= (x15 ... x8 000 ... 0 + 000 ... 0x7 ... x0) * (y15 ... y8 000 ... 0 + 000 ... 0y7 ... y0) =

216 (x15 ... x8) (y15 ... y8) + 28 (x15 ... x8) (y7 ... y0) + 28 (x7 ... x0) (y15 ... y8)

+ (x7 ... x0) * (y7 ... y0)

Thus, the work is decomposed into simple

8-bit factors. These pieces are 8-bit

Physics of computers 2011

operands are calculated by the L.A. Zolotorevich tabular method, and then

Features of subtraction of binary-decimal numbers.

Similar to the binary subtraction operations, the X-Y operation can be represented as X + (-Y). In this case, a negative number is represented in two's complement code, similar to the two's complement code in binary arithmetic. This code is only used to perform subtraction operations.

The algorithm for performing the operation is as follows:

1) The absolute value of a positive number is represented in direct BCD (8421).

The modulus of a negative number is in the complementary code (DC) with an excess of 6.

To obtain a DC you must:

- invert the values ​​of the digits of all the number notebooks;

- add 1 to the least significant digit of the lower tetrad.

Thus, the chain PC (mod) OK OK + 1 DC is similar to the chain in binary arithmetic. Only here we get a DK with an excess of 6, tk. the addition goes not to 10, but to 16.

2) Add the operands (X) in the PC and (Y) in the DC.

3) If during the addition of the tetrads there is a transfer from the senior tetrad, then it is discarded, and the "+" sign is assigned to the result. the result is obtained in direct redundant code. He

is adjusted according to the same rules as when adding modules.

Physics of computers 2011

L.A. Zolotorevich

Binary arithmetic (continued)

Features of subtraction of binary-decimal numbers (prdlzh).

4) If, when adding the notebooks, there is no transfer from

of the senior tetrad, the result is assigned the "-" sign, i.e.

the result is obtained in a redundant DC. In this case, it is necessary

go to redundant PC (i.e. invert all binary

digits of binary-decimal number and add to the least significant

category 1).

5) The result obtained in this case is corrected in the PC.

For this, to those tetrads from which the transfer arose at

fulfillment of paragraph 2 (when summing up) it is necessary to add

We represent | Y | in the recreation center in abundance

Let's do the addition:

The absence of transfer from the senior tetrad is a sign that the result was obtained in DC (i.e., negative). Let's move on to the uncorrected redundant PC.

Physics of computers 2011 L.A. Zolotorevich

Informatics lesson in grade 8 “Binary number system. Binary arithmetic "

Teacher: Zaitseva Galina Georgievna

MOU-SOSH village Raskatovo


Test

1. The number system is ...

1) a sign system in which certain rules for writing numbers are adopted.

2) a set of signs.

3) a set of rules for writing numbers.


2. Continue the sentence: "There are the following number systems: ...".

1) algorithmic, unary and non-positional.

2) unary, non-positional and positional.

3) non-positional and positional.


3. Positional number system is ...

1) a number system in which the quantitative equivalent of a digit does not depend on its position in the number record.

2) number system with base 10.

3) a number system, in which the quantitative equivalent of a digit depends on its position in the number record.


4. A non-positional number system is ...

1) a number system in which the quantitative equivalent of a digit depends on its position in the number record.

3) a number system in which the quantitative equivalent of a digit in a number does not depend on its position in the number record.


5. State the correct statements.

1) The alphabet of the number system is a collection of numbers.

2) The unary number system is the oldest and simplest number system.

3) Nodal numbers are obtained as a result of any operations from algorithmic numbers.

4) Numbers are signs with which numbers are written.

5) Algorithmic numbers are obtained as a result of any operations from the node numbers.


Self-test:



Lesson Objectives:

Discover

O representation of numerical information in a binary number system.

Learn to:

perform arithmetic operations in binary


Binary number system is a positional number system with base 2.

Binary number system alphabet:

101101011 2

Subscript is a number that indicates the base of the system.


Rule for converting decimal integers to binary

To convert an integer decimal number to a binary number system, you need to sequentially divide this number and the resulting integer quotients by 2 until you get a quotient equal to zero. The original number in the binary number system is composed by sequential recording of the resulting residues, starting with the last one.


Compact design

363 10 = 101101011 2


11 2 10 5 2 1 4 2 2 1 2 1 0


Do it yourself:

Examination:


Learn about binary arithmetic

In any positional system, arithmetic operations are performed. They boil down to the use of all possible variants of addition and multiplication of single-digit binary numbers.

Addition table

Multiplication table


Do with the teacher:

RT No. 55 (1,2), 56 (1, 2)

Check:


Homework:

§ 1.1.2, 1.1.6

55(3), 56(3)


Used materials:

Bosova L.L .. Informatics grade 8, 2015.

Bosova L.L. Informatics grade 8. FSES. Electronic supplement to the textbook.

Unified collection of digital educational resources http://school-collection.edu.ru/ (128618, 128634)

, Competition "Presentation for the lesson"

Lesson presentations

Back forward

Attention! Slide previews are for informational purposes only and may not represent all the presentation options. If you are interested in this work, please download the full version.









Back forward

The purpose of the lesson: Form the skills of performing arithmetic operations with binary numbers.

Lesson Objectives:

  • Introduce the rules for performing arithmetic operations (addition, multiplication, subtraction, division) in the binary number system, exercise in applying the knowledge gained in practice.
  • To instill the skills of independence in work, to educate accuracy.
  • Form interest in the subject, self-control skills.

Equipment: interactive whiteboard, projector, presentations: "Sea battle", "Binary arithmetic", spreadsheets for practical work and reflection.

Lesson plan:

  1. Organizing time.
  2. Lesson motivation: setting the goal of the lesson.
  3. Repetition of previously studied material. Presentation "Sea Battle". (Presentation 1)
  4. Learning new material. Presentation "Binary Arithmetic". (Presentation 2)
  5. Consolidation of the studied material. Binary arithmetic spreadsheet. (Annex 1 )
  6. Lesson summary. Reflection. ( Appendix 2 )
  7. Homework.

During the classes

I. Organizational moment.

II. Lesson motivation: setting the goal of the lesson.

III. Repetition of previously studied material. Presentation "Sea Battle".

To check how you learned the material from the previous lesson, let's play "Sea Battle" ... (The game can be conducted using individual or frontal forms of work. For individual work, you must copy the presentation to the students' computers in advance; for frontal work, you must use an interactive whiteboard).

For a question to appear on the screen, click on the corresponding number on the steering wheel. To answer, click on the corresponding cell of the playing field.

In individual work, the result can be assessed as follows:

"5" - 5 boats,
"4" - 5 boats, 1 "past" (orange square)
"3" - 5 boats, 2 "past" (orange squares)

IV. Learning new material. Presentation "Binary Arithmetic".

(Slide 1)

In order to better master the binary number system, it is necessary to master the performance of arithmetic operations on binary numbers.

All positional number systems are "the same", namely, in all of them arithmetic operations are performed according to the same rules:

  • the rules of addition, subtraction, multiplication and division by a column are true;
  • the rules for performing arithmetic operations are based on the addition and multiplication tables.

(Slide 2-3)

Consider the rules for adding binary numbers.

(Slide 4-5)

Consider the rules for multiplying binary numbers.

(Slide 6-7)

Consider the rules for subtracting binary numbers.

(Slide 8)

Consider the rules for dividing binary numbers.

V. Consolidation of the studied material.

Let's move on to doing practical work.

The assignment for practical work is indicated in the Binary Arithmetic spreadsheet. Students perform arithmetic operations in writing in a notebook and enter the result into a table. Conditional formatting has been applied to the table. If the result is correct, the color of the numbers changes; if the result is incorrect, the color of the numbers remains black. Thus, students can immediately complete the work on the errors.

"5" – 11- 12 correct answers,
"4" – 8- 10 correct answers,
"3" – 5- 7 correct answers.

Vi. Summarizing. Reflection.