DR = new DataRegisters(); $this->IS = new InstructionSet($this); $this->TM = new ToolMemory(); $this->SPM = new ProgramMemory(); $this->PPM = new ProgramMemory(); $this->SPMC = new MemoryController($this->SPM); $this->PPMC = new MemoryController($this->PPM); $this->_AMC = $this->PPMC; } public function loadProgram(int $N): void { $this->PPMC->loadProgram($N); $this->_AMC = $this->PPMC; } public function step(): void { if ($this->_AMC === $this->SPMC && count($this->_AMC) === 0) { $this->_AMC = $this->PPMC; } $block = $this->_AMC->next(); $this->IS->apply($block); } public function execute(): void { while ($this->PPMC->ready()) { $this->step(); } } public function reset(): void { $this->PPMC->reset(); $this->SPMC->reset(); } }