[Simh] Ferranti Pegasus Simulator
Dave Wade
dave.g4ugm at gmail.com
Sat Jun 11 05:05:00 EDT 2016
Thanks for all the replies, I really had a mental block over this and no amount of reading the Wikipedia articles helped at all..
Just to mention a couple of things. I started on this a long time ago, which is why it isn't SIMH. I guess one day I will re-visit doing it in SIMH.
Bob's point about "was it an exact algorithm" prompted me to read the Pegasus Maintenance Manuals, which are on Bitsavers here:-
ftp://bitsavers.informatik.uni-stuttgart.de/pdf/ferranti/pegasus/Pegasus_Maint_Vol2_May56.pdf
which I now find describes in great detail the repeated subtraction process in great detail. It is an exact algorithm and its very similar to the one below, so I think I am now good to go.
(any one else reading this a "Staticisor" is basically a latch or register)
If you want to see how I progress I will be recording progress on my "hackaday.io" projects page.
https://hackaday.io/projects/hacker/99268
Dave
G4GM
> -----Original Message-----
> From: Simh [mailto:simh-bounces at trailing-edge.com] On Behalf Of Bob Supnik
> Sent: 11 June 2016 02:53
> To: simh at trailing-edge.com
> Subject: Re: [Simh] Ferranti Pegasus Simulator
>
> There are any number of strange-length divide algorithms in SimH. Here is the
> PDP-10 code for dividing a 70b unsigned integer by a 35b
> (unsigned) integer.
>
> // dvd[0:1] = 70b dividend, high order first (35b in each word) // dvr = 35b
> divisor // rs[0:1] = quotient remainder // all variables (except i) are unsigned
> 64b
>
> for (i = 0, rs[0] = 0; i < 35; i++) { /* 35 quotient
> bits */
> dvd[0] = (dvd[0] << 1) | ((dvd[1] >> 34) & 1);
> dvd[1] = (dvd[1] << 1) & MMASK; /* shift
> dividend and mask */
> rs[0] = rs[0] << 1; /* shift
> quotient */
> if (dvd[0] >= dvr) { /* subtract
> work? */
> dvd[0] = dvd[0] - dvr; /* quo bit is 1 */
> rs[0] = rs[0] + 1;
> }
> }
> rs[1] = dvd[0]; /* store
> remainder */
>
> It's easy enough to see how to expand this to a computer with 39b in each word
> of dvd - just increase the loop count from 35 to 39, increase the shift count in
> the second line from 34 to 38, and define MMASK to be
> 39 bits of 1s.
>
> In general, it's simplest to implement this sort of multi-precision divide
> unsigned. Simply calculate the sign of the quotient and dividend before starting
> (quo sign = dividend sign XOR divisor sign; rem sign = dividend sign), then take
> the absolute value of dividend and divisor before running the bit-by-bit loop; fix
> up the signs of quotient and remainder when done.
>
> This assumes that the Ferranti did a precise divide. That's not necessarily the
> case. The IBM 7094 approximated double precision floating divide with a two
> term Taylor-series expansion...
>
> I hope the available Pegasus documentation provides sufficient detail on how
> divide was actually implemented.
>
> /Bob
>
> On 6/10/2016 8:15 PM, simh-request at trailing-edge.com wrote:
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Sat, 11 Jun 2016 00:46:02 +0100
> > From: "Dave Wade"<dave.g4ugm at gmail.com> To:<simh at trailing-
> edge.com>
> > Subject: [Simh] Ferranti Pegasus Simulator
> > Message-ID:<002401d1c372$3fc331e0$bf4995a0$@gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > 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 at trailing-edge.com
> http://mailman.trailing-edge.com/mailman/listinfo/simh
More information about the Simh
mailing list