Lably
Skip to content

Status register

CPU register containing flags

  • 4 min read
  • 3 chapters

Related on Lably

Through Arithmetic logic unit

The status register contains information about the state of the processor. Individual bits are implicitly or explicitly read or written by the machine code instructions executing on the processor. The status register lets an instruction take action contingent on the outcome of a previous instruction.

Typically, some of the flags in a status register are modified as a result of arithmetic and bit manipulation operations performed by the arithmetic logic unit (ALU). For example, a Z status bit may be set if the result of an operation is zero or cleared if it is nonzero. A string instruction may modify a status flag to indicate whether it terminated due to finding a match or reaching the end of the string. Some flags are used later by conditional instructions to control program execution.

Some instruction set architectures (ISAs) do not use a dedicated flag register, such as the MIPS and Alpha; others do not implicitly set or read flags. Such machines either do not pass implicit status information between instructions or pass it in a general purpose register.

A status register may have additional fields such as privilege flags, interrupt enable bits, and other types of information. During an interrupt, the status of the currently executing thread can be preserved by storing the current value of the status register (along with the program counter and other active registers) to the machine stack or other memory.

Common flags

Here is a list of CPU status register flags commonly implemented in modern processors:

Sign in to keep reading

2 more chapters are free with a Lably account.

More in Computing and communication