diff --git a/default.nix b/default.nix index 945f76d..f85fc0c 100644 --- a/default.nix +++ b/default.nix @@ -1,9 +1,6 @@ -{ - pkgs ? import (fetchTarball { - # nixos-unstable rev 2024-12-03 - url = "https://github.com/NixOS/nixpkgs/archive/55d15ad12a74eb7d4646254e13638ad0c4128776.tar.gz"; - }) { }, -}: +{ pkgs ? import (fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/24.05.tar.gz"; +}) {} }: let haskellPackages = pkgs.haskell.packages.ghc948; diff --git a/rtlil-corpus b/rtlil-corpus index d8f2b88..d60615b 160000 --- a/rtlil-corpus +++ b/rtlil-corpus @@ -1 +1 @@ -Subproject commit d8f2b884c523bdae74978fb52abe92d7487b1a9e +Subproject commit d60615be78cd1fc7173bff956d2b1a53f8235bb0 diff --git a/shell.nix b/shell.nix index ba4c573..ddb9d28 100644 --- a/shell.nix +++ b/shell.nix @@ -1,20 +1,12 @@ -{ - pkgs ? import (fetchTarball { - # nixos-unstable rev 2024-12-03 - url = "https://github.com/NixOS/nixpkgs/archive/55d15ad12a74eb7d4646254e13638ad0c4128776.tar.gz"; - }) { }, -}: +{ pkgs ? import (fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/24.05.tar.gz"; +}) {} }: let - haskellator = pkgs.callPackage ./default.nix { }; - corpus = pkgs.callPackage ./rtlil-corpus/default.nix { }; + haskellator = pkgs.callPackage ./default.nix {}; in -pkgs.callPackage ( - { mkShell }: - mkShell { - CORPUS = corpus; - nativeBuildInputs = [ - haskellator +pkgs.mkShell { + buildInputs = [ + haskellator ]; - } -) { } +} diff --git a/test.py b/test.py index 0dd7505..d7f89a4 100644 --- a/test.py +++ b/test.py @@ -1,30 +1,13 @@ import os import subprocess -import argparse -import shutil - -parser = argparse.ArgumentParser(description="Test rtlil-parse") -parser.add_argument("--corpus", default=os.environ.get('CORPUS'), required=False, help="Path to corpus dir.") -args = parser.parse_args() # Define the directories -if args.corpus: - corpus_dir = args.corpus -else: - corpus_dir = './rtlil-corpus/corpus/' - +corpus_dir = './rtlil-corpus/corpus/' parsed_dir = './parsed_rtlil' # Create the parsed_rtlil directory if it doesn't exist os.makedirs(parsed_dir, exist_ok=True) -# Use rtlil-parse from PATH if available. -rtil_parse_binary = shutil.which("rtlil-parse") -if rtil_parse_binary is None: - program = "cabal run rtlil-parse --" -else: - program = rtil_parse_binary - # Iterate over all .rtlil files in the corpus directory for file_name in os.listdir(corpus_dir): if file_name.endswith('.il'): @@ -33,7 +16,7 @@ for file_name in os.listdir(corpus_dir): output_path = os.path.join(parsed_dir, output_file) # Construct and run the command - command = f"{program} {input_path} {output_path}" + command = f"cabal run rtlil-parse -- {input_path} {output_path}" try: subprocess.run(command, shell=True, check=True) print(f"Processed: {input_path} -> {output_path}")