Commit 51f37726 authored by Connor Abbott's avatar Connor Abbott
Browse files

bifrost: Describe register file bit-saving mechanism

parent c07e7d07
......@@ -320,6 +320,8 @@ The format of the register part of the instruction word is as follows:
Control is what ARM calls the "register access descriptor." To save bits, if the Control field is 0, then Port 1 is disabled, and the field for Port 1 instead contains the "real" Control field in the upper 4 bits. Bit 1 is set to 1 if Port 0 is disabled, and bit 0 is reused as the high bit of Port 0, allowing you to still access all 64 registers. If the Control field isn't 0, then both Port 0 and Port 1 are always enabled. In this way, the Control field only needs to describe how Port 2 and Port 3 are configured, except for the magic 0 value, reducing the number of bits required.
ARM has one additional trick to save a bit. Port 0 only has 5 bits, so it would seem that when Port 0 and Port 1 are in use, then both can't load a register greater than 31 at the same time. But it turns out that this isn't the case. The hardware compares the register numbers being loaded, and if Port 0 is greater than Port 1, it subtracts 63 from both numbers to get the real register. This lets software encode every possible combination of registers loaded in Port 0 and Port 1, possibly requiring it to swap Port 0 and Port 1.
Before we get to the actual format of the Control field, though, we need to describe one more subtlety. Each instruction's register field contains the writes for the previous instruction, but what about the writes of the last instruction in the clause? Clauses should be entirely self-contained, so we can't look at the first instruction in the next clause. The answer turns out to be that the first instruction in the clause contains the writes for the last instruction. There are a few extra values for the control field, marked "first instruction," which are only used for the first instruction of a clause. The reads are processed normally, but the writes are delayed until the very end of the clause, after the last instruction. The list of values for the control field is below:
......@@ -360,7 +362,7 @@ The uniform/const port also supports loading a few "special" 64-bit constants th
| Field value | Special constant
| 05 | Alpha-test data (used with ATEST)
| 06 | gl_FragCoord pointer
| 06 | gl_FragCoord sample position pointer
| 08-0f | Blend descriptors 0-7 (used with BLEND to indicate which output to blend with)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment