@@ -89,7 +89,7 @@ async def test_legacy(dut):
8989 signal_handle = dut._id(" data_valid" , extended = False )
9090 raise TestFailure(" legacy failure path" )
9191```
92- Output
92+ ## Output
9393```
9494Diagnostics
9595coroutine_decorator_detector: Detected @cocotb.coroutine usage. Manual migration review recommended.
@@ -101,7 +101,7 @@ handle_id_to_getitem: Rewrote handle._id("name", extended=False) to handle["name
101101
102102![ Demo output] ( docs/demo-output.png )
103103
104- Project Structure
104+ ## Project Structure
105105```
106106cocotb-v2-migration-helper/
107107├─ pyproject.toml
@@ -127,22 +127,22 @@ cocotb-v2-migration-helper/
127127└─ tests/
128128 └─ test_rules.py
129129```
130- Installation
131- 1 . Clone the repository
130+ ## Installation
131+ ### 1. Clone the repository
132132``` git clone https://github.com/HUNT-001/cocotb-v2-migration-helper.git ```
133133``` cd cocotb-v2-migration-helper ```
134- 2 . Create and activate a virtual environment
135- Windows PowerShell
134+ ### 2. Create and activate a virtual environment
135+ ### Windows PowerShell
136136``` python -m venv .venv ```
137137``` .venv\Scripts\Activate.ps1 ```
138- Linux / macOS
138+ ### Linux / macOS
139139``` python -m venv .venv ```
140140``` source .venv/bin/activate ```
141- 3 . Install dependencies
142- `pip install -e ".[ dev] "
143- Usage
141+ ### 3. Install dependencies
142+ ` pip install -e ".[dev]" `
143+ ## Usage
144144Scan a file
145- python -m cocotb_migrate.cli scan examples/legacy/legacy_input.py`
145+ ` python -m cocotb_migrate.cli scan examples/legacy/legacy_input.py `
146146
147147This will:
148148
@@ -152,72 +152,76 @@ print a unified diff,
152152emit diagnostics.
153153Run tests
154154pytest
155- Current Rule Classification
156- Rule Status Behavior
157- cocotb.fork(...) → cocotb.start_soon(...) Auto-fix with warning Rewritten automatically, warning emitted
158- raise TestFailure("msg") → assert False, "msg" Safe auto-fix Rewritten automatically
159- handle._ id("sig", extended=False) → handle[ "sig"] Safe auto-fix Rewritten automatically
160- @cocotb .coroutine Warn-only Detected and reported, not rewritten
161- Design Direction
162-
163- The intended long-term workflow is:
164-
165- Scan legacy cocotb code
166- Classify findings into:
167- safe auto-fix,
168- auto-fix with warning,
169- manual review
170- Rewrite supported patterns
171- Report diagnostics clearly to the user
172-
173- This keeps the tool useful even before it reaches full migration coverage.
174-
175- More details are documented in DESIGN.md
155+ ## Current Rule Classification
156+ -Rule Status Behavior
157+ -cocotb.fork(...) → cocotb.start_soon(...) Auto-fix with warning Rewritten automatically, warning emitted
158+ -raise TestFailure("msg") → assert False, "msg" Safe auto-fix Rewritten automatically
159+ -handle._ id("sig", extended=False) → handle[ "sig"] Safe auto-fix Rewritten automatically
160+ -@cocotb.coroutine Warn-only Detected and reported, not rewritten
161+
162+ ## Design Direction
163+
164+ ### The intended long-term workflow is:
165+
166+ -Scan legacy cocotb code
167+ -Classify findings into:
168+ -safe auto-fix,
169+ -auto-fix with warning,
170+ -manual review
171+ -Rewrite supported patterns
172+ -Report diagnostics clearly to the user
173+
174+ -This keeps the tool useful even before it reaches full migration coverage.
175+
176+ -More details are documented in DESIGN.md
176177.
177178
178- Current Limitations
179+ ## Current Limitations
180+
181+ -This is an early prototype and intentionally limited in scope.
179182
180- This is an early prototype and intentionally limited in scope.
183+ ### Current limitations include:
181184
182- Current limitations include:
185+ -only a small subset of cocotb 2.x migration patterns are implemented,
186+ -no recursive directory traversal yet,
187+ -no JSON diagnostics output yet,
188+ -no auto-rewrite yet for deprecated coroutine-style code,
189+ -no simulator-backed validation of transformed testbenches.
183190
184- only a small subset of cocotb 2.x migration patterns are implemented,
185- no recursive directory traversal yet,
186- no JSON diagnostics output yet,
187- no auto-rewrite yet for deprecated coroutine-style code,
188- no simulator-backed validation of transformed testbenches.
189- Roadmap
191+ ## Roadmap
190192
191- Planned next steps:
193+ ### Planned next steps:
192194
193- recursive directory scanning,
194- fix command for writing changes back to disk,
195- JSON and machine-readable diagnostics,
196- additional cocotb 2.x migration rules,
197- clearer rule categories for:
198- safe auto-fix,
199- warn-only,
200- manual review,
201- improved reporting and rule-level controls.
202- Development
195+ -recursive directory scanning,
196+ -fix command for writing changes back to disk,
197+ -JSON and machine-readable diagnostics,
198+ -additional cocotb 2.x migration rules,
199+ -clearer rule categories for:
200+ -safe auto-fix,
201+ -warn-only,
202+ -manual review,
203+ -improved reporting and rule-level controls.
203204
204- To make local changes:
205+ ## Development
206+
207+ ### To make local changes:
205208```
206209pip install -e ".[dev]"
207210pytest
208211python -m cocotb_migrate.cli scan examples/legacy/legacy_input.py
209212```
210- Suggested development workflow:
213+ ### Suggested development workflow:
214+
215+ -add or refine a migration rule,
216+ -create/update fixture examples,
217+ -add a test,
218+ -verify CLI output and diagnostics.
211219
212- add or refine a migration rule,
213- create/update fixture examples,
214- add a test,
215- verify CLI output and diagnostics.
216- Why this repo exists
220+ ## Why this repo exists
217221
218- This repository serves as a focused proof-of-concept for a cocotb 2.x migration assistant and demonstrates:
222+ - This repository serves as a focused proof-of-concept for a cocotb 2.x migration assistant and demonstrates:
219223
220- syntax-aware source rewriting,
221- migration rule classification,
222- warning-oriented developer guidance,
223- a practical base for a larger migration tool.
224+ - syntax-aware source rewriting,
225+ - migration rule classification,
226+ - warning-oriented developer guidance,
227+ - a practical base for a larger migration tool.
0 commit comments