diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 02:09:04 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 02:09:04 -0500 |
| commit | ac844cb2f29b941999fc4a67f8e79f1dfb2b576d (patch) | |
| tree | 89729a4aac57d294fe2b79479b9f81094474645f /tools/cpu_ref.py | |
| parent | 1b47daac4f9d3c752e2a360561e67d5105517efd (diff) | |
| parent | 6678bab00d2e678349081ce1585091c2413ccfba (diff) | |
Merge pull request #1094 from bbareth
Diffstat (limited to 'tools/cpu_ref.py')
| -rw-r--r-- | tools/cpu_ref.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/tools/cpu_ref.py b/tools/cpu_ref.py index 273b90d0b..15f1d881c 100644 --- a/tools/cpu_ref.py +++ b/tools/cpu_ref.py | |||
| @@ -776,6 +776,24 @@ def main(argv=None): | |||
| 776 | ap.add_argument("--json", action="store_true", help="print the result as JSON") | 776 | ap.add_argument("--json", action="store_true", help="print the result as JSON") |
| 777 | args = ap.parse_args(argv) | 777 | args = ap.parse_args(argv) |
| 778 | 778 | ||
| 779 | inputs = {"lanes": args.lanes, "vcc": args.vcc} | ||
| 780 | if args.lanes == 1: | ||
| 781 | inputs["lane"] = args.lane | ||
| 782 | if args.exec is not None: | ||
| 783 | inputs["exec"] = args.exec | ||
| 784 | for kind, assignments, syntax in ( | ||
| 785 | ("sgpr", args.sgpr, "N=VALUE"), | ||
| 786 | ("vgpr", args.vgpr, "N=VALUE[,VALUE...]"), | ||
| 787 | ): | ||
| 788 | for item in assignments: | ||
| 789 | try: | ||
| 790 | register, text = item.split("=", 1) | ||
| 791 | index = _value(register) | ||
| 792 | value = _value(text) if kind == "sgpr" else _vgpr_value(text, args.lanes) | ||
| 793 | except (ValueError, argparse.ArgumentTypeError): | ||
| 794 | ap.exit(2, f"error: --{kind} expects {syntax}, got {item!r}\n") | ||
| 795 | inputs.setdefault(kind, {})[index] = value | ||
| 796 | |||
| 779 | if args.parse_only: | 797 | if args.parse_only: |
| 780 | try: | 798 | try: |
| 781 | return _print_parse_report(args.listing) | 799 | return _print_parse_report(args.listing) |
| @@ -783,18 +801,6 @@ def main(argv=None): | |||
| 783 | print(f"error: {e}", file=sys.stderr) | 801 | print(f"error: {e}", file=sys.stderr) |
| 784 | return 1 | 802 | return 1 |
| 785 | 803 | ||
| 786 | inputs = {"lanes": args.lanes, "vcc": args.vcc} | ||
| 787 | if args.lanes == 1: | ||
| 788 | inputs["lane"] = args.lane | ||
| 789 | if args.exec is not None: | ||
| 790 | inputs["exec"] = args.exec | ||
| 791 | for item in args.sgpr: | ||
| 792 | n, value = item.split("=", 1) | ||
| 793 | inputs.setdefault("sgpr", {})[int(n, 0)] = int(value, 0) | ||
| 794 | for item in args.vgpr: | ||
| 795 | n, value = item.split("=", 1) | ||
| 796 | inputs.setdefault("vgpr", {})[int(n, 0)] = _vgpr_value(value, args.lanes) | ||
| 797 | |||
| 798 | try: | 804 | try: |
| 799 | result = run(args.listing, inputs) | 805 | result = run(args.listing, inputs) |
| 800 | except (CpuRefError, OSError) as e: | 806 | except (CpuRefError, OSError) as e: |