Bug 786

Summary: Implement gfp* instructions for GF(p) instructions
Product: Libre-SOC's second ASIC Reporter: Jacob Lifshay <programmerjake>
Component: source codeAssignee: Jacob Lifshay <programmerjake>
Status: RESOLVED WONTFIX    
Severity: enhancement CC: libre-soc-bugs, lkcl, programmerjake
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Linux   
NLnet milestone: NLnet.2021.02A.052.CryptoRouter total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0 parent task for budget allocation: 782
child tasks for budget allocation: The table of payments (in EUR) for this task; TOML format:
Bug Depends on: 787    
Bug Blocks: 782    

Description Jacob Lifshay 2022-03-21 03:15:37 GMT
First: TODO: decide if we want to implement these.

TODO: decide if we want to limit ourselves to GF(p) for prime p or change these instructions to work for all modular arithmetic (modulus isn't required to be prime). If we want the instructions to work for all modular arithmetic, then they should probably be named mod* rather than gfp*.

Instructions:
* gfpadd, gfpsub
* gfpmul
* gfpinv (decide what div by 0 does -- decide what non-invertable inputs do (only happens for composite moduli))
* gcd (maybe -- other output of gfpinv's algorithm, we have the hardware, why not use it?)
* gfpmadd, gfpmsub, gfpmsubr (sub reversed)
* gfpmaddsubr (for fft)

Steps (edit as needed):
* TODO: Instruction Encodings
* basic adaptable modules (probably in nmigen-gf)
  * TODO: module in nmigen-gf
  * TODO: unit test
  * TODO: formal
* TODO: add encoding of gfp* to SVP64Asm class (as a 32bit op)
* TODO: add gfp* to TBD pipe(s)
* TODO: fu unit tests
* TODO: fu formal