Skip to content

Commit

Permalink
Update cpu D register comment
Browse files Browse the repository at this point in the history
  • Loading branch information
netalondon committed Feb 12, 2024
1 parent 6996d07 commit 08c6784
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions simulator/src/cpu/cpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ export function cpuTick(
const a = bits.am ? inM : A;
const [ALU, flag] = alu(bits.op, D, a);

// The reason that we change D here and not in cpuTock is that it represents the internal state of the D register,
// rather then its out pin.
// (According to appendix 3 - A.3.2 in the book, the output ChipName[] refers to the internal state of said chip)
// While a DRegister would update during the Tock clock step,
// this implementation updates the D internal state during tick because the test will need to access the internal D state.
if (bits.d2) {
D = ALU;
}
Expand Down

0 comments on commit 08c6784

Please sign in to comment.