-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.py
41 lines (34 loc) · 955 Bytes
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from argparse import ArgumentParser
from amaranth import *
from amaranth.cli import main_runner, main_parser
from croc.chacha import StagedChaChaRounds, Rounds
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("--name", help="Output module name")
parser.add_argument(
"--rounds",
type=Rounds,
default="20",
choices=list(Rounds),
help="amount of total rounds to perform",
)
parser.add_argument(
"--rounds-per-cycle",
type=int,
default="2",
help="amount of rounds to perform per cycle (2 min, `--rounds` max, mod 2)",
)
main_parser(parser)
args = parser.parse_args()
top = StagedChaChaRounds(args.rounds, args.rounds_per_cycle)
main_runner(
parser,
args,
top,
ports=[
top.state_i,
top.state_o,
top.done_o,
],
name=args.name,
)