|
7 | 7 | top_path = Path('../../') |
8 | 8 | sys.path.append(str((top_path / 'tools').absolute())) |
9 | 9 |
|
10 | | -from tools import copy_docs |
| 10 | +from copy_docs import copy_docs |
11 | 11 |
|
12 | 12 | # Repos we will be assembling |
13 | 13 | repos = [ |
|
22 | 22 |
|
23 | 23 | # add our repos to path |
24 | 24 | for r in repo_list: |
| 25 | + print(f"copy_docs: Adding {str(r)} to sys.path") |
25 | 26 | sys.path.append(str(r)) |
26 | 27 |
|
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 |
30 | 32 | ====================== |
31 | 33 |
|
32 | | -This page provides an overview of the ChipFlow platform API. |
| 34 | +This section provides the API reference for the ChipFlow platform library. |
33 | 35 |
|
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 += """ |
125 | 36 | .. toctree:: |
126 | | - :maxdepth: 2 |
127 | | - :caption: API Reference |
| 37 | + :maxdepth: 3 |
128 | 38 |
|
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) |
133 | 48 |
|
134 | 49 | # -- Project information |
135 | 50 |
|
|
148 | 63 | 'sphinx.ext.doctest', |
149 | 64 | 'sphinx.ext.intersphinx', |
150 | 65 | 'sphinx_copybutton', |
151 | | - 'myst_parser', |
| 66 | + # 'myst_parser', |
152 | 67 | 'sphinx.ext.todo', |
153 | 68 | 'sphinx.ext.napoleon', |
154 | 69 | 'sphinx.ext.autodoc', |
|
193 | 108 | autodoc_typehints = 'description' |
194 | 109 |
|
195 | 110 | autoapi_dirs = [ |
196 | | - top_path / "vendor/chipflow-lib/chipflow_lib/platforms", |
197 | | - top_path / "vendor/chipflow-lib/chipflow_lib", |
198 | 111 | top_path / "vendor/chipflow-lib/chipflow", |
199 | 112 | ] |
200 | 113 | autoapi_generate_api_docs = True |
|
209 | 122 | ] |
210 | 123 | autoapi_root = "chipflow-lib/autoapi" |
211 | 124 | autoapi_add_toctree_entry = False # Don't auto-add to toctree (we link manually) |
| 125 | +autoapi_ignore = [ |
| 126 | + "*/chipflow_lib/*", # Backward compatibility shim |
| 127 | +] |
212 | 128 |
|
213 | 129 | # Exclude autoapi templates and in-progress stuff |
214 | 130 | exclude_patterns = [ |
|
0 commit comments