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
+20-17Lines changed: 20 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -345,17 +345,16 @@ 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:
Models process these commands at the specified timestamps.
357
+
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.
359
358
360
359
Customizing Simulation
361
360
----------------------
@@ -378,18 +377,18 @@ To add a custom peripheral model:
378
377
379
378
template<size_t WIDTH>
380
379
class my_peripheral_model {
381
-
cxxrtl::wire<WIDTH>& output;
382
-
cxxrtl::wire<WIDTH>& input;
380
+
cxxrtl::value<WIDTH>& output;
381
+
cxxrtl::value<WIDTH>& input;
383
382
384
383
public:
385
384
my_peripheral_model(const char* name,
386
-
cxxrtl::wire<WIDTH>& o,
387
-
cxxrtl::wire<WIDTH>& i)
385
+
cxxrtl::value<WIDTH>& o,
386
+
cxxrtl::value<WIDTH>& i)
388
387
: output(o), input(i) {}
389
388
390
389
void step(unsigned timestamp) {
391
-
// Model behavior
392
-
input.next = output.curr;
390
+
// Model behavior - use .get() for reading, .set() for writing
391
+
input.set(output.get());
393
392
}
394
393
};
395
394
@@ -441,19 +440,23 @@ Performance Tips
441
440
Common Issues
442
441
-------------
443
442
444
-
Simulation Hangs
445
-
~~~~~~~~~~~~~~~~
443
+
Incomplete Simulation Output
444
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
445
+
446
+
**Symptom**: Simulation completes but expected operations are incomplete
446
447
447
-
**Symptom**: Simulation runs but never finishes
448
+
**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.
448
449
449
450
**Causes**:
451
+
- ``num_steps`` too low for the operations being performed
450
452
- Firmware stuck in infinite loop
451
453
- Waiting for peripheral that never responds
452
454
453
455
**Solutions**:
454
-
- Reduce ``num_steps`` to see how far it gets
455
-
- Enable ``DEBUG=1`` and attach debugger
456
-
- Add timeout checks in your firmware
456
+
- Increase ``num_steps`` in chipflow.toml if legitimate operations need more time
457
+
- Enable ``DEBUG=1`` and attach debugger to see where execution is stuck
458
+
- Add timeout checks in your firmware to detect hangs
459
+
- 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