Skip to content

Commit 0121d94

Browse files
robtaylorclaude
andcommitted
Update docs conf.py for autoapi and fix platform-api.rst
- Fix import from copy_docs module - Simplify platform-api.rst to use autoapi toctree - Add autoapi_ignore for chipflow_lib backward compat shim - Remove duplicate autoapi_dirs entries - Comment out myst_parser (not installed) - Add print statements for debugging sys.path additions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7bd8edf commit 0121d94

File tree

1 file changed

+21
-105
lines changed

1 file changed

+21
-105
lines changed

docs/source/conf.py

Lines changed: 21 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
top_path = Path('../../')
88
sys.path.append(str((top_path / 'tools').absolute()))
99

10-
from tools import copy_docs
10+
from copy_docs import copy_docs
1111

1212
# Repos we will be assembling
1313
repos = [
@@ -22,114 +22,29 @@
2222

2323
# add our repos to path
2424
for r in repo_list:
25+
print(f"copy_docs: Adding {str(r)} to sys.path")
2526
sys.path.append(str(r))
2627

27-
# Fix platform-api.rst to remove autodoc directives (requires chipflow to be installed)
28-
# Replace with overview content
29-
platform_api_content = """Platform API Reference
28+
# Create platform-api.rst in docs/source/ (outside chipflow-lib to avoid copy_docs overwriting)
29+
# Uses autoapi instead of autodoc directives (autodoc requires chipflow to be installed)
30+
# Note: Warning about "nonexisting document" is expected - autoapi generates files after toctree parsing
31+
Path('platform-api.rst').write_text("""Platform API Reference
3032
======================
3133
32-
This page provides an overview of the ChipFlow platform API.
34+
This section provides the API reference for the ChipFlow platform library.
3335
34-
Platforms
35-
---------
36-
37-
The ChipFlow library provides several platform implementations for different build targets:
38-
39-
**SimPlatform** (``chipflow.platform.sim``)
40-
Platform for building and running CXXRTL simulations. Use this during development to test your design.
41-
42-
**SiliconPlatform** (``chipflow.platform.silicon``)
43-
Platform for targeting ASIC fabrication. Supports various foundry processes including SKY130, GF180, GF130BCD, and IHP_SG13G2.
44-
45-
**SoftwarePlatform** (``chipflow.platform.software``)
46-
Platform for building RISC-V software to run on your design.
47-
48-
Build Steps
49-
-----------
50-
51-
Steps are the building blocks of the ChipFlow build system:
52-
53-
**SimStep** (``chipflow.platform.sim_step``)
54-
Handles simulation workflow: building the simulator, running simulations, and checking results.
55-
56-
**SiliconStep** (``chipflow.platform.silicon_step``)
57-
Handles ASIC preparation: elaborating designs to RTLIL and submitting to the ChipFlow cloud builder.
58-
59-
**SoftwareStep** (``chipflow.platform.software_step``)
60-
Handles RISC-V software compilation.
61-
62-
**BoardStep** (``chipflow.platform.board_step``)
63-
Handles board-level operations.
64-
65-
IO Signatures
66-
-------------
67-
68-
IO Signatures define standard interfaces for your design. They provide a consistent way to connect peripherals and specify electrical characteristics.
69-
70-
Base Signatures
71-
~~~~~~~~~~~~~~~
72-
73-
- **IOSignature** - Base class for all IO signatures
74-
- **OutputIOSignature** - For output-only signals
75-
- **InputIOSignature** - For input-only signals
76-
- **BidirIOSignature** - For bidirectional signals
77-
78-
Protocol Signatures
79-
~~~~~~~~~~~~~~~~~~~
80-
81-
Pre-defined signatures for common protocols:
82-
83-
- **UARTSignature** - UART serial interface
84-
- **GPIOSignature** - General purpose I/O
85-
- **SPISignature** - SPI bus interface
86-
- **I2CSignature** - I2C bus interface
87-
- **QSPIFlashSignature** - Quad SPI flash interface
88-
- **JTAGSignature** - JTAG debug interface
89-
90-
IO Configuration
91-
----------------
92-
93-
**IOModel**
94-
Configures electrical characteristics of IO pads (drive mode, trip point, inversion).
95-
96-
**IOModelOptions**
97-
Available options for IO configuration.
98-
99-
**IOTripPoint**
100-
Voltage threshold configuration for input signals.
101-
102-
Utility Functions
103-
-----------------
104-
105-
**setup_amaranth_tools()**
106-
Sets up the Amaranth toolchain for your environment.
107-
108-
**top_components()**
109-
Returns dictionary of instantiated top-level components from configuration.
110-
111-
**get_software_builds()**
112-
Returns software build configurations from the design.
113-
"""
114-
platform_api_path = Path('chipflow-lib/platform-api.rst')
115-
if platform_api_path.exists():
116-
platform_api_path.write_text(platform_api_content)
117-
118-
# Add autoapi toctree to chipflow-lib index
119-
chipflow_lib_index_path = Path('chipflow-lib/index.rst')
120-
if chipflow_lib_index_path.exists():
121-
content = chipflow_lib_index_path.read_text()
122-
if 'autoapi/chipflow/index' not in content:
123-
# Add API Reference section pointing directly to autoapi-generated indices
124-
content += """
12536
.. toctree::
126-
:maxdepth: 2
127-
:caption: API Reference
37+
:maxdepth: 3
12838
129-
autoapi/chipflow/index
130-
autoapi/chipflow_lib/index
131-
"""
132-
chipflow_lib_index_path.write_text(content)
39+
/chipflow-lib/autoapi/chipflow/index
40+
""")
41+
42+
# Update chipflow-lib/index.rst to point to the platform-api.rst outside chipflow-lib/
43+
chipflow_lib_index = Path('chipflow-lib/index.rst')
44+
if chipflow_lib_index.exists():
45+
content = chipflow_lib_index.read_text()
46+
content = content.replace('platform-api', '/platform-api')
47+
chipflow_lib_index.write_text(content)
13348

13449
# -- Project information
13550

@@ -148,7 +63,7 @@
14863
'sphinx.ext.doctest',
14964
'sphinx.ext.intersphinx',
15065
'sphinx_copybutton',
151-
'myst_parser',
66+
# 'myst_parser',
15267
'sphinx.ext.todo',
15368
'sphinx.ext.napoleon',
15469
'sphinx.ext.autodoc',
@@ -193,8 +108,6 @@
193108
autodoc_typehints = 'description'
194109

195110
autoapi_dirs = [
196-
top_path / "vendor/chipflow-lib/chipflow_lib/platforms",
197-
top_path / "vendor/chipflow-lib/chipflow_lib",
198111
top_path / "vendor/chipflow-lib/chipflow",
199112
]
200113
autoapi_generate_api_docs = True
@@ -209,6 +122,9 @@
209122
]
210123
autoapi_root = "chipflow-lib/autoapi"
211124
autoapi_add_toctree_entry = False # Don't auto-add to toctree (we link manually)
125+
autoapi_ignore = [
126+
"*/chipflow_lib/*", # Backward compatibility shim
127+
]
212128

213129
# Exclude autoapi templates and in-progress stuff
214130
exclude_patterns = [

0 commit comments

Comments
 (0)