Status Flags
In the lecture, it was shown that a bit pattern can be interpreted either as an unsigned integer or a signed integer. Depending on the interpretation, addition/subtraction can result in overflow. To detect overflows, the following status flags should be used:
-
CF (Carry Flag): Value is 0 when there is no overflow as an unsigned integer, otherwise 1.
-
OF (Overflow Flag): Value is 0 when there is no overflow as a signed integer, otherwise 1.
Additionally, the following flags are important:
-
ZF (Zero Flag): Has a value of 1 if s contains only zero entries, otherwise 0.
-
SF (Sign Flag): Value corresponds to the Most-Significant-Bit of s.
Create a module in CircuitVerse named “Status Flags” that determines these flags based on a, b, s, Cout, and add/sub. This component can then be represented as follows, along with the adder:
