Commit 6485cd7d authored by Connor Abbott's avatar Connor Abbott
Browse files

bifrost: Mention restriction on constant quadword format

parent 5de44993
......@@ -267,6 +267,8 @@ The `pos` bits describe where in the instruction stream the constants are. In pa
There is a trivial limit for the number of constants per clause: since each instruction can only load one (64-bit) constant, there can be at most as many constants as instructions. It seems that the blob compiler currently refuses to add more than 5 constants to an 8-instruction clause, although it's happy to use at least 6 constants for a 7-quadword clause. Beyond that, the limit isn't known. However, there are only two remaining values for `pos` that haven't been observed (e and f), so there isn't much space left for more constants.
There is a weird restriction on the contents of the constants: when interpreted as an unsigned integer, the most-significant 4 bits of the first constant (bits 64-67 of the quadword) must be less than or equal to the most-significant 4 bits of the second constant (bits 124-127 of the quadword). If this doesn't hold, the constants need to be swapped. Experiments have shown that violating this leads to some of the bits being replaced with random values.
== Algorithm for packing clauses
This section describes how the blob compiler seems to use these formats to pack as many instructions and constants into as few words as possible. There may be other equivalent ways to do it, but given how complicated all the different formats are, and that the hardware decoder and encoding algorithm were most likely developed in tandem, it's probably best to stick with what the blob does.
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