#! /usr/bin/perl

# This script supports the following options:
# -s <output file> 

# use perl library command to extract the command line options.
use Getopt::Long;
&GetOptions("s=s" => \$list_file);

# define default value if not defined in the command line.
if ($list_file eq "") {
   $list_file = "test_list.txt";
}


# open file
open (LF, "> $list_file");

# get all related vectors
for $vec (<../../vectors/*>) {
   if (-d $vec) {
      $test = $vec;
      $test =~ s/..\/..\/vectors\///;
      if ($test eq "atpg") {next;}
      print LF "# ---------------------------------\n";
      print LF "# $test tests\n";
      print LF "# ---------------------------------\n";
      # get all test files
      for $test (<$vec/stimulus/*.v>) {
         $test =~ s/..\/..\/vectors\/(\w+\/)stimulus\/(\w+)\.v/$1$2/;
         print LF "$test\n";
         }
      print LF "\n";
   }
}

# close file
close (LF);
