@specy/risc-v 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -317,9 +317,42 @@ interface JsBackStep {
317
317
  */
318
318
  readonly param1: number;
319
319
  /**
320
- * Information about the action
320
+ * Information about the action. A 64 bit value is truncated to 32 bits here, as it always has
321
+ * been; read `oldValue` for the whole of it.
321
322
  */
322
323
  readonly param2: number;
324
+ /**
325
+ * The value this step replaced, as the simulator saw it at the write, whole and untruncated.
326
+ *
327
+ * Every value of this target is 64 bits wide, which no JS number holds, so it is a **signed
328
+ * decimal string**, the shape `JsPokeRegisterWrite` and `getRegistersValuesLong` already use:
329
+ * read it with `BigInt(step.oldValue)`, and with `BigInt.asUintN(64, BigInt(step.oldValue))`
330
+ * for the unsigned form.
331
+ *
332
+ * - `REGISTER_RESTORE`, `FLOATING_POINT_REGISTER_RESTORE`,
333
+ * `CONTROL_AND_STATUS_REGISTER_RESTORE`, `CONTROL_AND_STATUS_REGISTER_BACKDOOR`: the whole
334
+ * register before the write.
335
+ * - `MEMORY_RESTORE_RAW_WORD`, `MEMORY_RESTORE_WORD`, `MEMORY_RESTORE_DOUBLE_WORD`,
336
+ * `MEMORY_RESTORE_HALF`, `MEMORY_RESTORE_BYTE`: the bytes the write replaced, at the width it
337
+ * was made, in the low order bits.
338
+ * - `PC_RESTORE`: the address the restore puts back - the same value as `param1`, which is
339
+ * where this action has always kept it, its `param2` being unused and 0.
340
+ * - `'0'` for `CONTROL_AND_STATUS_COUNTERS_DECREMENT`, `DO_NOTHING` and `POKE`, which replace
341
+ * no single value; a Poke reports both sides of everything it wrote through its own `writes`.
342
+ */
343
+ readonly oldValue: string;
344
+ /**
345
+ * The value the write left, beside the `oldValue` it replaced, taken at the store: a register
346
+ * write reports the whole register after it, a memory write the bytes it left at the width it
347
+ * was made, and `PC_RESTORE` the address the instruction set. Same encoding as `oldValue`.
348
+ *
349
+ * `CONTROL_AND_STATUS_REGISTER_BACKDOOR` is the simulator sampling the wall clock into `time`
350
+ * rather than a program writing a register, but it is a write all the same and reports the
351
+ * millisecond reading it stored. `'0'` for `CONTROL_AND_STATUS_COUNTERS_DECREMENT` and
352
+ * `DO_NOTHING`, which write no value of their own, and for `POKE`, whose `writes` carry both
353
+ * sides already.
354
+ */
355
+ readonly newValue: string;
323
356
  /**
324
357
  * The program counter value before the action, or -1 for an action that belongs to no
325
358
  * instruction: a Poke, or a host write made before anything ran.
@@ -646,13 +679,17 @@ interface JsRiscV {
646
679
  * several of them - it records the values it overwrote and the counter decrement - while a Poke
647
680
  * is exactly one, the element with `isPoke` set, whatever it wrote. Use `getUndoGroups` to read
648
681
  * the history the way `undo()` pops it, one entry per instruction or Poke.
682
+ *
683
+ * Every step that restores a value reports both sides of the write it undoes, as `oldValue` and
684
+ * `newValue`.
649
685
  * @returns An array of `JsBackStep` objects representing the history of the simulation.
650
686
  */
651
687
  getUndoStack(): JsBackStep[];
652
688
  /**
653
689
  * Gets the undo history grouped the way `undo()` pops it: one entry per executed instruction or
654
- * per Poke, newest first, each carrying the back steps it is made of. A Poke entry also carries
655
- * what it changed, with the old and the new value of each write.
690
+ * per Poke, newest first, each carrying the back steps it is made of, every one of which
691
+ * reports both sides of the write it undoes as `oldValue` and `newValue`. A Poke entry also
692
+ * carries what it changed, with the old and the new value of each write.
656
693
  */
657
694
  getUndoGroups(): JsUndoGroup[];
658
695
  /**
package/dist/index.d.ts CHANGED
@@ -317,9 +317,42 @@ interface JsBackStep {
317
317
  */
318
318
  readonly param1: number;
319
319
  /**
320
- * Information about the action
320
+ * Information about the action. A 64 bit value is truncated to 32 bits here, as it always has
321
+ * been; read `oldValue` for the whole of it.
321
322
  */
322
323
  readonly param2: number;
324
+ /**
325
+ * The value this step replaced, as the simulator saw it at the write, whole and untruncated.
326
+ *
327
+ * Every value of this target is 64 bits wide, which no JS number holds, so it is a **signed
328
+ * decimal string**, the shape `JsPokeRegisterWrite` and `getRegistersValuesLong` already use:
329
+ * read it with `BigInt(step.oldValue)`, and with `BigInt.asUintN(64, BigInt(step.oldValue))`
330
+ * for the unsigned form.
331
+ *
332
+ * - `REGISTER_RESTORE`, `FLOATING_POINT_REGISTER_RESTORE`,
333
+ * `CONTROL_AND_STATUS_REGISTER_RESTORE`, `CONTROL_AND_STATUS_REGISTER_BACKDOOR`: the whole
334
+ * register before the write.
335
+ * - `MEMORY_RESTORE_RAW_WORD`, `MEMORY_RESTORE_WORD`, `MEMORY_RESTORE_DOUBLE_WORD`,
336
+ * `MEMORY_RESTORE_HALF`, `MEMORY_RESTORE_BYTE`: the bytes the write replaced, at the width it
337
+ * was made, in the low order bits.
338
+ * - `PC_RESTORE`: the address the restore puts back - the same value as `param1`, which is
339
+ * where this action has always kept it, its `param2` being unused and 0.
340
+ * - `'0'` for `CONTROL_AND_STATUS_COUNTERS_DECREMENT`, `DO_NOTHING` and `POKE`, which replace
341
+ * no single value; a Poke reports both sides of everything it wrote through its own `writes`.
342
+ */
343
+ readonly oldValue: string;
344
+ /**
345
+ * The value the write left, beside the `oldValue` it replaced, taken at the store: a register
346
+ * write reports the whole register after it, a memory write the bytes it left at the width it
347
+ * was made, and `PC_RESTORE` the address the instruction set. Same encoding as `oldValue`.
348
+ *
349
+ * `CONTROL_AND_STATUS_REGISTER_BACKDOOR` is the simulator sampling the wall clock into `time`
350
+ * rather than a program writing a register, but it is a write all the same and reports the
351
+ * millisecond reading it stored. `'0'` for `CONTROL_AND_STATUS_COUNTERS_DECREMENT` and
352
+ * `DO_NOTHING`, which write no value of their own, and for `POKE`, whose `writes` carry both
353
+ * sides already.
354
+ */
355
+ readonly newValue: string;
323
356
  /**
324
357
  * The program counter value before the action, or -1 for an action that belongs to no
325
358
  * instruction: a Poke, or a host write made before anything ran.
@@ -646,13 +679,17 @@ interface JsRiscV {
646
679
  * several of them - it records the values it overwrote and the counter decrement - while a Poke
647
680
  * is exactly one, the element with `isPoke` set, whatever it wrote. Use `getUndoGroups` to read
648
681
  * the history the way `undo()` pops it, one entry per instruction or Poke.
682
+ *
683
+ * Every step that restores a value reports both sides of the write it undoes, as `oldValue` and
684
+ * `newValue`.
649
685
  * @returns An array of `JsBackStep` objects representing the history of the simulation.
650
686
  */
651
687
  getUndoStack(): JsBackStep[];
652
688
  /**
653
689
  * Gets the undo history grouped the way `undo()` pops it: one entry per executed instruction or
654
- * per Poke, newest first, each carrying the back steps it is made of. A Poke entry also carries
655
- * what it changed, with the old and the new value of each write.
690
+ * per Poke, newest first, each carrying the back steps it is made of, every one of which
691
+ * reports both sides of the write it undoes as `oldValue` and `newValue`. A Poke entry also
692
+ * carries what it changed, with the old and the new value of each write.
656
693
  */
657
694
  getUndoGroups(): JsUndoGroup[];
658
695
  /**