All books

Professional

Apps About Coach Log in Start reading

Computer Science · Glossary

What is Flag?

Also known as: flag (status flag)

Definition 12.6 High School Computer Science · Chapter 12 — From Gates to an Arithmetic Unit

A flag is a bit that an operation sets to describe its result, for the instructions that follow to test. The toy machine of Book 1 has three: ZZ is 11 when the result is 00; NN is the last bit of the result, 11 when it is negative in two’s complement; CC is the carry out of an addition, and for a subtraction, 11 when it needed a borrow; logic operations set CC to 00.

The usual drawing of an ALU: two numbers enter at the top, the result leaves at the bottom, the operation code comes from the side, and the flags leave on the other side.
The usual drawing of an ALU: two numbers enter at the top, the result leaves at the bottom, the operation code comes from the side, and the flags leave on the other side.
Read in context →