What Is a Status Register?
The status register, also known as the condition code register, is a core component of the computer system-a part of the operator. The status register is used to store two types of information: one is the various status information (condition code) that reflects the current instruction execution result, such as Carry (CF bit), overflow (OF bit), positive or negative result (SF bit), whether the result is zero (ZF bit), parity flag bit (P bit), etc .; the other is to store control information ( PSW: program status word register), such as enable interrupt (IF bit), trace flag (TF bit), etc. In some machines, the PSW is called a flag register (FR).
Status register
- This entry lacks an overview map . Supplementing related content makes the entry more complete and can be upgraded quickly. Come on!
- The status register, also known as the condition code register, is the core component of a computer system-
PSW Definition of status register PSW flag:
- PSW is an 8-bit binary register used to store the status of the CPU after the instruction is received. It is usually filled by the CPU, but the user can also change the value of each status bit. The definition of each flag is as follows:
- Bit7 Cy
- Bit6 AC
- Bit5 F0
- Bit4 RS1
- Bit3 RS0
- Bit2 OV
- Bit1-
- Bit0 P
ARM Program Status Register in ARM
- There are 6 status registers in ARM. The ARM7TDMI core contains 1 CPSR and 5 SPSRs for exception handlers. CPSR reflects the current state of the processor and includes:
- 4 condition code flags (negative (N), zero (Z), carry (C), and overflow (V));
- 2 interrupt disable bits, each controlling one type of interrupt;
- 5 bits encoding the current processor mode;
- 1 bit used to indicate the currently executing instruction (ARM or Thumb).
PSW Explanation of each flag bit in the status register PSW:
- 1. CY (Carry): Used to indicate carry in addition and borrow in subtraction. If there is carry in addition or borrow in subtraction, the CY bit is 1, otherwise it is 0.
- 2. AC (Auxiliary Carry): Basically the same as CY, except the operation between the lower 4 bits and higher 4 bits.
- 3.F0 (Flag Zero user flag bit): This bit is a flag bit set by the user according to his own needs. The user can set the bit to determine the flow and branch of the program.
- 4. RS1, RS0: 8051 has 8 8-bit working registers R0 ~ R7. Its actual physical geography in RAM can be selected and determined as needed. 00: 00H ~ 07H
- 01: 08H ~ 0FH
- 10: 10H ~ 17H
- 11: 18H ~ 1FH
- 5.OV: Indicates whether an overflow occurred during the operation. If the result exceeds the range of data that can be represented by an 8-bit binary number, that is, a signed number -128 ~ + 127, the flag bit is set to 1.
- 6.OP: The parity flag bit is used to indicate the parity of the number of 1 in the operation result. If P = 0, the number of 1 in accumulator A is even; if P = 1, the number of 1 in accumulator A is even. The number is odd.