You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Address gatecat's review comments on documentation:
- docs/using-pin-signatures.rst:
* Fix I2C example to use OPEN_DRAIN_STRONG_DOWN (not STRONG_UP)
* Add note linking to chipflow-examples for CPU/Wishbone examples
- docs/simulation-guide.rst:
* Fix input.json format to use wait_for/action (not timestamps)
* Update CXXRTL code to use cxxrtl::value (not wire)
* Use .get()/.set() methods instead of .curr/.next
* Retitle "Simulation Hangs" to "Incomplete Simulation Output"
* Clarify that simulation always stops after num_steps
- docs/architecture.rst:
* Add example showing how to attach simulation models to custom signatures
- docs/contributor-pin-signature-internals.rst:
* Replace verbose "Summary" section with concise "Key Files" list
* Remove redundant feature bullet points
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/simulation-guide.rst
+18-14Lines changed: 18 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -345,7 +345,7 @@ Creating Reference
345
345
Input Commands (Optional)
346
346
~~~~~~~~~~~~~~~~~~~~~~~~~~
347
347
348
-
You can provide input commands via ``design/tests/input.json``:
348
+
You can provide input commands via ``design/tests/input.json``. To reduce test churn from timing changes, input files use output events as triggers rather than timestamps:
349
349
350
350
.. code-block:: json
351
351
@@ -362,7 +362,7 @@ Commands are processed sequentially:
362
362
- ``action`` commands queue an action (like transmitting data) for a peripheral
363
363
- ``wait`` commands pause execution until the specified event occurs
364
364
365
-
Models process these commands at the specified timestamps.
365
+
See the `mcu_soc example <https://github.com/ChipFlow/chipflow-examples/blob/main/mcu_soc/design/tests/input.json>`_ for a working input.json file.
366
366
367
367
Customizing Simulation
368
368
----------------------
@@ -385,18 +385,18 @@ To add a custom peripheral model:
385
385
386
386
template<size_t WIDTH>
387
387
class my_peripheral_model {
388
-
cxxrtl::wire<WIDTH>& output;
389
-
cxxrtl::wire<WIDTH>& input;
388
+
cxxrtl::value<WIDTH>& output;
389
+
cxxrtl::value<WIDTH>& input;
390
390
391
391
public:
392
392
my_peripheral_model(const char* name,
393
-
cxxrtl::wire<WIDTH>& o,
394
-
cxxrtl::wire<WIDTH>& i)
393
+
cxxrtl::value<WIDTH>& o,
394
+
cxxrtl::value<WIDTH>& i)
395
395
: output(o), input(i) {}
396
396
397
397
void step(unsigned timestamp) {
398
-
// Model behavior
399
-
input.next = output.curr;
398
+
// Model behavior - use .get() for reading, .set() for writing
399
+
input.set(output.get());
400
400
}
401
401
};
402
402
@@ -448,19 +448,23 @@ Performance Tips
448
448
Common Issues
449
449
-------------
450
450
451
-
Simulation Hangs
452
-
~~~~~~~~~~~~~~~~
451
+
Incomplete Simulation Output
452
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
453
+
454
+
**Symptom**: Simulation completes but expected operations are incomplete
453
455
454
-
**Symptom**: Simulation runs but never finishes
456
+
**Note**: The simulation will always stop after ``num_steps`` clock cycles, regardless of what the design or software is doing. If your firmware hasn't completed by then, you'll see incomplete output.
455
457
456
458
**Causes**:
459
+
- ``num_steps`` too low for the operations being performed
457
460
- Firmware stuck in infinite loop
458
461
- Waiting for peripheral that never responds
459
462
460
463
**Solutions**:
461
-
- Reduce ``num_steps`` to see how far it gets
462
-
- Enable ``DEBUG=1`` and attach debugger
463
-
- Add timeout checks in your firmware
464
+
- Increase ``num_steps`` in chipflow.toml if legitimate operations need more time
465
+
- Enable ``DEBUG=1`` and attach debugger to see where execution is stuck
466
+
- Add timeout checks in your firmware to detect hangs
467
+
- Use event logging to see how far the simulation progressed
@@ -395,8 +395,11 @@ Here's a complete working example combining all concepts:
395
395
396
396
return m
397
397
398
+
**Note:** For more advanced examples including CPU cores and Wishbone bus integration, see the `chipflow-examples repository <https://github.com/ChipFlow/chipflow-examples>`_, which contains tested and working SoC designs.
399
+
398
400
See Also
399
401
--------
400
402
401
403
- :doc:`chipflow-toml-guide` - Configuring your ChipFlow project
402
404
- :doc:`platform-api` - Complete platform API including SimPlatform and attach_data
405
+
- `ChipFlow Examples <https://github.com/ChipFlow/chipflow-examples>`_ - Complete working examples with CPU and Wishbone bus
0 commit comments