Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/diff-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,5 @@ jobs:
./configure.sh && make
sudo make PREFIX=/usr/local install

- name: Compare simulations and record times
run: turnt --diff tests/simulation/inputs/*.aag


- name: Compare Rust simulations against C AIGER
run: turnt --diff -e rust -e c tests/inputs/*.aag
2 changes: 1 addition & 1 deletion .github/workflows/snapshot-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
run: cargo build

- name: Run AIGER snapshot tests
run: turnt tests/aiger/inputs/*.aag
run: turnt -e raw -e opt tests/inputs/*.aag
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/target
.DS_Store
.idea/
scripts/__pycache__
.venv
112 changes: 0 additions & 112 deletions internal_rep.md

This file was deleted.

36 changes: 36 additions & 0 deletions scripts/make_aiger_stimulus_inputs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from pathlib import Path
from random import Random

SCRIPT_DIR = Path(__file__).resolve().parent
INPUT_DIR = SCRIPT_DIR.parent / "tests" / "inputs"


def write_stimulus(aag_path: Path) -> None:
# get I and L from 'aag M I L O A'
aag_header = aag_path.read_text().split()
I = int(aag_header[2])
L = int(aag_header[3])

# just for fun: use path name as random seed!
# (not necessary AT ALL but I think it's cool)
rng = Random(aag_path.name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is pretty cool. 😃

clock_cycles = 1 if L == 0 else 2**L + 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't totally understand why 2^L+1 is the right number of cycles, but choosing something that is somehow related to the number of latches seems perfectly reasonable, I suppose.

input_rows = []
for _ in range(clock_cycles):
input_rows.append("".join(rng.choice("01") for _ in range(I)))

stim_path = aag_path.with_suffix(".stim")

stim_path.write_text("\n".join([*input_rows, "."]) + "\n")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this might be slightly more readable/maintainable as a loop. Something like this:

with open(stim_path, 'w') as f:
    for row in input_rows:
        print(row, file=f)
    print('.', file=f)

print(f"wrote {stim_path}")


def main() -> None:
for aag_path in sorted(INPUT_DIR.glob("*.aag")):
write_stimulus(aag_path)

print(f"wrote AIGER stimulus inputs to {INPUT_DIR}")


if __name__ == "__main__":
main()
Loading
Loading