From 5e155aa1214a586e0db50c27e9b487915032f08e Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 19 Sep 2016 10:20:20 +0200 Subject: [PATCH] Avoid creating very long strings in test_autotb --- passes/tests/test_autotb.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/passes/tests/test_autotb.cc b/passes/tests/test_autotb.cc index 69e2e76d7..a0b47df8c 100644 --- a/passes/tests/test_autotb.cc +++ b/passes/tests/test_autotb.cc @@ -220,19 +220,21 @@ static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter, int s for (auto it = signal_in.begin(); it != signal_in.end(); it++) { f << stringf("%s %s", it == signal_in.begin() ? "" : ",", it->first.c_str()); int len = it->second; + header2 += ", \""; if (len > 1) header2 += "/", len--; while (len > 1) header2 += "-", len--; if (len > 0) header2 += shorthand, len--; + header2 += "\""; header1.push_back(" " + it->first); header1.back()[0] = shorthand; shorthand = shorthand == 'Z' ? 'A' : shorthand+1; } else { f << stringf(" 1'bx"); - header2 += "#"; + header2 += ", \"#\""; } f << stringf(" }, {"); header2 += " "; @@ -240,19 +242,21 @@ static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter, int s for (auto it = signal_clk.begin(); it != signal_clk.end(); it++) { f << stringf("%s %s", it == signal_clk.begin() ? "" : ",", it->first.c_str()); int len = it->second; + header2 += ", \""; if (len > 1) header2 += "/", len--; while (len > 1) header2 += "-", len--; if (len > 0) header2 += shorthand, len--; + header2 += "\""; header1.push_back(" " + it->first); header1.back()[0] = shorthand; shorthand = shorthand == 'Z' ? 'A' : shorthand+1; } } else { f << stringf(" 1'bx"); - header2 += "#"; + header2 += ", \"#\""; } f << stringf(" }, {"); header2 += " "; @@ -260,19 +264,21 @@ static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter, int s for (auto it = signal_out.begin(); it != signal_out.end(); it++) { f << stringf("%s %s", it == signal_out.begin() ? "" : ",", it->first.c_str()); int len = it->second; + header2 += ", \""; if (len > 1) header2 += "/", len--; while (len > 1) header2 += "-", len--; if (len > 0) header2 += shorthand, len--; + header2 += "\""; header1.push_back(" " + it->first); header1.back()[0] = shorthand; shorthand = shorthand == 'Z' ? 'A' : shorthand+1; } } else { f << stringf(" 1'bx"); - header2 += "#"; + header2 += ", \"#\""; } f << stringf(" }, $time, i);\n"); f << stringf("end\n"); @@ -284,7 +290,7 @@ static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter, int s for (auto &hdr : header1) f << stringf("\t$fdisplay(file, \"#OUT# %s\");\n", hdr.c_str()); f << stringf("\t$fdisplay(file, \"#OUT#\");\n"); - f << stringf("\t$fdisplay(file, \"#OUT# %s\");\n", header2.c_str()); + f << stringf("\t$fdisplay(file, {\"#OUT# \"%s});\n", header2.c_str()); f << stringf("end\n"); f << stringf("endtask\n\n"); -- 2.30.2