[libre-riscv-dev] div/mod algorithm written in python
programmerjake at gmail.com
Sat Jul 20 08:21:13 BST 2019
On Fri, Jul 19, 2019, 23:49 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
> On Sat, Jul 20, 2019 at 6:55 AM Jacob Lifshay <programmerjake at gmail.com>
> > On Fri, Jul 19, 2019, 22:47 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
> > wrote:
> > > how you getting on btw? (and kazan?)
> > >
> > going somewhat slow. I ended up taking a day or two writing an algebraic
> > number library (https://github.com/programmerjake/algebraics) for later
> > in verifying that the different operations round correctly (it can
> > represent the roots of any polynomial with rational coefficients, which
> > includes sqrt and rsqrt), but got bogged down in algorithms to factor
> > polynomials.
> sounds neat - do keep focussed, though.
btw, do you know any good online references for understanding what
a Gröbner basis is? it's used to factor polynomials.
once the factoring algorithm is implemented, the rest (algebraic number
add/sub/mul/div/rational-powers/floor/ceil/comparison) should be quite
easy, that way we can write the ieee 754 rounding function once and it will
work correctly for all the hw fp operations (assuming we don't implement
exp/log or trig functions, though sinpi/cospi/tanpi will work since
rational inputs give algebraic outputs), allowing easier systematic testing.
> btw is the div core in a position where it could be plugged in to the
> FPDIV "stub" code?
yeah, I am in the middle of building the fp/int interface. the int div/rem
should be quite easy, just copy the corresponding test. for divu/remu, you
can just copy the inputs and outputs directly (with shifting to account for
differing numbers of fractional bits -- see test). fp will be a little
> > I haven't made additional progress on kazan.
> takes a lot to switch context/focus, doesn't it? particularly on
> complex topics. i'm trying to keep the 6600-style memory work "in
> mind" every couple of days, to keep it in "electrical neural memory",
> so that when i come back to it after doing the FCVT etc. i don't feel
> completely lost.
the part I was in the middle of in kazan needs to have an additional IR
added -- meaning that part's going to be rewritten, so not being able to
easily remember won't be much of a problem.
More information about the libre-riscv-dev