rtl-aid 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rtl_aid-0.2.0/src/rtl_aid.egg-info → rtl_aid-0.2.2}/PKG-INFO +1 -1
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/pyproject.toml +1 -1
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/src/rtl_aid/__init__.py +1 -1
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/src/rtl_aid/cli.py +17 -3
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/src/rtl_aid/core.py +9 -4
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/src/rtl_aid/lint.py +24 -2
- {rtl_aid-0.2.0 → rtl_aid-0.2.2/src/rtl_aid.egg-info}/PKG-INFO +1 -1
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/tests/test_core.py +1 -0
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/tests/test_lint.py +1 -0
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/LICENSE +0 -0
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/README.md +0 -0
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/setup.cfg +0 -0
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/src/rtl_aid.egg-info/SOURCES.txt +0 -0
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/src/rtl_aid.egg-info/dependency_links.txt +0 -0
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/src/rtl_aid.egg-info/entry_points.txt +0 -0
- {rtl_aid-0.2.0 → rtl_aid-0.2.2}/src/rtl_aid.egg-info/top_level.txt +0 -0
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import argparse
|
|
2
|
+
from . import __version__
|
|
2
3
|
from .core import VerilogWikiParser
|
|
3
4
|
|
|
4
5
|
def main():
|
|
5
|
-
parser = argparse.ArgumentParser()
|
|
6
|
+
parser = argparse.ArgumentParser(prog="rtldoc")
|
|
7
|
+
|
|
8
|
+
parser.add_argument(
|
|
9
|
+
"--version",
|
|
10
|
+
action="version",
|
|
11
|
+
version=f"%(prog)s {__version__}"
|
|
12
|
+
)
|
|
6
13
|
|
|
7
14
|
group = parser.add_mutually_exclusive_group(required=True)
|
|
8
15
|
|
|
@@ -49,9 +56,15 @@ def main():
|
|
|
49
56
|
parser.add_argument(
|
|
50
57
|
"--json-graph",
|
|
51
58
|
action="store_true",
|
|
52
|
-
help="Generate dependency graph as JSON (graph.json)
|
|
59
|
+
help="Generate dependency graph as JSON (graph.json)"
|
|
53
60
|
)
|
|
54
|
-
|
|
61
|
+
|
|
62
|
+
parser.add_argument(
|
|
63
|
+
"--json-graph-dir",
|
|
64
|
+
metavar="DIR",
|
|
65
|
+
help="Directory to write graph.json (only used with --json-graph; default: output directory)"
|
|
66
|
+
)
|
|
67
|
+
|
|
55
68
|
parser.add_argument(
|
|
56
69
|
"--exclude",
|
|
57
70
|
nargs="+",
|
|
@@ -74,6 +87,7 @@ def main():
|
|
|
74
87
|
verbose=args.v,
|
|
75
88
|
ci=args.ci,
|
|
76
89
|
json_graph=args.json_graph,
|
|
90
|
+
json_graph_dir=args.json_graph_dir,
|
|
77
91
|
print_errors=args.print_errors,
|
|
78
92
|
exclude=args.exclude,
|
|
79
93
|
dry_run=args.dry_run,
|
|
@@ -52,7 +52,7 @@ def _eval_ast_node(node):
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
class VerilogWikiParser(object):
|
|
55
|
-
def __init__(self, paths, verbose=0, ci=False, json_graph=False, print_errors=False, exclude=None, dry_run=False):
|
|
55
|
+
def __init__(self, paths, verbose=0, ci=False, json_graph=False, json_graph_dir=None, print_errors=False, exclude=None, dry_run=False):
|
|
56
56
|
self.paths = paths
|
|
57
57
|
self.modules = {}
|
|
58
58
|
self.called_by = {}
|
|
@@ -60,6 +60,7 @@ class VerilogWikiParser(object):
|
|
|
60
60
|
self.verbose = verbose
|
|
61
61
|
self.ci = ci
|
|
62
62
|
self.json_graph = json_graph
|
|
63
|
+
self.json_graph_dir = json_graph_dir
|
|
63
64
|
self.print_errors = print_errors
|
|
64
65
|
self.exclude = exclude or []
|
|
65
66
|
self.issues = []
|
|
@@ -436,9 +437,13 @@ class VerilogWikiParser(object):
|
|
|
436
437
|
"called_by": self.called_by.get(m, [])
|
|
437
438
|
}
|
|
438
439
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
graph_dir = self.json_graph_dir if self.json_graph_dir else out_dir
|
|
441
|
+
if not self.dry_run:
|
|
442
|
+
os.makedirs(graph_dir, exist_ok=True)
|
|
443
|
+
path = os.path.join(graph_dir, "graph.json")
|
|
444
|
+
if not self.dry_run:
|
|
445
|
+
with open(path, "w") as f:
|
|
446
|
+
json.dump(graph, f, indent=2)
|
|
442
447
|
|
|
443
448
|
# -------------------------
|
|
444
449
|
# CI VALIDATION
|
|
@@ -4,6 +4,7 @@ import sys
|
|
|
4
4
|
import os
|
|
5
5
|
import argparse
|
|
6
6
|
import shutil
|
|
7
|
+
from . import __version__
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def _get_verilator_version():
|
|
@@ -203,6 +204,16 @@ def tag_file(filepath, issues, lint_cmd):
|
|
|
203
204
|
new_headers = []
|
|
204
205
|
if "// lint-test:" not in full_content:
|
|
205
206
|
new_headers.append(f"// lint-test: {lint_cmd_str}\n")
|
|
207
|
+
else:
|
|
208
|
+
# Update existing lint-test line with the new command
|
|
209
|
+
new_lines = []
|
|
210
|
+
for line in lines[:insert_idx]:
|
|
211
|
+
if line.strip().startswith("// lint-test:"):
|
|
212
|
+
new_lines.append(f"// lint-test: {lint_cmd_str}\n")
|
|
213
|
+
else:
|
|
214
|
+
new_lines.append(line)
|
|
215
|
+
lines = new_lines + lines[insert_idx:]
|
|
216
|
+
|
|
206
217
|
if "// tb-test:" not in full_content:
|
|
207
218
|
new_headers.append("// tb-test: tba\n")
|
|
208
219
|
|
|
@@ -218,6 +229,11 @@ def main():
|
|
|
218
229
|
prog="rtllint",
|
|
219
230
|
description="Run verilator lint on Verilog files and tag warnings inline"
|
|
220
231
|
)
|
|
232
|
+
parser.add_argument(
|
|
233
|
+
"--version",
|
|
234
|
+
action="version",
|
|
235
|
+
version=f"%(prog)s {__version__}"
|
|
236
|
+
)
|
|
221
237
|
parser.add_argument(
|
|
222
238
|
"file",
|
|
223
239
|
nargs="+",
|
|
@@ -255,7 +271,7 @@ def main():
|
|
|
255
271
|
print(f"Error: {filepath}: file not found", file=sys.stderr)
|
|
256
272
|
continue
|
|
257
273
|
|
|
258
|
-
output,
|
|
274
|
+
output, _ = _run_lint(filepath, args.include_dirs)
|
|
259
275
|
issues = parse_lint_output(output, filepath)
|
|
260
276
|
|
|
261
277
|
with open(filepath) as f:
|
|
@@ -274,13 +290,19 @@ def main():
|
|
|
274
290
|
continue
|
|
275
291
|
|
|
276
292
|
any_issues = True
|
|
293
|
+
# Build rtllint command for tagging
|
|
294
|
+
rtllint_cmd = ["rtllint"]
|
|
295
|
+
for d in args.include_dirs:
|
|
296
|
+
rtllint_cmd.append(f"-I{d}")
|
|
297
|
+
rtllint_cmd.append(filepath)
|
|
298
|
+
|
|
277
299
|
if args.dry_run:
|
|
278
300
|
print(f"\n{filepath}: {len(issues)} issue(s) would be tagged:")
|
|
279
301
|
for ln, (warning_id, msg) in sorted(issues.items()):
|
|
280
302
|
tag = f"[{warning_id}] " if warning_id else ""
|
|
281
303
|
print(f" Line {ln}: {tag}{msg}")
|
|
282
304
|
else:
|
|
283
|
-
tag_file(filepath, issues,
|
|
305
|
+
tag_file(filepath, issues, rtllint_cmd)
|
|
284
306
|
print(f"{filepath}: tagged {len(issues)} issue(s)")
|
|
285
307
|
|
|
286
308
|
sys.exit(1 if any_issues else 0)
|
|
@@ -3,6 +3,7 @@ from tests.core.test_parsing import * # noqa: F401,F403
|
|
|
3
3
|
from tests.core.test_ci import * # noqa: F401,F403
|
|
4
4
|
from tests.core.test_markdown import * # noqa: F401,F403
|
|
5
5
|
from tests.core.test_gaps import * # noqa: F401,F403
|
|
6
|
+
from tests.core.test_json_graph_dir import * # noqa: F401,F403
|
|
6
7
|
|
|
7
8
|
if __name__ == "__main__":
|
|
8
9
|
import unittest
|
|
@@ -4,6 +4,7 @@ from tests.lint.test_tag_file import * # noqa: F401,F403
|
|
|
4
4
|
from tests.lint.test_include_dirs import * # noqa: F401,F403
|
|
5
5
|
from tests.lint.test_gaps import * # noqa: F401,F403
|
|
6
6
|
from tests.lint.test_verilator_integration import * # noqa: F401,F403
|
|
7
|
+
from tests.lint.test_rtllint_command_tagging import * # noqa: F401,F403
|
|
7
8
|
|
|
8
9
|
if __name__ == "__main__":
|
|
9
10
|
import unittest
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|