Bug 122

Summary: FP software emulation needed,
Product: Libre-SOC's first SoC Reporter: Luke Kenneth Casson Leighton <lkcl>
Component: ALU (including IEEE754 16/32/64-bit FPU)Assignee: Luke Kenneth Casson Leighton <lkcl>
Status: RESOLVED FIXED    
Severity: enhancement CC: libre-soc-bugs, programmerjake
Priority: ---    
Version: unspecified   
Hardware: Other   
OS: Linux   
NLnet milestone: NLnet.2019.02.012 total budget (EUR) for completion of task and all subtasks: 1050
budget (EUR) for this task, excluding subtasks' budget: 0 parent task for budget allocation: 48
child tasks for budget allocation: 145 146 The table of payments (in EUR) for this task; TOML format:
Bug Depends on: 145, 146    
Bug Blocks: 48    

Description Luke Kenneth Casson Leighton 2019-07-28 22:09:54 BST
FP soft emulation needed that is RISCV compliant and includes RSQRT.
softfloat-3 does not include RSQRT.
FP64 RSQRT cannot be tested, FP16/32 can be however is not guaranteed accurate.
Comment 1 Jacob Lifshay 2019-07-28 23:20:32 BST
WIP algebraic numbers library at https://salsa.debian.org/Kazan-team/algebraics

-- represents values exactly
-- makes writing correctly rounded operations simple (as long as the operations don't produce transcendental numbers)
-- has a quadratic number type that works for implementing add, sub, mul, div, sqrt, rsqrt, fma
-- meant for testing since it's probably rather slow; still faster than python would be
-- will be writing python bindings using https://pyo3.rs/v0.7.0/ which makes writing bindings almost trivial
Comment 2 Jacob Lifshay 2019-07-30 16:16:58 BST
implemented comparison between quadratic numbers, working on addition.

My brain is fried for the day, had to derive quadratic_less_than:
https://salsa.debian.org/Kazan-team/algebraics/blob/190761b189d62870ffdb83639a9ff6ccae72f262/src/quadratic_numbers.rs#L602
Comment 3 Jacob Lifshay 2019-07-31 21:04:44 BST
(In reply to Jacob Lifshay from comment #2)
> implemented comparison between quadratic numbers, working on addition.
> 
> My brain is fried for the day, had to derive quadratic_less_than:
> https://salsa.debian.org/Kazan-team/algebraics/blob/
> 190761b189d62870ffdb83639a9ff6ccae72f262/src/quadratic_numbers.rs#L602

quadratic_less_than implements comparing two non-equal irrational quadratic numbers:
it returns lhs < rhs by using exact BigInt arithmetic and without using sqrt.

the full general less/equal/greater comparison is implemented in "impl Ord for RealQuadraticNumber"