Skip to content

Commit ccb8eda

Browse files
committed
Add comprehensive user documentation
- Added getting-started.rst guide for new users - Added workflows.rst to document the simulation, board, and silicon workflows - Added advanced-configuration.rst for detailed configuration options - Updated main index.rst to organize documentation into sections
1 parent 258b83d commit ccb8eda

File tree

4 files changed

+691
-3
lines changed

4 files changed

+691
-3
lines changed

docs/advanced-configuration.rst

Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
Advanced Configuration
2+
======================
3+
4+
This guide covers advanced configuration options for ChipFlow projects, including customizing clock domains, debugging features, and platform-specific settings.
5+
6+
Advanced TOML Configuration
7+
----------------------------
8+
9+
The ``chipflow.toml`` file supports many advanced configuration options beyond the basics covered in the getting started guide.
10+
11+
Clock Domains
12+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13+
14+
ChipFlow supports multiple clock domains in your design:
15+
16+
.. code-block:: toml
17+
18+
[chipflow.clocks]
19+
# Default clock for the design
20+
default = "sys_clk"
21+
22+
# Additional clock domains
23+
pll = "pll_clk"
24+
fast = "fast_clk"
25+
26+
Each named clock must have a corresponding pad defined in the pads section:
27+
28+
.. code-block:: toml
29+
30+
[chipflow.silicon.pads]
31+
sys_clk = { type = "clock", loc = "N1" }
32+
pll_clk = { type = "clock", loc = "N2" }
33+
fast_clk = { type = "clock", loc = "N3" }
34+
35+
Debugging Features
36+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37+
38+
ChipFlow provides debugging options for silicon designs:
39+
40+
.. code-block:: toml
41+
42+
[chipflow.silicon.debug]
43+
# Heartbeat LED to verify clock/reset functionality
44+
heartbeat = true
45+
46+
# Internal logic analyzer
47+
logic_analyzer = true
48+
logic_analyzer_depth = 1024
49+
50+
# JTAG debug access
51+
jtag = true
52+
53+
Pin Locking
54+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55+
56+
To prevent pin assignments from changing accidentally, ChipFlow supports a pin locking mechanism:
57+
58+
.. code-block:: toml
59+
60+
[chipflow.pin_lock]
61+
# Enable pin locking
62+
enabled = true
63+
64+
# Lock file path (relative to project root)
65+
file = "pins.lock"
66+
67+
Once locked, pin assignments can only be changed by explicitly updating the lock file.
68+
69+
Resource Constraints
70+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71+
72+
For silicon designs, you can specify resource constraints:
73+
74+
.. code-block:: toml
75+
76+
[chipflow.silicon.constraints]
77+
# Maximum die area in mm²
78+
max_area = 1.0
79+
80+
# Maximum power budget in mW
81+
max_power = 100
82+
83+
# Target clock frequency in MHz
84+
target_frequency = 100
85+
86+
Custom Top-Level Components
87+
---------------------------
88+
89+
You can specify custom top-level components for your design:
90+
91+
.. code-block:: toml
92+
93+
[chipflow.top]
94+
# Main SoC component
95+
soc = "my_design.components:MySoC"
96+
97+
# Additional top-level components
98+
uart = "my_design.peripherals:UART"
99+
spi = "my_design.peripherals:SPI"
100+
101+
Each component should be a fully qualified Python path to a class that implements the Amaranth Component interface.
102+
103+
Platform-Specific Configuration
104+
-------------------------------
105+
106+
Different target platforms may require specific configuration options:
107+
108+
FPGA Board Configuration
109+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110+
111+
.. code-block:: toml
112+
113+
[chipflow.board]
114+
# Target FPGA board
115+
target = "ulx3s"
116+
117+
# Board-specific options
118+
[chipflow.board.options]
119+
size = "85k" # FPGA size
120+
spi_flash = true
121+
sdram = true
122+
123+
Silicon Process Configuration
124+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125+
126+
.. code-block:: toml
127+
128+
[chipflow.silicon]
129+
# Target manufacturing process
130+
process = "gf130bcd"
131+
132+
# Process-specific options
133+
[chipflow.silicon.options]
134+
metal_stack = "6LM"
135+
io_voltage = 3.3
136+
core_voltage = 1.2
137+
138+
External Dependencies
139+
---------------------
140+
141+
ChipFlow can integrate with external dependencies:
142+
143+
.. code-block:: toml
144+
145+
[chipflow.deps]
146+
# External IP cores
147+
cores = [
148+
"github.com/chipflow/[email protected]",
149+
"github.com/chipflow/[email protected]"
150+
]
151+
152+
# External library paths
153+
[chipflow.deps.libs]
154+
amaranth_cores = "amaranth_cores"
155+
chisel_cores = "chisel_cores"
156+
157+
Testing Configuration
158+
---------------------
159+
160+
For more complex testing setups:
161+
162+
.. code-block:: toml
163+
164+
[chipflow.sim]
165+
# Testbench implementation
166+
testbench = "my_design.tb:TestBench"
167+
168+
# Custom simulation flags
169+
[chipflow.sim.options]
170+
trace_all = true
171+
cycles = 10000
172+
seed = 12345
173+
174+
# Test vectors
175+
[chipflow.sim.test_vectors]
176+
path = "test_vectors.json"
177+
format = "json"
178+
179+
Documentation Configuration
180+
---------------------------
181+
182+
To generate custom documentation for your design:
183+
184+
.. code-block:: toml
185+
186+
[chipflow.docs]
187+
# Documentation output directory
188+
output = "docs/build"
189+
190+
# Block diagram generation
191+
block_diagram = true
192+
193+
# Custom templates
194+
template_dir = "docs/templates"
195+
196+
# Additional documentation files
197+
extra_files = [
198+
"docs/architecture.md",
199+
"docs/api.md"
200+
]
201+
202+
Environment Variables
203+
---------------------
204+
205+
Several environment variables can be used to customize ChipFlow's behavior:
206+
207+
- ``CHIPFLOW_ROOT``: Root directory of your project
208+
- ``CHIPFLOW_API_KEY_ID``: API key ID for ChipFlow services
209+
- ``CHIPFLOW_API_KEY_SECRET``: API key secret for ChipFlow services
210+
- ``CHIPFLOW_API_ENDPOINT``: Custom API endpoint (defaults to production)
211+
- ``CHIPFLOW_DEBUG``: Enable debug logging (set to "1")
212+
- ``CHIPFLOW_CONFIG``: Custom path to chipflow.toml file
213+
214+
Using Custom Steps
215+
------------------
216+
217+
To implement a custom step implementation:
218+
219+
1. Create a new class that inherits from the base step:
220+
221+
.. code-block:: python
222+
223+
from chipflow_lib.steps.silicon import SiliconStep
224+
225+
class CustomSiliconStep(SiliconStep):
226+
def prepare(self):
227+
# Custom preparation logic
228+
result = super().prepare()
229+
# Additional processing
230+
return result
231+
232+
def submit(self, rtlil_path, *, dry_run=False):
233+
# Custom submission logic
234+
if dry_run:
235+
# Custom dry run behavior
236+
return
237+
238+
# Custom submission implementation
239+
# ...
240+
241+
2. Reference your custom step in chipflow.toml:
242+
243+
.. code-block:: toml
244+
245+
[chipflow.steps]
246+
silicon = "my_design.custom_steps:CustomSiliconStep"
247+
248+
3. Your custom step will be used when invoking the corresponding command.
249+
250+
Advanced Pin Configurations
251+
---------------------------
252+
253+
For complex pin requirements:
254+
255+
.. code-block:: toml
256+
257+
[chipflow.silicon.pads]
258+
# Differential pair
259+
lvds_in_p = { type = "i", loc = "N4", diff_pair = "positive" }
260+
lvds_in_n = { type = "i", loc = "N5", diff_pair = "negative" }
261+
262+
# Multiple bits of a bus
263+
data[0] = { type = "io", loc = "S1" }
264+
data[1] = { type = "io", loc = "S2" }
265+
data[2] = { type = "io", loc = "S3" }
266+
data[3] = { type = "io", loc = "S4" }
267+
268+
# Special I/O modes
269+
spi_clk = { type = "o", loc = "E1", drive = "8mA", slew = "fast" }
270+
i2c_sda = { type = "io", loc = "W1", pull = "up", schmitt = true }
271+
272+
Integration with Version Control
273+
--------------------------------
274+
275+
ChipFlow integrates with Git for version tracking:
276+
277+
1. Design submissions include Git commit hash for tracking
278+
2. ChipFlow warns if submitting from a dirty Git tree
279+
3. Version information is embedded in the manufacturing metadata
280+
281+
For CI/CD integration, set the following environment variables:
282+
283+
.. code-block:: bash
284+
285+
# CI/CD environment variables
286+
export CHIPFLOW_CI=1
287+
export CHIPFLOW_NONINTERACTIVE=1
288+
289+
# Authentication
290+
export CHIPFLOW_API_KEY_ID=your_ci_key_id
291+
export CHIPFLOW_API_KEY_SECRET=your_ci_key_secret

0 commit comments

Comments
 (0)