Or, here is an implementation of 128-bit division: Unsigned: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/ *udivmodti4*.c Signed: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/ *divti3*.c https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/*modti3*.c
Leo On Fri, Jun 10, 2016 at 5:22 PM, Leo Broukhis <l...@mailcom.com> wrote: > As a first step, you can try using https://gmplib.org/ > > Leo > > > On Sat, 11 Jun 2016 00:46:02 +0100, "Dave Wade" <dave.g4...@gmail.com> > wrote: > > >> Whilst its not a SIMH simulator, I hope you can help. I want to write an >> emulator for the Pegasus. The Ferranti Pegasus was (there are none >> operating >> at present) a strange beast with two 18-bit instructions per 39-bit word. >> Generally, it does 39-bit twos complement arithmetic. The multiply results >> in a 77-bit result which I have no problems implementing. >> >> Where I am struggling is with the divide. I need to be able to divide a >> 77-bit number by a 39-bit number and get a 39 bit quotient and a 39 bit >> remainder. As the compiler I am using only does 64-bit numbers this is >> proving challenging. Any one got a good article on how to do this? >> >> Dave Wade >> G4UGM >> >
_______________________________________________ Simh mailing list Simh@trailing-edge.com http://mailman.trailing-edge.com/mailman/listinfo/simh