Condition Code

From Mill Computing Wiki
Revision as of 06:51, 14 December 2014 by Jan (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A byproduct of many value producing operations is that you get certain properties of the result value for free.

In traditional architecture those status flags are kept in the a global status register, and each operation that produces status flags replaces the previous value.
This approach has two major drawbacks:

For one those bits are only rarely needed, yet they are part of the thread and process space and always need to be preserved, just in case.
And then of course you are limited to the most recently produced status flags.

The Mill takes a different approach. There is no global status flag register. A lot of operations still produce these flags as condition codes, but usually they get immediately discarded. Only when the program actually needs one or more of these condition codes, as determined by the compiler, they get explicitly extracted into a belt register with a dedicated operation, which is ganged with the actual value and condition code producing operation. And from the belt other operations can make use of it like normal arguments.

The condition codes, and their respective extracting operation names are:

  1. carry - for unsigned integer this is also the overflow
  2. overflow
  3. fault - when a NaR is produced
  4. eql
  5. neq
  6. gtr
  7. geq
  8. lss
  9. leq

The condition codes are generated and are available for extraction no matter what the overflow behavior of the operation itself is. Even modulo wraparound operations produce overflow and carry codes.