From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fdd80,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: ffc31,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: 1164f8,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Attributes: gide311f70d09,gidf4c4f7386e,gidd180ab3bd8,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.135.231 with SMTP id pv7mr3700113pbb.8.1328879587679; Fri, 10 Feb 2012 05:13:07 -0800 (PST) Path: wr5ni8683pbc.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: paramucho@hotmail.com (paramucho) Newsgroups: alt.sys.pdp11,vmsnet.pdp-11,comp.sys.dec Subject: Re: PDP11 Values from MFPT Date: Fri, 10 Feb 2012 13:12:56 GMT Organization: Aioe.org NNTP Server Message-ID: <4f360d68.39000374@nntp.aioe.org> References: <4f2e5f77.65538828@nntp.aioe.org> <4f2e89be.49241029@nntp.aioe.org> <4f30d0d8.41682905@nntp.aioe.org> <4f313229.43518694@nntp.aioe.org> <4f37717c.29259157@nntp.aioe.org> <4f339e98.40806741@nntp.aioe.org> Reply-To: paramucho@hotmail.com NNTP-Posting-Host: CmgvwL3sOlojnxUjt8znzA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 1.5/32.451 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Wed, 08 Feb 2012 23:29:52 +0100, Johnny Billquist wrote: >>>>>> As you can see E11 doesn't increment R0 and leaves SR1 null. >>> >>> So E11 does not behave like the J11, even when asked to, in this case. >>> But it does work correctly according to the architecture. >> >> Let's not go back to the "architecture" debate...we're never gonna >> agree. I've avoided the issue below with the terms "correct", >> "different" and "wrong". > >Heh. Well, you can perhaps at least agree that according to the >perceived function of MMR1, E11s behavior is consistent with the idea of >how MMR1 is used, and any code written that use MMR1 will turn out the >correct result both with the E11 implementation as well as the J11 >implementation, even though they behave differently in their >implementation of it. > >There, now you don't have to take the word "architecture" in your mouth. Oh well, if you really want to go back there... The piano-style keyboard was one of the early illustrative models for the computer "architecture" (probably in THE MYTHICAL MAN MONTH). The idea is that sheet music played on any (musical) keyboard will sound the same, apart from timbre,, whether it's actually a piano, organ, harpsichord etc. The analogy was sheet music=software, "keyboard"=architecture, and implementations were "piano", "organ" etc. What the IBM 360 and the PDP-11 were trying to avoid was the earlier approach where every change in the underlying technology led to a completely new machine with a new architecture. Software had to be rewritten, etc, etc. Now, the problem for the PDP-11 was that it remained sensitive to technology changes and frequently had to modify the architecture because of the available technology. To use the earlier analogy of the piano, sheet music played on the various PDP-11s would sound different without changes to the sheet music. I'll take that analogy a bit further. While all keyboards have the same "architectural principles" there are some that have architectural differences. On some (early) keyboards the 12 notes of the lowest octave are not tuned chromatically but rather diatonically (to extend the bass range). In the renaissance a few keyboards had two black keys between the white keys (to handle different tuning systems). Now, these are "architectural differences", not "implementation differences" because they require changes to be made to the "sheet music". With these kinds of changes it becomes necessary to think of the "keyboard" as a "base architecture" with different "model architectures". The reason you must do this is because an "implementation" is always the expression of an "architecture". Changes such as removing odd address traps, address traps in general, EAE vs EIS, FIS vs FPU and the like are "architectural differences" not implementational differences, because they require alterations to the "software". Of course, there is a little bit of room to manouevre between implementations of the architecture. But the latitude for these "differences" must also be specified by the architecture. In the case of the PDP-11 these "differences" were technology- or design-driven, on a per-model basis, and thus it became necessary to restate the architecture for each model. The "PDP-11 Architecture Handbook" you mention was a largely retrospective document rather than the working definition of the architecture that generated the models. The working descriptions of the "architecture" are documents such as that I've cited, e.g. EK-KDJ1E-UG-001_KDJ11-E_CPU_Module_Users_Guide_Jan91 at bitsavers. The VAX was much more like a "real architecture". There were differences between VAXen but nothing like that seen on the PDP-11. The VAX was released with a strong, definitive architectual description. That document wasn't abstract or aspirational: it specified the software machine. To say that the "PDP-11 Architecture Handbook" was the working architecture for the PDP-11 reduces "architecture" to an aspirational goal. An architecture needs to provide the working description of an implementation. With the PDP-11 they had to fudge. The PDP-11 sits half-way between the pre-architectural and the full-architectural generations. The problem, for me, with your definition of "implementation" is that for a given model there is no complete specific architectural description available that precedes the model. That's why I treat the documents, such as the document cited above, as the technical descriptions. As noted, that document begins with a chapter on the architecture". When Bob Supnik chooses a particular interpretation of a particular document as the basis of his SR1 code he's not working within the specifications of a precisely defined (or precisely "undefined") architecture but rather picking one of the many alternatives of a poorly and only partially stated base architecture. We're doing the same here: trying to work out what the architecture is because it's not precisely stated anywhere in general terms. And the website http://pdp2011.sytse.net/wordpress/, cited by another current thread, also has references to SR1 and its multiple interpretations) In other words, for the PDP-11 the line between "architecture" and "implementation" is frequently blurred and frequently just a fiction. >>>> SimH gets this wrong: >>>> >>>> J11: >>>> Test06: mov (pc)+,*(r0)+ >>>> Before: R0=120000 SP=744 PC=4166 >>>> After: R0=120002 SP=744 Err=1 SR0=100013 SR1=[0|20] SR2=4166 >>>> **** >>> >>> J11 would appear to work differently than the 11/44 or 11/70. What is >>> the saved PC on the stack at this point? Has it been updated or not? >> >> The PC on the stack is always updated. At present my test program >> would crash if it wasn't. That's what I need to change to test RTI >> etc. > >Is the PC on the stack updated by two, or by four? That is the question. >It should always at least have been updated by two, since the >instruction fetch have always taken place. And that update is not ever >reflected in MMR1. However, the additional two, from the (PC)+, should >be recorded in MMR1, if the PC on the stack has been incremented by 4. It's incremented by four. If it wasn't my progam would crash. The PC itself is always incremented by the full and correct amount in these tests, except for those which test RTI etc. >>>> This J11 behavior may well be undocumented. There's no guarantee that >>>> this behavior is the same with earlier FPU implementations. We'd need >>>> an 11/45, and 11/40, an 11/34 etc to test that. >> >> I found the following comment in the SimH sources tonight: >> >> According to the PDP-11 Architecture Handbook, MMR1 records all >> autoincrement and autodecrement operations, including those which >> explicitly reference the PC. For the J-11, this is only true for >> autodecrement operands, autodecrement deferred operands, and >> autoincrement destination operands that involve a write to memory. > >Wow, the J11 is rather more tricky. Interesting. It can partially back >out of these things then. >The reference is the same I read about in the Processor Handbook. > >The comment is helpful, since obviously Bob have checked this then (come >to think of it, wasn't he even involved in the J11 microcode >development, or was it just the FPA microcode development?). Anyway, he >possibly knows a lot about the internals of the J11. > >> The simulator follows the Handbook, for simplicity. >> >> The document he's referencing is here (and I think I used to have a >> copy of it): >> >> http://www.vaxcluster.de/mambo/index.php?option=displaypage&Itemid=224&op=incl&SubMenu=&slideshow=16&directory=dec_manuals > >Yes. That is the handbook that I referred to a few posts ago as well. >It's really a better source for how a PDP-11 should work (I won't call >it the architecture, since you object so much). But it leaves a lot up >to specific implementations on how to do things. Like the handling of >MMR1 in respect to backing out of changes. Which J11 takes advantage of. >Simh consiously chose to not fully simulate the J11 here. > >That handbook is, by the way, just the last incarnation of the PDP-11 >Processor Handbook. Unfortunately I don't have my copy where I'm sitting >(living). But if I remember right, it covers the T11, F11 and J11. >Possibly also the LSI11. It also touches on the 11/44, and I think the >11/34 and the 11/70 with friends. But most of the book is not about >specific implementations, but about the PDP-11 as such. But as I've said above, it's an often retrospective document. Architectures are not retrospective, they are working specifications of new implementations. The point I'm making about the PDP-11 is that it didn't stick to the architecture (unless you reduce the term "architecture" to something very fuzzy, almost aspirational). >> So, Bob Supnik is stating here that he's not slavishly following the >> J11, so I'll just mark it "different" for the moment. > >Right. > >>> Definitely. Also, it would be interesting to see if J11 behaves the same >>> with and without the FPA. >>> I can (eventually) set up to test this on a real 11/70. >> >> It would be great to see if the older implementations actually do >> update PC and/or FPU instructions. What system runs on the 11/70...let >> me guess :-) > >:-) > >I'll need to start by just writing a small program that runs under RSX >and that presents me with the information. Once I have that up and >running, I can use it on all machines I have. I'll send you my code, although it won't help much. My C code is actually in a pre-processor language and the MACRO code is not stand-alone. But at least it will synch our efforts. >>>> +++++++++++++++++++++++++ >>>> Summary: >>>> >>>> It's all a bit higgledy-piggledy above, so I'll summarise, using the >>>> J11 behavior as the benchmark, where: >>>> >>>> "Correct" means the same as the J11 >>>> >>>> "Different" means not the same, but still functional. >>>> You may willing to accept these. I'm less so inclined. >>>> >>>> "Wrong" means a real bug (marked with ****). >>>> >>>> 1. Base and EIS instruction sets. >>>> SimH: Correct on all, except, >>>> **** Wrong for (PC) inc/dec's which should be ignored >>>> (because instruction restarts). >> Correction: >> Different for (PC) incs/decs (see source comment above) >>> >>> I'm not it should be classified as a bug. It depends on what the PC >>> pushed on the stack looks like. It might be fully correct, but not the >>> same as J11 (see other comments about this above). >> >> The comment from the source, shown above, shows he's being generic >> rather than specific to the J11. > >Right. But unless Simh then also have pushed the "correct" PC on the >stack, Simh could have a bug here, or just be different. You cannot just >mess around with MMR1 without also making sure that the registers as >such have the correct values, with respect to MMR1 and state before the >trap. But that's exactly what the note from his source above says. The idea is that the machine provides updates for R7=PC but that the updating software ignores them. Note, the update information, when present, is provided only for data references, not for PC instructions. I guess the idea was that the software would be able to determine which operand was at fault. >>>> o I still need to do some tests with RTS Rn and RTI. A slight >>>> redesign of the utility is required for that. >>> >>> RTI? I could see potential for RTS as well as JSR, if the SP points to >>> invalid memory. But RTI... Hmm... Am I thinking wrong here. But that >>> could only come from a broken kernel SP, and a trap will then become a >>> double trap, since you can't trap for the error without a stack. >>> Or what am I missing? (Too tired to think more...) >> >> I was thinking of an RTI on a good stack but where the popped PC/PSW >> in fact point to unmapped memory. That would be quite common when the >> kernel returns to user mode. The MMU trap will occur on the kernel >> stack...but that trap should overwrite the popped PC/PSW... > >Um. The MMU will (as always) push the information on the kernel stack, >but it should not be any different from if your code just happens to run >off memory into non-existent memory in a straight program flow. > >The RTI should not make any difference here, as far as I can tell. The >instruction fetch will trap. The updated PC should be pushed on the >kernel stack, and MMR1 should be 0. > >Of course the old PC,PSW will be overwritten by the new. The old were >popped off the stack, and the data is dead. Then new data is pushed on >to the stack. TEST15: You're correct, and there are three identical results. Isn't it nice. J11: SIMH: E11: Test15: *rti Before: R0=100004 SP=740 PC=6612 After: R0=100004 SP=744 Err=0 SR0=100011 SR1=[0|0] SR2=100004 TEST16: However, leading on from that starting point I looked at an RTI in user mode. The user mode stack maps the RTI PC but not the PSW. The trap is taken in kernel mode of course, so the user mode stack is not overwritten. In this R0 records the user mode SP. SimH has a backed-out result and an unaltered user mode stack. The J11 upates SR1 and shows the double pop in the user mode stack. SimH: Test16: *rti ; [pc,*ps] r0 = user mode stack (unmapped) Before: R0=77776 SP=744 PC=7174 After: R0=77776 SP=744 Err=0 SR0=100151 SR1=[0|0] SR2=7174 J11: Test16: *rti ; [pc,*ps] r0 = user mode stack (unmapped) Before: R0=77776 SP=744 PC=7174 After: R0=100002 SP=744 Err=0 SR0=100151 SR1=[26|26] SR2=7174 E11 gets it wrong. The stack is double-popped and, of course, there is no update information. E11 Test16: *rti ; [pc,*ps] r0 = user mode stack (unmapped) Before: R0=77776 SP=744 PC=7174 After: R0=100002 SP=744 Err=0 SR0=100151 SR1=[0|0] SR2=7174 TEST17: This is pretty much the same test as TEST16 using RETURN (RTS PC). The results are analogous to the previous test: SimH: Test17: *return ; [*pc] r0 = user mode stack (unmapped) Before: R0=100000 SP=744 PC=7562 After: R0=100000 SP=744 Err=0 SR0=100151 SR1=[0|0] SR2=7562 J11: Test17: *return ; [*pc] r0 = user mode stack (unmapped) Before: R0=100000 SP=744 PC=7562 After: R0=100002 SP=744 Err=0 SR0=100151 SR1=[0|26] SR2=7562 E11: Test17: *rti ; [*pc] r0 = user mode stack (unmapped) Before: R0=100000 SP=744 PC=7562 SR0=1 After: R0=100000 SP=744 Err=0 SR0=100151 SR1=[0|0] SR2=7562 Now, in the earlier tests we've been blithely talking about E11 as backing-out SR1. But I think what we're seeing is just John's software realization of the PDP-11 with no particular thought of SR1. In that context the earlier MFPI problem and the issue in these two tests are not so much errors as a lack of SR1 implementation. Ian