write_cxxrtl: add basic documentation.
authorwhitequark <whitequark@whitequark.org>
Sun, 5 Apr 2020 10:03:23 +0000 (10:03 +0000)
committerwhitequark <whitequark@whitequark.org>
Thu, 9 Apr 2020 04:08:36 +0000 (04:08 +0000)
backends/cxxrtl/cxxrtl.cc

index d204364ca005ccd275e23acd4a01d259ef234faf..465882858f5f8d553de3d763a5d5b2432fc8cd0d 100644 (file)
@@ -1601,7 +1601,22 @@ struct CxxrtlBackend : public Backend {
                log("\n");
                log("    write_cxxrtl [options] [filename]\n");
                log("\n");
-               log("Write C++ code for simulating the design.\n");
+               log("Write C++ code for simulating the design. The generated code requires a driver;\n");
+               log("the following simple driver is provided as an example:\n");
+               log("\n");
+               log("    #include \"top.cc\"\n");
+               log("\n");
+               log("    int main() {\n");
+               log("      cxxrtl_design::p_top top;\n");
+               log("      while (1) {\n");
+               log("        top.p_clk.next = value<1> {1u};\n");
+               log("        top.step();\n");
+               log("        top.p_clk.next = value<1> {0u};\n");
+               log("        top.step();\n");
+               log("      }\n");
+               log("    }\n");
+               log("\n");
+               log("The following options are supported by this backend:\n");
                log("\n");
                log("    -O <level>\n");
                log("        set the optimization level. the default is -O%d. higher optimization\n", DEFAULT_OPT_LEVEL);