rvsched 0.1.0__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.
rvsched-0.1.0/LICENSE ADDED
@@ -0,0 +1,137 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://apache.org
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+ "License" shall mean the terms and conditions for use, reproduction,
9
+ and distribution as defined by Sections 1 through 9 of this document.
10
+ "Licensor" shall mean the copyright owner or entity authorized by
11
+ the copyright owner that is granting the License.
12
+ "Legal Entity" shall mean the union of the acting entity and all
13
+ other entities that control, are controlled by, or are under common
14
+ control with that entity.
15
+ "You" (or "Your") shall mean an individual or Legal Entity
16
+ exercising permissions granted by this License.
17
+ "Source" form shall mean the preferred form for making modifications,
18
+ including but not limited to software source code, documentation
19
+ source, and configuration files.
20
+ "Object" form shall mean any form resulting from mechanical
21
+ transformation or translation of a Source form, including but
22
+ not limited to compiled object code, generated documentation,
23
+ and conversions to other media types.
24
+ "Work" shall mean the work of authorship, whether in Source or
25
+ Object form, made available under the License, as indicated by a
26
+ copyright notice that is included in or attached to the work.
27
+ "Derivative Works" shall mean any work, whether in Source or Object
28
+ form, that is based on (or derived from) the Work and for which the
29
+ editorial revisions, annotations, elaborations, or other modifications
30
+ represent, as a whole, an original work of authorship.
31
+ "Contribution" shall mean any work of authorship, including
32
+ the original version of the Work and any modifications or additions
33
+ to that Work or Derivative Works thereof, that is intentionally
34
+ submitted to Licensor for inclusion in the Work by the copyright owner
35
+ or by an individual or Legal Entity authorized to submit on behalf
36
+ of the copyright owner.
37
+ "Contributor" shall mean Licensor and any individual or Legal Entity
38
+ on behalf of whom a Contribution has been received by Licensor and
39
+ subsequently incorporated within the Work.
40
+
41
+ 2. Grant of Copyright License. Subject to the terms and conditions of
42
+ this License, each Contributor hereby grants to You a perpetual,
43
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
44
+ copyright license to reproduce, prepare Derivative Works of,
45
+ publicly display, publicly perform, sublicense, and distribute the
46
+ Work and such Derivative Works in Source or Object form.
47
+
48
+ 3. Grant of Patent License. Subject to the terms and conditions of
49
+ this License, each Contributor hereby grants to You a perpetual,
50
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
51
+ (except as stated in this section) patent license to make, have made,
52
+ use, offer to sell, sell, import, and otherwise transfer the Work,
53
+ where such license applies only to those patent claims licensable
54
+ by such Contributor that are necessarily infringed by their
55
+ Contribution(s) alone or by combination of their Contribution(s)
56
+ with the Work to which such Contribution(s) was submitted.
57
+
58
+ 4. Redistribution. You may reproduce and distribute copies of the
59
+ Work or Derivative Works thereof in any medium, with or without
60
+ modifications, and in Source or Object form, provided that You
61
+ meet the following conditions:
62
+ (a) You must give any other recipients of the Work or Derivative Works
63
+ a copy of this License; and
64
+ (b) You must cause any modified files to carry prominent notices
65
+ stating that You changed the files; and
66
+ (c) You must retain, in the Source form of any Derivative Works
67
+ that You distribute, all copyright, patent, trademark, and
68
+ attribution notices from the Source form of the Work,
69
+ excluding those notices that do not pertain to any part of
70
+ the Derivative Works; and
71
+ (d) If the Work includes a "NOTICE" text file as part of its
72
+ distribution, then any Derivative Works that You distribute must
73
+ include a readable copy of the attribution notices contained
74
+ within such NOTICE file.
75
+
76
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
77
+ any Contribution intentionally submitted for inclusion in the Work
78
+ by You to the Licensor shall be under the terms and conditions of
79
+ this License, without any additional terms or conditions.
80
+
81
+ 6. Trademarks. This License does not grant permission to use the trade
82
+ names, trademarks, service marks, or product names of the Licensor,
83
+ except as required for reasonable and customary use in describing the
84
+ origin of the Work and reproducing the content of the NOTICE file.
85
+
86
+ 7. Disclaimer of Warranty. Unless required by applicable law or
87
+ agreed to in writing, Licensor provides the Work (and each
88
+ Contributor provides its Contributions) on an "AS IS" BASIS,
89
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
90
+ implied, including, without limitation, any warranties or conditions
91
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
92
+ PARTICULAR PURPOSE. You are solely responsible for determining the
93
+ appropriateness of using or redistributing the Work and assume any
94
+ risks associated with Your exercise of permissions under this License.
95
+
96
+ 8. Limitation of Liability. In no event and under no legal theory,
97
+ whether in tort (including negligence), contract, or otherwise,
98
+ unless required by applicable law (such as deliberate and grossly
99
+ negligent acts) or agreed to in writing, shall any Contributor be
100
+ liable to You for damages, including any direct, indirect, special,
101
+ incidental, or consequential damages of any character arising as a
102
+ result of this License or out of the use or inability to use the
103
+ Work.
104
+
105
+ 9. Accepting Warranty or Additional Liability. While redistributing
106
+ the Work or Derivative Works thereof, You may choose to offer,
107
+ and charge a fee for, acceptance of support, warranty, indemnity,
108
+ or other liability obligations and/or rights consistent with this
109
+ License.
110
+
111
+
112
+ END OF TERMS AND CONDITIONS
113
+
114
+ APPENDIX: How to apply the Apache License to your work.
115
+
116
+ To apply the Apache License to your work, attach the following
117
+ boilerplate notice, with the fields enclosed by brackets "[]"
118
+ replaced with your own identifying information. (Don't include
119
+ the brackets!) The text should be enclosed in the appropriate
120
+ comment syntax for the file format. We also recommend that a
121
+ file or class name and description of purpose be included on the
122
+ same "printed page" as the copyright notice for easier
123
+ identification within third-party archives.
124
+
125
+ Copyright 2026 bitsabhi
126
+
127
+ Licensed under the Apache License, Version 2.0 (the "License");
128
+ you may not use this file except in compliance with the License.
129
+ You may obtain a copy of the License at
130
+
131
+ http://www.apache.org/licenses/LICENSE-2.0
132
+
133
+ Unless required by applicable law or agreed to in writing, software
134
+ distributed under the License is distributed on an "AS IS" BASIS,
135
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136
+ See the License for the specific language governing permissions and
137
+ limitations under the License.
rvsched-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: rvsched
3
+ Version: 0.1.0
4
+ Summary: Decide formal vs simulation for each RTL module before you spend the compute, and never prove the same structure twice.
5
+ Author-email: Abhishek Srivastava <aa20moon@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/0x-auth/rv-verification-scheduler
8
+ Keywords: verilog,systemverilog,formal-verification,eda,riscv,ci,rtl
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
11
+ Classifier: Topic :: Software Development :: Testing
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest; extra == "test"
17
+ Dynamic: license-file
18
+
19
+ # rvsched
20
+
21
+ Before you run formal verification on an RTL module, ask two questions:
22
+
23
+ 1. **Has this exact structure already been proved?** If so, skip it.
24
+ 2. **If not, will formal finish, or should this go to simulation?**
25
+
26
+ `rvsched` answers both in about a second, without running any solver and without an AI model.
27
+
28
+ ```bash
29
+ pip install rvsched
30
+ rvsched route rtl/*.v
31
+ ```
32
+
33
+ ```json
34
+ { "module": "riscv_alu_multiplier",
35
+ "decision": { "action": "RUN", "engine": "SIMULATION",
36
+ "reason": "2 nonlinear op(s) with operands up to 32 bits. Unbounded formal will not converge." } }
37
+ ```
38
+
39
+ ## How it works
40
+
41
+ - **Recognize.** It reads the source and looks for what makes formal proofs blow up: variable × variable multiply, divide or modulo on wide operands, and large flip-flop state. It doesn't solve anything.
42
+ - **Fingerprint.** It hashes each module's *structure*. Renaming signals or modules, comments and whitespace don't change the hash; changing logic does. A parent's hash includes its children's hashes.
43
+ - **Remember.** After your tool runs, you record what happened. Next time the same structure appears, in this repo or a renamed copy anywhere else, the recorded result is used directly.
44
+
45
+ ```bash
46
+ rvsched record rtl/*.v --module fifo --engine FORMAL --status proved --evidence https://ci/run/42
47
+ rvsched route rtl/*.v # fifo -> SKIP, already proved
48
+ rvsched calibrate # how often the predictions were wrong
49
+ ```
50
+
51
+ Recorded outcomes override predictions. If formal timed out on a structure once, that structure goes to simulation from then on. Every verdict says why, and every skip points to its evidence.
52
+
53
+ ## Share results
54
+
55
+ The store is a plain folder (`.rvsched/`). Commit it, and anyone can read it from its raw URL without installing a server:
56
+
57
+ ```bash
58
+ rvsched route rtl/*.v --store https://raw.githubusercontent.com/you/repo/main/.rvsched
59
+ ```
60
+
61
+ ## In CI
62
+
63
+ ```yaml
64
+ - uses: 0x-auth/rv-verification-scheduler@v0.1.0
65
+ with:
66
+ files: rtl/*.v
67
+ ```
68
+
69
+ ## Measured
70
+
71
+ `bench/run.py` gives each module to a real formal tool (Yosys equivalence checking: RTL against its own synthesized netlist, 60 s limit) and compares the outcome with the prediction made beforehand. The run covered 28 modules: PicoRV32, the examples, and small probe modules written for this test.
72
+
73
+ | | |
74
+ |---|---|
75
+ | scored | 25 (3 PicoRV32 wrappers predicted correctly but can't be cached, see below) |
76
+ | wrong | 2: `counter_128` and `picorv32_pcpi_mul`, sent to simulation but formal proved them |
77
+ | multipliers | 8-bit operands proved, 10-bit and wider did not |
78
+
79
+ **Read honestly.** The multiplier threshold was fixed using this same run, so those rows are not an independent test. This kind of check matches flip-flops by name, so it says little about the state-size rule; both misses come from that rule. A property-checking benchmark is the next test.
80
+
81
+ To reproduce (needs `yosys` or `pip install yowasp-yosys`): `python3 bench/run.py path/to/picorv32.v`, then `rvsched calibrate --store bench/.rvsched`.
82
+
83
+ ## Limits
84
+
85
+ - It reads source; it doesn't elaborate the design. Unresolvable widths are assumed to be 32 bits, because guessing too high is the safe direction.
86
+ - A module that depends on something it can't see (an unknown module, a package, an undefined macro) gets no fingerprint. It is never cached, only recognized.
87
+ - If your flow uses `-D` defines, pass the same ones (`-D FORMAL`). They are folded into the fingerprint.
88
+ - Thresholds live at the top of `rvsched/verilog.py`. Tune them to your tool, or let `calibrate` show you where they're wrong.
89
+
90
+ ## Extend it
91
+
92
+ The core (`rvsched/core.py`) is three functions and one record format, and it doesn't change. New languages and stores are plugins:
93
+
94
+ ```toml
95
+ # your package's pyproject.toml
96
+ [project.entry-points."rvsched.languages"]
97
+ vhdl = "my_pkg.vhdl" # registers itself with @rvsched.language("vhdl")
98
+
99
+ [project.entry-points."rvsched.stores"]
100
+ s3 = "my_pkg.s3store" # registers itself with @rvsched.store("s3")
101
+ ```
102
+
103
+ A language provides `split`, `recognize` and `fingerprint`. A store provides `get`, `put` and `all`. The record format is `rvsched/1`; see `Record` in `core.py`.
104
+
105
+ ## License
106
+
107
+ Apache 2.0
@@ -0,0 +1,89 @@
1
+ # rvsched
2
+
3
+ Before you run formal verification on an RTL module, ask two questions:
4
+
5
+ 1. **Has this exact structure already been proved?** If so, skip it.
6
+ 2. **If not, will formal finish, or should this go to simulation?**
7
+
8
+ `rvsched` answers both in about a second, without running any solver and without an AI model.
9
+
10
+ ```bash
11
+ pip install rvsched
12
+ rvsched route rtl/*.v
13
+ ```
14
+
15
+ ```json
16
+ { "module": "riscv_alu_multiplier",
17
+ "decision": { "action": "RUN", "engine": "SIMULATION",
18
+ "reason": "2 nonlinear op(s) with operands up to 32 bits. Unbounded formal will not converge." } }
19
+ ```
20
+
21
+ ## How it works
22
+
23
+ - **Recognize.** It reads the source and looks for what makes formal proofs blow up: variable × variable multiply, divide or modulo on wide operands, and large flip-flop state. It doesn't solve anything.
24
+ - **Fingerprint.** It hashes each module's *structure*. Renaming signals or modules, comments and whitespace don't change the hash; changing logic does. A parent's hash includes its children's hashes.
25
+ - **Remember.** After your tool runs, you record what happened. Next time the same structure appears, in this repo or a renamed copy anywhere else, the recorded result is used directly.
26
+
27
+ ```bash
28
+ rvsched record rtl/*.v --module fifo --engine FORMAL --status proved --evidence https://ci/run/42
29
+ rvsched route rtl/*.v # fifo -> SKIP, already proved
30
+ rvsched calibrate # how often the predictions were wrong
31
+ ```
32
+
33
+ Recorded outcomes override predictions. If formal timed out on a structure once, that structure goes to simulation from then on. Every verdict says why, and every skip points to its evidence.
34
+
35
+ ## Share results
36
+
37
+ The store is a plain folder (`.rvsched/`). Commit it, and anyone can read it from its raw URL without installing a server:
38
+
39
+ ```bash
40
+ rvsched route rtl/*.v --store https://raw.githubusercontent.com/you/repo/main/.rvsched
41
+ ```
42
+
43
+ ## In CI
44
+
45
+ ```yaml
46
+ - uses: 0x-auth/rv-verification-scheduler@v0.1.0
47
+ with:
48
+ files: rtl/*.v
49
+ ```
50
+
51
+ ## Measured
52
+
53
+ `bench/run.py` gives each module to a real formal tool (Yosys equivalence checking: RTL against its own synthesized netlist, 60 s limit) and compares the outcome with the prediction made beforehand. The run covered 28 modules: PicoRV32, the examples, and small probe modules written for this test.
54
+
55
+ | | |
56
+ |---|---|
57
+ | scored | 25 (3 PicoRV32 wrappers predicted correctly but can't be cached, see below) |
58
+ | wrong | 2: `counter_128` and `picorv32_pcpi_mul`, sent to simulation but formal proved them |
59
+ | multipliers | 8-bit operands proved, 10-bit and wider did not |
60
+
61
+ **Read honestly.** The multiplier threshold was fixed using this same run, so those rows are not an independent test. This kind of check matches flip-flops by name, so it says little about the state-size rule; both misses come from that rule. A property-checking benchmark is the next test.
62
+
63
+ To reproduce (needs `yosys` or `pip install yowasp-yosys`): `python3 bench/run.py path/to/picorv32.v`, then `rvsched calibrate --store bench/.rvsched`.
64
+
65
+ ## Limits
66
+
67
+ - It reads source; it doesn't elaborate the design. Unresolvable widths are assumed to be 32 bits, because guessing too high is the safe direction.
68
+ - A module that depends on something it can't see (an unknown module, a package, an undefined macro) gets no fingerprint. It is never cached, only recognized.
69
+ - If your flow uses `-D` defines, pass the same ones (`-D FORMAL`). They are folded into the fingerprint.
70
+ - Thresholds live at the top of `rvsched/verilog.py`. Tune them to your tool, or let `calibrate` show you where they're wrong.
71
+
72
+ ## Extend it
73
+
74
+ The core (`rvsched/core.py`) is three functions and one record format, and it doesn't change. New languages and stores are plugins:
75
+
76
+ ```toml
77
+ # your package's pyproject.toml
78
+ [project.entry-points."rvsched.languages"]
79
+ vhdl = "my_pkg.vhdl" # registers itself with @rvsched.language("vhdl")
80
+
81
+ [project.entry-points."rvsched.stores"]
82
+ s3 = "my_pkg.s3store" # registers itself with @rvsched.store("s3")
83
+ ```
84
+
85
+ A language provides `split`, `recognize` and `fingerprint`. A store provides `get`, `put` and `all`. The record format is `rvsched/1`; see `Record` in `core.py`.
86
+
87
+ ## License
88
+
89
+ Apache 2.0
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "rvsched"
7
+ version = "0.1.0"
8
+ description = "Decide formal vs simulation for each RTL module before you spend the compute, and never prove the same structure twice."
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "Abhishek Srivastava", email = "aa20moon@gmail.com" }]
13
+ keywords = ["verilog", "systemverilog", "formal-verification", "eda", "riscv", "ci", "rtl"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
17
+ "Topic :: Software Development :: Testing",
18
+ ]
19
+ dependencies = []
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/0x-auth/rv-verification-scheduler"
23
+
24
+ [project.scripts]
25
+ rvsched = "rvsched.cli:main"
26
+
27
+ [project.optional-dependencies]
28
+ test = ["pytest"]
29
+
30
+ [tool.setuptools]
31
+ packages = ["rvsched"]
@@ -0,0 +1,6 @@
1
+ """rvsched: decide formal vs simulation before you spend the compute,
2
+ and never pay twice for the same structure."""
3
+ __version__ = "0.1.0"
4
+
5
+ from .core import (SCHEMA, Outcome, Record, Verdict, decide, get_language, # noqa: F401
6
+ language, open_store, recognize, record, resolve, store)
@@ -0,0 +1,5 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ sys.exit(main())
@@ -0,0 +1,143 @@
1
+ """rvsched route | record | calibrate"""
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import hashlib
6
+ import json
7
+ import sys
8
+ from collections import Counter
9
+ from pathlib import Path
10
+
11
+ from . import __version__
12
+ from .core import ENGINES, STATUSES, Outcome, decide, get_language, open_store
13
+ from .core import record as record_verb
14
+ from .core import resolve
15
+
16
+
17
+ def _units(files, lang):
18
+ """All units across all files, so children in other files are visible."""
19
+ units, origin = {}, {}
20
+ for f in files:
21
+ for name, src in lang.split(Path(f).read_text(errors="replace")):
22
+ units[name], origin[name] = src, f
23
+ return units, origin
24
+
25
+
26
+ def _fingerprints(lang, units, defines):
27
+ """-D flags change the design without changing the text, so they are
28
+ folded into every fingerprint."""
29
+ fps = lang.fingerprint(units)
30
+ if not defines:
31
+ return fps
32
+ salt = "|".join(sorted(defines))
33
+ return {k: (None if v is None else
34
+ "sha256:" + hashlib.sha256(f"{v}|{salt}".encode()).hexdigest())
35
+ for k, v in fps.items()}
36
+
37
+
38
+ def cmd_route(a):
39
+ lang, st = get_language(a.lang), open_store(a.store)
40
+ units, origin = _units(a.files, lang)
41
+ fps = _fingerprints(lang, units, a.define)
42
+ rows = []
43
+ for name, src in units.items():
44
+ if not src.lstrip().startswith(("module", "macromodule")):
45
+ continue # interfaces/packages: deps only
46
+ pred = lang.recognize(src, units)
47
+ fp = fps.get(name)
48
+ known = resolve(fp, st) if fp else None
49
+ rows.append({"module": name, "file": origin[name], "fingerprint": fp,
50
+ "decision": decide(pred, known),
51
+ "prediction": {"engine": pred.engine,
52
+ "confidence": pred.confidence},
53
+ "metrics": pred.metrics if a.metrics else None})
54
+ if not a.metrics:
55
+ for r in rows:
56
+ r.pop("metrics")
57
+ print(json.dumps(rows, indent=2))
58
+ return 0
59
+
60
+
61
+ def cmd_record(a):
62
+ lang, st = get_language(a.lang), open_store(a.store)
63
+ units, _ = _units(a.files, lang)
64
+ if a.module not in units:
65
+ print(f"module {a.module!r} not found in {a.files}", file=sys.stderr)
66
+ return 2
67
+ fp = _fingerprints(lang, units, a.define)[a.module]
68
+ if fp is None:
69
+ print(f"{a.module}: fingerprint is unstable (depends on something not in "
70
+ f"the given files); pass those files too", file=sys.stderr)
71
+ return 3
72
+ pred = lang.recognize(units[a.module], units)
73
+ r = record_verb(fp, a.module, pred,
74
+ Outcome(engine=a.engine, status=a.status,
75
+ seconds=a.seconds, evidence=a.evidence), st)
76
+ print(json.dumps(r.to_dict(), indent=2))
77
+ return 0
78
+
79
+
80
+ def cmd_calibrate(a):
81
+ st = open_store(a.store)
82
+ pairs, misses, total = Counter(), [], 0
83
+ for r in st.all():
84
+ if r.miss is None:
85
+ continue
86
+ total += 1
87
+ pairs[f"{r.prediction.engine} -> {r.outcome.engine}:{r.outcome.status}"] += 1
88
+ if r.miss:
89
+ misses.append({"module": r.module, "predicted": r.prediction.engine,
90
+ "actual": f"{r.outcome.engine}:{r.outcome.status}",
91
+ "metrics": {k: r.prediction.metrics.get(k) for k in
92
+ ("sequential_state_bits", "nonlinear_arith_ops",
93
+ "max_datapath_width")}})
94
+ print(json.dumps({"records_with_outcome": total,
95
+ "misses": len(misses),
96
+ "miss_rate": round(len(misses) / total, 3) if total else None,
97
+ "pairs": dict(pairs), "miss_detail": misses}, indent=2))
98
+ return 0
99
+
100
+
101
+ def main(argv=None):
102
+ p = argparse.ArgumentParser(prog="rvsched",
103
+ description="Decide formal vs simulation before you spend the compute.")
104
+ p.add_argument("--version", action="version", version=f"rvsched {__version__}")
105
+ sub = p.add_subparsers(dest="cmd", required=True)
106
+
107
+ def common(sp):
108
+ sp.add_argument("--store", default=".rvsched",
109
+ help="directory, or https:// raw URL (read-only). default: .rvsched")
110
+ sp.add_argument("--lang", default="verilog")
111
+ sp.add_argument("-D", "--define", action="append", default=[],
112
+ help="preprocessor define used by your flow (folded into the fingerprint)")
113
+
114
+ r = sub.add_parser("route", help="recommend an engine for every module")
115
+ r.add_argument("files", nargs="+")
116
+ r.add_argument("--metrics", action="store_true", help="include raw metrics")
117
+ common(r)
118
+ r.set_defaults(fn=cmd_route)
119
+
120
+ w = sub.add_parser("record", help="write what a tool actually did")
121
+ w.add_argument("files", nargs="+")
122
+ w.add_argument("--module", required=True)
123
+ w.add_argument("--engine", required=True, choices=ENGINES)
124
+ w.add_argument("--status", required=True, choices=STATUSES)
125
+ w.add_argument("--seconds", type=float)
126
+ w.add_argument("--evidence", help="URL or path to the log/proof")
127
+ common(w)
128
+ w.set_defaults(fn=cmd_record)
129
+
130
+ c = sub.add_parser("calibrate", help="how often predictions missed reality")
131
+ common(c)
132
+ c.set_defaults(fn=cmd_calibrate)
133
+
134
+ a = p.parse_args(argv)
135
+ try:
136
+ return a.fn(a)
137
+ except (KeyError, ValueError, PermissionError, OSError) as e:
138
+ print(f"rvsched: {e}", file=sys.stderr)
139
+ return 2
140
+
141
+
142
+ if __name__ == "__main__":
143
+ sys.exit(main())