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.238.198 with SMTP id vm6mr4603852pbc.3.1328268257505; Fri, 03 Feb 2012 03:24:17 -0800 (PST) Path: lh20ni255590pbb.0!nntp.google.com!news1.google.com!goblin3!goblin.stu.neva.ru!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.Update.UU.SE!news.Update.UU.SE!not-for-mail From: Johnny Billquist Newsgroups: alt.sys.pdp11,vmsnet.pdp-11,comp.sys.dec Subject: Re: PDP11 Values from MFPT Date: Fri, 03 Feb 2012 12:24:15 +0100 Organization: Update Computer Club Message-ID: References: <4f12e49d$0$295$14726298@news.sunsite.dk> <4f175c07.15409279@nntp.aioe.org> <4f20c6e3$0$284$14726298@news.sunsite.dk> <4f215614.266356@nntp.aioe.org> <4f24a237$0$295$14726298@news.sunsite.dk> <4f2537ed.51306295@nntp.aioe.org> <4f28b73b$0$290$14726298@news.sunsite.dk> <4f291473.18988613@nntp.aioe.org> <4f2a3a1e.28631752@nntp.aioe.org> <4f2a8c5a.52418379@nntp.aioe.org> NNTP-Posting-Host: 74.125.122.49 Mime-Version: 1.0 X-Trace: Iltempo.Update.UU.SE 1328268256 1037 74.125.122.49 (3 Feb 2012 11:24:16 GMT) X-Complaints-To: newsmaster@Update.UU.SE NNTP-Posting-Date: Fri, 3 Feb 2012 11:24:16 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 In-Reply-To: <4f2a8c5a.52418379@nntp.aioe.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-02-02 14.31, paramucho wrote: > On Thu, 02 Feb 2012 01:14:39 +0100, Johnny Billquist > wrote: > >> On 2012-02-01 14:48, paramucho wrote: >>> On Wed, 01 Feb 2012 12:48:42 +0100, Johnny Billquist >>> wrote: > >>>>> The reason that it's not ideal is that it doesn't handle CPU >>>>> configurations that don't have memory management, e.g. LSI's and early >>>>> unmapped PDP-11s. I haven't tested it on all the different MMU >>>>> configurations either. >>>> >>>> I think a bigger reason that it's not ideal is that at least Bob Supnik >>>> have the explicitly stated goal that it should not work. Any current >>>> differences from the real machine are bugs, and are subject to be fixed >>>> at any time, at which point the test wont work anymore. >>> >>> That's not exactly what was stated. Without wishing to put words into >>> anyone's mouth, BobS wrote this: >>> >>> The model emulation in SimH is not perfect, which is why clever >>> software can detect it. But the intent is to mimic real systems. >>> SimH is not a "different" PDP11. >>> >>> And what I wrote earlier was this: >>> >>> The trick was to find some "undefined" behavior that didn't need >>> correction. The code above gets different results from an F11 and a >>> J11 as well as from SimH and E11. The test is far from ideal, but it >>> works well enough for my purposes. >>> >>> My point being, that I'm not sure that the behavior I'm using needs to >>> be "corrected" in the sense that I'm not sure it's actually "defined". >>> I'm not even sure that the behavior I'm using can be corrected without >>> a considerable effort. (One reason I'm not sure is that I wrote the >>> code years ago and I've forgotten whether the result values could be >>> computed or would need to be (at least partially) enumerated). >> >> We might read things in a different way. "Undefined" is, in this >> circumstance, as far as I can tell, only something that is valid as far >> as a general view of a PDP-11 is concerned. If you emulate a specific >> implementation, the behavior is not undefined. And Simh aims to >> implement the same twists as the machine it pretends to emulate. You >> have found a case where it does not behave the same way as the machine >> it claims to emulate. I'd say that this means Simh have a bug. >> >> Undefined generally only means that different implementations of a >> PDP-11 are free to do this as they see fit, and no program should depend >> on a specific behavior. >> However, a specific implementation will only do it one way or another. > > I have been using "undefined" in the architectural sense, that is, > behavior which is not specified by the *architecture* or explicitly > specified as "undefined". That's fairly well-known terminology. Excellent. So we are using it the same way. So when E11 is configured to simulate a J11, it is expected to do things the same way as a J11, and if you managed to find corner cases where it doesn't, then it is a bug in E11, since it is expected to behave the same as a J11. And the same for Simh. That is why all those options in the config exist - to make the emulator implement all the odd behavior of that specific implementation. E11 (or Simh) is not a generic PDP-11 implementation, but aims to emulate specific models, with all their quirks. > Clearly, there can be *no* undefined *implementation* behavior and > thus the distinction between "defined" and "undefined" is meaningless > if applied to the implementation. Right. > But to take your point that an emulation could avoid "undefined" > architecture states by referring to "unspecified implementation > behavior" I'd make two arguments. I'm not sure I made that point. I think my point was that the emulator don't have any "undefined" behavior. It claims to emulate a specific system/model, and thus it should (obviously) have the same quirks as the system it emulates. Your response that you are exploiting "undefined" behavior to find out what system it is, is, in my view, invalid for an emulator that aims to emulate another system. It should not be possible to tell the emulation apart from the system it emulates. Otherwise the emulation is buggy. So, any trick you figured out to detect that you are running under Simh is, by definition, a bug in Simh. > Second, I don't think that emulator authors are as strict as you > imply. I think that Bob definitely are that strict. And I'm pretty sure that John in general are too, since he have gone to great lengths to implement the specific behavior of different implementations of the PDP-11 for these undefined things. > For example, consider the following "programming difference" > from one of the J11 architecture documents: > > 30. If a register contains an odd value in mode 2 and a [11/73] > bus error occurs, the register will be incremented > > If a register contains an odd value in mode 2 and a [11/34] > bus error occurs, the register will be unchanged. > > SimH gets it right for its default J11 CPU, where it increments > and wrong for an 11/34, where it should be unchanged. E11 is the other > way around: right for its default 11/34 CPU, where it's unchanged and > wrong for the J11 where it should increment. Now these are examples of > incorrect implementation differences (that I would never rely on for a > detection test), however, there's no screaming need for SimH or E11 to > fix them. Have you tried, for both, to tell that it should be an 11/34 and an 11/73 respectively, and see what the results becomes for both? E11 can be told to be a whole bunch of different PDP-11 models. Just reading through the manual, you can specify it to act as a: PDP-11/03, PDP-11/04, PDP-11/05, PDP-11/20, PDP-11/23, PDP-11/24, PDP-11/34a, PDP-11/40, PDP- 11/44, PDP-11/45, PDP-11/53, PDP-11/60, PDP-11/70, PDP-11/73, PDP-11/74, PDP-11/83, PDP-11/84, PDP-11/93, or PDP-11/94 CPU with individually selectable features. Picking the right CPU model is important, and do change the behavior of E11. And it's similar in Simh, where there is also a long list of different PDP-11 models you can choose from to set as the CPU Simh should look like. But there might be bugs. I think they should be reported in that case. > Whenever I write a new RUST driver I first get it up and running under > V11, and then on couple of different real PDP-11s. Then I test E11 and > SimH, where I often have to make changes to the driver to get it work. > Likewise, I have a debugger which uses the trace trap to store an > execution history. It works well under E11 but is a bit wierd under > SimH. Maybe a bug in Simh that should be reported? I know it took some working before the trace trap worked ok in E11. > Neither SimH or E11 attempt to mimic the instruction times of the > original computers. Does this represent a failure? There is at least > one gaming PDP-11 emulation which does mimic the instruction times. Yes, as I pointed out, the speed is probably the one thing where they will continue to fail. I am sure some would consider that to also be bad. I think you can atleast tell Simh to actually try and match the speed of the real machine it emulates... But it is hard to get exact. > As noted, the emulators don't mimic the typical speeds of PDP-11 > terminals either. That was fixed behavior I could rely on a real > PDP-11. Right. > One of the key strengths of SimH is its portability across different > systems, and in to the future since it sticks pretty much to > straightforward C code. This portability may well be one reason that > SimH doesn't mimic asynchronous I/O. There are always trade-offs. I noted another thing that had been sitting in the back of my head, and which John Wilson documents in the manual for E11. Both RSX and RT-11 sometimes actually requires that I/O takes a little while before it completes, or else the OS malfunctions. How much you'd want to call that synchronous, I don't know. E11 basically can do a fixed number of instructions delay before reporting I/O as complete. > The emulations are not exact or complete and it would be unrealistic > to expect them to be and they're only as good as the testing they've > had. There is always going to be a gap between the emulation and the > original. Some of the behavior that lies in the gap is worth fixing, > some behavior isn't. That's true of most software. Emulators are no > different. Indeed. And I'm not going to try and fix most of these things, since my personal interest is not 100% perfect emulations. >> A lot of the "undefined" behavior is in fact things that are used to >> identify one CPU from another. > > Which is exactly what I've used in the past and that's what I'm using > with the emulators. I made the point elsewhere: that software often > relies on the unchanging behavior of an implementation. One could make > the case that an emulation should likewise strive to be unchanging > whenever possible if it wants to emulate real machines. My point is that an emulation should not have a different behavior from the system it tries to emulate. You are depending on exactly this "error". >>> Disk I/O provides another opportunity for testing. I guess that SimH >>> disk I/O is synchronous, i.e. is always actually completed before >>> control is returned to the emulated CPU after the interrupt servicve >>> routine delay cycles. But to test that you'd probably need to use >>> direct access to the device registers and that in turn would require >>> per-device tests. I'm likewise not sure if E11 is synchronous. V11 >>> certainly is. >> >> E11 does not do it synchronously. It's done in different threads, that >> can complete asynchronously to each other. Which is nice. It means that >> your CPU does not stand still just because you issued an operation to a >> device. Especially if you have a multi-cpu host machine. > > That's cool (the only thing I thread in V11 is the terminal). E11 aims > at high performance and I guess that's *one* reason that John Wilson > didn't bother to implement MMU register SR1--it would have adversely > affected performance (since it requires a 2-part calculation and store > for every register/mode access). Um? Are we talking about MMR1 here? The register used to record autoincrement/autodecrement of general registers during execution of an instruction in case the instruction aborts? Or are you talking about some other register? Looking in RSX, it don't seem like the kernel use that ever, but it does get propagated to user programs when you get a trap in the user program, so potentially it could be needed in RSX. But it would probably only be useful if you wanted to restart instructions after page faults, and since no OS that I know of do page faults, I can see how it is not being used anywhere. > My detection tests involve SR1. The shakiest part of my approach is > that it would be quite reasonable for E11 to improve SR1 emulation at > some point (regardless of my tests), although since no system actually > uses the functionality there's no real incentive to do so. I can see that it might be costly to maintain it, but on the other hand, if trappings never will occur with registers updated that needs rollback, SR1 can be left zero at all times. So it might actually be that E11 already does it "right". >>>>> The advantage of the register behavior test is that it tests SimH and >>>>> E11 out-of-the-box, as delivered. Any test which is based on custom >>>>> versions of SimH and E11 has exactly the disadvantage that it won't >>>>> test the standard deliverables, which is what most people use. Thus, >>>>> it makes sense to use my register test, or something equivalent when >>>>> the custom instruction/device is not present. >>>> >>>> Right. The only addition being that at least SimH should not be >>>> identifiable this way either. It's a bug that you are using at the >>>> moment. Expect it to go away sooner or later. >>> >>> See above. It may go away, but not necessarily. It would be fun if it >>> did 'cos I'd have to scratch my head and look for something else. >> >> I think the aim of Simh is that there shouldn't be a way. When there is >> a way, the emulation have failed. > > I think it is accepted that there will always be a gap between the > emulation and the original. I don't think the emulations aim at being > utterly exact. Life is too short. To quote BobS again: > > The model emulation in SimH is not perfect, which is why clever > software can detect it. I think that the aim of Simh is that it should follow as closely as possible. As such, any discrepancies detected are subject to being fixed, if realistic to fix. (Speed being one of those things probably not realistic to fix perfectly.) > The presence of a gap doesn't mean that an emulation has failed. In > any case SimH and E11 are quite amazing, with or without gaps. I guess it depends on what you want. For me, they are perfectly fine as they are. For some other persons, they might not be. Johnny