Expand description
§Chronal Classification
There are only 16 opcodes so we can use bitwise logic to efficiently perform the set operations that uniquely determine the mapping of each opcode to instruction.
First we create a bitmask for each instruction block in the first half of the input
with a 1
for each potential instruction. For example:
Before: [3, 2, 1, 1]
9 2 1 2
After: [3, 2, 2, 1]
Possible instructions: mulr, addi, seti
Binary Mask: 0000001000000110
For part one the count_ones
intrinsic computes the size of each set.
For part two we need to determine the mapping of the unknown codes. First we reduce each unknown to a single set by taking the intersection of all examples. Then similar to solving simultaneous equation, we eliminate one unknown at a time, removing it from the other possibilities. This causes a domino effect, continuing until all unknowns are resolved.
Structs§
Functions§
- cpu 🔒