diff options
author | Yann Herklotz <git@yannherklotz.com> | 2019-07-21 13:37:25 +0200 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2019-07-21 13:37:25 +0200 |
commit | 30fbe26f59e54a276f88650ffa5e78343b5411eb (patch) | |
tree | aa3166c423f262ee6296826d2c815a0b54084c31 /scripts/size.py | |
parent | b5c035e45949945cc62845fa6492cffa77992524 (diff) | |
parent | c19a51a8156bbcaee13d9819c8fe54ed0ca5c4cc (diff) | |
download | verismith-30fbe26f59e54a276f88650ffa5e78343b5411eb.tar.gz verismith-30fbe26f59e54a276f88650ffa5e78343b5411eb.zip |
Merge branch 'master' into fix/resize-modports
Diffstat (limited to 'scripts/size.py')
-rwxr-xr-x | scripts/size.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/size.py b/scripts/size.py new file mode 100755 index 0000000..d6d7466 --- /dev/null +++ b/scripts/size.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import subprocess +import statistics +import argparse +import os + +def file_len(fname): + with open(fname) as f: + for i, l in enumerate(f): + pass + return i + 1 + +def main(c, n): + l = [] + for x in range(0, n): + subprocess.call(["verifuzz", "generate", "-o", "main.v", "-c", c]) + l.append(file_len("main.v")) + os.remove("main.v") + print("mean: ", statistics.mean(l)) + print("median: ", statistics.median(l)) + print("stdev: ", statistics.stdev(l)) + print("variance: ", statistics.variance(l)) + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Check the average size of a generated program.') + parser.add_argument('config', metavar='CONFIG', help='The config file to test.') + parser.add_argument('-n', '--num', help='How many iterations to run.', default=10, type=int) + args = parser.parse_args() + main(args.config, args.num) |