Wellingborough / LMC

Little Man Computer Simulator
https://wellingborough.github.io/LMC/
GNU General Public License v3.0
1 stars 4 forks source link

Change handling of substages #43

Open Wellingborough opened 11 months ago

Wellingborough commented 11 months ago

Currently the number of substages is set and modified in code. This is confusing and leads to a lot of code.

  1. Change the name of numSubStages to currentSubStage
  2. Extend the instruction metadata to include a list of subStages, corresponding to the bus transfers
  3. Make it clear through comments that currentSubStage is used in the Fetch-Decode step and in the Execution step
Wellingborough commented 11 months ago

Perhaps we should do some more refactoring work here. Currently we have the bus animations encoded in the instruction set, but then we have the information transfers for certain bus animations encoded in the executeInstruction() function, keyed on indices in the subStages[] element of the instruction set. Perhaps we should just move these into the bus animations? Or combine them in some other way so that the animation and the information transfer are tightly coupled.