Difference between revisions of "Condition Code"

From Mill Computing Wiki
Jump to: navigation, search
(Created page with "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...")
 
 
(One intermediate revision by the same user not shown)
Line 1:Line 1:
 
A byproduct of many value producing operations is that you get certain properties of the result value for free.
 
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.<br />
+
In traditional architectures those status flags are kept in a global status register, and each operation that produces status flags replaces the previous value.<br />
 
This approach has two major drawbacks:
 
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.<br />
 
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.<br />
And then of course you are limited to the most recently produced status flags.
+
And then of course you are limited to the most recently produced status flags.<br />
 +
Both means, as global changeable data usually does, a big obstacle to parallelism and speculative execution.
  
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 [[Ganging|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 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 the belt with a dedicated operation, which is [[Ganging|ganged]] with the actual value and condition code producing operation. And from the belt other operations can make use of it as normal arguments.
  
 
The condition codes, and their respective extracting operation names are:
 
The condition codes, and their respective extracting operation names are:
  
# [[Instruction_Set/carry|carry]] - for unsigned integer this is also the overflow
+
# [[Instruction_Set/carry|carry]]
 
# [[Instruction_Set/overflows|overflow]]
 
# [[Instruction_Set/overflows|overflow]]
# [[Instruction_Set/fault|fault]] - when a [[NaR]] is produced
+
# [[Instruction_Set/fault|fault]]
 
# [[Instruction_Set/eql|eql]]
 
# [[Instruction_Set/eql|eql]]
 
# [[Instruction_Set/neq|neq]]
 
# [[Instruction_Set/neq|neq]]

Latest revision as of 08:14, 16 December 2014

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

In traditional architectures those status flags are kept in 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.
Both means, as global changeable data usually does, a big obstacle to parallelism and speculative execution.

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 the belt 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 as normal arguments.

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

  1. carry
  2. overflow
  3. fault
  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.