-
Notifications
You must be signed in to change notification settings - Fork 8
Circuit back end
EACirc's circuit backend is fully customizable. Formelly, EACirc allowed also other backends, but now polynomials backend is developed on different GitHub repository Polynomial distinguishers
Each circuit is internally represented as an array of nodes with Boolean functions and arrays of their connectors.
Circuit dimensions are hardcoded, but they can be modified as template instantiation. Each layer is internally as long as the longest one.
TODO: describe the code.
Memory nodes are not supported in EACirc 4.
TODO: describe connectors
The function in node is specified by enum circuit::fn
. The remaining 3 bytes are inside-node arguments used if the node needs them (the left-most byte is argument 1, followed by arguments 2 and 3).
The following set of functions is used in circuits. Only a subset may be allowed for particular run, settings are located in the https://github.com/crocs-muni/eacirc/wiki/Configuration-file-(JSON).
-
NOP
- passes input from first connection uncganged, other connections are ignored
- default value (if no connections) is 0
-
CONS
- passes inside-node argument to output
- all input connections are ignored
-
AND, NAND
- all input connections are processed
- default value is 255
-
OR, XOR, NOR
- all input connections are processed
- default value is 0
-
NOT, SHIR, SHIL, ROTR, ROTL
- only the first input is processed, others are ignored
- bit-shifts and bit-rotations rotate by inside-node argument
- default value is 0
-
EQ, LT, GT, LEQ, GEQ
- compare first input to the second input
- other inputs are ignored
- false output (default) is 0, true output is 255
-
MASK
- bitselector based on the mask saved in inside-node argument
- processes first connection input only, others are ignored
- default value is 0
-
READ
- return byte from input layer with index [inside-node argument % sizeInputLayer]
- all input connections ae ignored