diff options
author | Clifford Wolf <clifford@clifford.at> | 2016-08-06 13:32:29 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2016-08-06 13:32:29 +0200 |
commit | 88a67afa7d044bd1abb952d7c709876e4159db1a (patch) | |
tree | a113ab33281dc964bb1712c337e2a815decc2855 /passes/tests | |
parent | 90c17aad56b0bf4b3ace5dea8c2d8555b52d4bfb (diff) | |
download | yosys-88a67afa7d044bd1abb952d7c709876e4159db1a.tar.gz yosys-88a67afa7d044bd1abb952d7c709876e4159db1a.tar.bz2 yosys-88a67afa7d044bd1abb952d7c709876e4159db1a.zip |
Added "test_autotb -seed" (and "autotest.sh -S")
Diffstat (limited to 'passes/tests')
-rw-r--r-- | passes/tests/test_autotb.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/passes/tests/test_autotb.cc b/passes/tests/test_autotb.cc index 59de111c2..607bc4761 100644 --- a/passes/tests/test_autotb.cc +++ b/passes/tests/test_autotb.cc @@ -71,7 +71,7 @@ static std::string idy(std::string str1, std::string str2 = std::string(), std:: return id(str1); } -static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter) +static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter, int seed) { f << stringf("`ifndef outfile\n"); f << stringf("\t`define outfile \"/dev/stdout\"\n"); @@ -85,7 +85,7 @@ static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter) f << stringf("reg [31:0] xorshift128_x = 123456789;\n"); f << stringf("reg [31:0] xorshift128_y = 362436069;\n"); f << stringf("reg [31:0] xorshift128_z = 521288629;\n"); - f << stringf("reg [31:0] xorshift128_w = %u; // <-- seed value\n", int(time(NULL))); + f << stringf("reg [31:0] xorshift128_w = %u; // <-- seed value\n", seed ? seed : int(time(NULL))); f << stringf("reg [31:0] xorshift128_t;\n\n"); f << stringf("task xorshift128;\n"); f << stringf("begin\n"); @@ -342,6 +342,7 @@ struct TestAutotbBackend : public Backend { virtual void execute(std::ostream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) { int num_iter = 1000; + int seed = 0; log_header(design, "Executing TEST_AUTOTB backend (auto-generate pseudo-random test benches).\n"); @@ -352,11 +353,15 @@ struct TestAutotbBackend : public Backend { num_iter = atoi(args[++argidx].c_str()); continue; } + if (args[argidx] == "-seed" && argidx+1 < GetSize(args)) { + seed = atoi(args[++argidx].c_str()); + continue; + } break; } extra_args(f, filename, args, argidx); - autotest(*f, design, num_iter); + autotest(*f, design, num_iter, seed); } } TestAutotbBackend; |