<< lib/cpu/pdp8/SLPDP8CPU.sleela SLeeLa DEC PDP-8 CPU model. Functional architecture foundation; not a cycle-accurate emulator. Extends SLCPURuntime so, in addition to its hand-written PDP-8 semantics (12-bit accumulator/link, masked word memory, EAE/memory-extension feature gates), it inherits the resource-aware workload path (admit()/runWorkload()) and can run C, C++ or Sleela programs within an SLCPUResource grant on the canonical SLeeLa opcode substrate — the same contract every CPU in lib/cpu now honors. Family: cpu. Extends SLCPURuntime. >> #sleela 2.5 material; class SLPDP8CPU extends SLCPURuntime { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 10453; String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-08"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } String machineModel = ""; Boolean strictProfile = true; Boolean extendedArithmeticEnabled = false; Boolean memoryExtensionEnabled = false; Integer accumulator = 0; Integer link = 0; Integer instructionRegister = 0; Integer currentInstructionAddress = 0; Integer memoryWords = 4096; Map memory = new Map(); Map ioDevices = new Map(); < Standard entry point: bring up the inherited runtime (12-bit data, 12-bit > < address, a small register file for AC/LINK/PC) and apply a default PDP-8/E > < profile. Call configureModel(...) to select a specific machine profile. > void configure() { < DEC PDP-8 (~0.67 MHz, rounded to 1); overclockable > setSpecClock(1); bringUp("DEC PDP-8", 12, 12, 4, 4096); configureModel("PDP-8/E", 4096, false, false); } void configureModel(String selectedMachineModel, Integer selectedMemoryWords, Boolean enableEAE, Boolean enableMemoryExtension) { if (selectedMachineModel.trim().isEmpty()) { throw new IllegalArgumentException("A PDP-8 machine profile is required"); } if (selectedMemoryWords < 1 || selectedMemoryWords > 4096) { throw new IllegalArgumentException("Base PDP-8 memory must be 1..4096 words; configure documented memory extension separately"); } machineModel = selectedMachineModel; memoryWords = selectedMemoryWords; extendedArithmeticEnabled = enableEAE; memoryExtensionEnabled = enableMemoryExtension; resetArchitecturalState(); } void resetArchitecturalState() { accumulator = 0; link = 0; instructionRegister = 0; currentInstructionAddress = 0; setEntryPoint(0); } int maskWord12(Integer value) { return value & 0xFFF; } Integer readPdpWord(Integer address) { if (address < 0 || address >= memoryWords) { throw new IllegalStateException("PDP-8 memory address out of range: " + address); } return memory.getOrDefault(address, 0) & 0xFFF; } void writePdpWord(Integer address, Integer value) { if (address < 0 || address >= memoryWords) { throw new IllegalStateException("PDP-8 memory address out of range: " + address); } memory.put(address, maskWord12(value)); } void setLink(Integer value) { if (value != 0 && value != 1) { throw new IllegalArgumentException("PDP-8 link must be 0 or 1"); } link = value; } void requireFeature(Boolean enabled, String featureName) { if (!enabled && strictProfile) { throw new IllegalStateException("Unsupported PDP-8 feature: " + featureName); } } String getMachineModel() { return machineModel; } Integer getAccumulator() { return accumulator; } Integer getLink() { return link; } }