Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for PDP- Major States within the CPU. #434

Open
poetnerd opened this issue Nov 11, 2024 · 3 comments
Open

Adding support for PDP- Major States within the CPU. #434

poetnerd opened this issue Nov 11, 2024 · 3 comments

Comments

@poetnerd
Copy link

  • Context

  • Oscar Vermeulen has produced kits that offer a 3/4 scale model of traditional DEC hardware with software emulated on a Raspberry Pi: PiDP-10, PiDP-11, and the first, and still very popular PiDP-8/i. The joy of these kits is two-fold: experiencing old computer hardware and software architectures, and playing with the lights and switches of very-well emulated front panels. See: PiDP-8/I: RECREATING THE PDP-8/I

  • The PiDP-8/i looks like the old PDP-8/i with the major registers and major states on display.

  • SIMH doesn't emulate down to the Major States. It's an instruction-level emulation. Indeed, the first foundational principle reported at [About the Open SIMH project(https://opensimh.org/about/) says, but not cycle-accurate, simulation.

  • The PiDP-8/i software project has developed, tested and benchmarked a fork of the OPEN SIMH PDP-8 emulation that supports the major states. This is of value to the PiDP-8/i project because it means that the "SING STEP" button on the emulated PDP-8/i front panel actually works and steps through the Fetch/Defer/Execute Major States.

  • Benchmarking says that performance with emulation of Major States is half the performance of the instruction-level emulation.

  • We would really like to get out of the business of maintaining a fork of SIMH. But we recognize that there's a performance penalty, and the proposed change is a step down the road of "cycle-accurate simulation."

  • QUESTION: Might the PDP8 SIMH maintainers be willing to accept a pull request to add Major State support?

  • the output of "sim> SHOW VERSION" while running the simulator which is having the issue

PDP-8 simulator Open SIMH V4.1-0 Current
Simulator Framework Capabilities:
32b data
32b addresses
no Ethernet
Idle/Throttling support is available
Virtual Hard Disk (VHD) support
RAW disk and CD/DVD ROM support
Asynchronous I/O support (Lock free asynchronous event queue)
Asynchronous Clock support
FrontPanel API Version 12
Host Platform:
Compiler: GCC Apple LLVM 15.0.0 (clang-1500.1.0.2.5)
Simulator Compiled as C (Release Build) on May 19 2024 at 13:01:35
Build Tool: autosetup+gmake
Memory Access: Little Endian
Memory Pointer Size: 64 bits
Large File (>2GB) support
SDL Video support: No Video Support
No RegEx support for EXPECT commands
OS clock resolution: 1ms
Time taken by msleep(1): 1ms
OS: Darwin Mac-mini.lan 22.6.0 Darwin Kernel Version 22.6.0: Mon Feb 19 19:43:13 PST 2024; root:xnu-8796.141.3.704.6~1/RELEASE_ARM64_T6020 arm64
Processor Name: Apple M2 Pro
tar tool: bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8
curl tool: curl 8.5.0 (aarch64-apple-darwin22.6.0) libcurl/8.5.0 OpenSSL/3.2.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 (+libidn2/2.3.4) nghttp2/1.58.0
git commit id: ffe537a
git commit time: 2024-02-20T18:20:13-08:00

  • how you built the simulator or that you're using prebuilt binaries

We successfully build from source cloned from https://github.com/open-simh/simh.git

  • the simulator configuration file (or commands) which were used when the problem occurred.

No problems encountered.

  • the expected behavior and the actual behavior

We propose internal changes to PDP8/pdp_8cpu.c to allow emulation of the Fetch/Defer/Execute major states which the PiDP-8/i hardware would be able to display,
and control through the SING STEP front panel switch.

  • you may also need to provide specific pointers to data files that may be necessary to demonstrate the problem

@markpizz
Copy link
Contributor

I will be glad to take your changes and include it in the https://github.com/simh/simh repo. In all likelyhood, the results could then also be migrated to the https://github.com/open-simh/simh repo.

@eschaton
Copy link

I think the best thing to do here would be to:

  1. Ensure your fork is rebased atop the latest Open SIMH, to remove any merge noise from its history;
  2. Adjust/consolidate the commits in your fork to represent logical steps that can be easily reviewed; and,
  3. Create one or more PRs against Open SIMH here to bring your changes into the main line of SIMH development.

People with personal forks can then pull your changes into them from Open SIMH, even before any PRs are merged if they want.

It would also probably be worth considering whether and how it would be possible to make the Major State simulation functionality optional (whether at build time or run time), in case anyone really does want PDP-8 simulation to run as fast as possible and doesn't need Major State support.

@poetnerd
Copy link
Author

Thanks for the guidance, Chris.

The dev team is discussing the various trade-offs. At issue is that, as currently conceived, the inner loop of instruction execution changes in a fundamental way. So the way you turn it on or off is to basically switch between two fundamentally incompatible interpreter loops.

The simple way through, at this point, is to switch to Major State accurate, and take the 50% performance hit.

That said, we're going round once more to think if we can find some clever way to do allow switching between both in such a way as to minimize code bloat, and maximize performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants