Add aiger and protobuf backends binary support
authorMiodrag Milanovic <mmicko@gmail.com>
Sat, 28 Sep 2019 07:50:29 +0000 (09:50 +0200)
committerMiodrag Milanovic <mmicko@gmail.com>
Sat, 28 Sep 2019 07:51:48 +0000 (09:51 +0200)
backends/aiger/aiger.cc
backends/protobuf/protobuf.cc

index 0798fb35d8d4e259c8fe17a3ab0e0923b57029fa..3e8b14deee0e1c3fc127b8030d9ff16215408ecc 100644 (file)
@@ -777,7 +777,7 @@ struct AigerBackend : public Backend {
                        }
                        break;
                }
-               extra_args(f, filename, args, argidx);
+               extra_args(f, filename, args, argidx, !ascii_mode);
 
                Module *top_module = design->top_module();
 
index fff110bb01fc43c68118783ab3f05f3ddf767fba..6716861732eb90d6f3e62d56bccaa2c8ea2e14b2 100644 (file)
@@ -266,7 +266,7 @@ struct ProtobufBackend : public Backend {
                        }
                        break;
                }
-               extra_args(f, filename, args, argidx);
+               extra_args(f, filename, args, argidx, !text_mode);
 
                log_header(design, "Executing Protobuf backend.\n");
 
@@ -338,7 +338,7 @@ struct ProtobufPass : public Pass {
                if (!filename.empty()) {
                        rewrite_filename(filename);
                        std::ofstream *ff = new std::ofstream;
-                       ff->open(filename.c_str(), std::ofstream::trunc);
+                       ff->open(filename.c_str(), text_mode ? std::ofstream::trunc : (std::ofstream::trunc | std::ofstream::binary));
                        if (ff->fail()) {
                                delete ff;
                                log_error("Can't open file `%s' for writing: %s\n", filename.c_str(), strerror(errno));