From 5eebfabe4286d47a75508677e2bc76e8b422a879 Mon Sep 17 00:00:00 2001 From: Aman Goel Date: Fri, 27 Sep 2019 12:40:17 -0400 Subject: [PATCH 1/4] Corrects btor2 backend --- backends/btor/btor.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backends/btor/btor.cc b/backends/btor/btor.cc index 4472993d4..f617b7ec2 100644 --- a/backends/btor/btor.cc +++ b/backends/btor/btor.cc @@ -897,9 +897,12 @@ struct BtorWorker int sid = get_bv_sid(GetSize(s)); int nid = next_nid++; - btorf("%d input %d %s\n", nid, sid); + btorf("%d input %d\n", nid, sid); nid_width[nid] = GetSize(s); + for (int j = 0; j < GetSize(s); j++) + nidbits.push_back(make_pair(nid, j)); + i += GetSize(s)-1; continue; } From c372e7baf9c48d41ebdbea4486a72e8dfaaddd3d Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Fri, 27 Sep 2019 18:49:45 -0700 Subject: [PATCH 2/4] Fix box name --- techlibs/xilinx/abc_xc7.box | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/techlibs/xilinx/abc_xc7.box b/techlibs/xilinx/abc_xc7.box index 20da3b8a0..bd6b94817 100644 --- a/techlibs/xilinx/abc_xc7.box +++ b/techlibs/xilinx/abc_xc7.box @@ -7,7 +7,7 @@ # Average across F7[AB]MUX # Inputs: I0 I1 S0 # Outputs: O -F7MUX 1 1 3 1 +MUXF7 1 1 3 1 204 208 286 # Inputs: I0 I1 S0 From d0493925ec739aa13cd72e5aa525e98ca49cc326 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 28 Sep 2019 09:28:51 +0200 Subject: [PATCH 3/4] Support binary files for backends, fixes #1407 --- backends/aiger/xaiger.cc | 2 +- kernel/register.cc | 4 ++-- kernel/register.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backends/aiger/xaiger.cc b/backends/aiger/xaiger.cc index fa6ba0aca..87ba0aedf 100644 --- a/backends/aiger/xaiger.cc +++ b/backends/aiger/xaiger.cc @@ -856,7 +856,7 @@ struct XAigerBackend : public Backend { } break; } - extra_args(f, filename, args, argidx); + extra_args(f, filename, args, argidx, !ascii_mode); Module *top_module = design->top_module(); diff --git a/kernel/register.cc b/kernel/register.cc index 8131fa279..3033ee710 100644 --- a/kernel/register.cc +++ b/kernel/register.cc @@ -612,7 +612,7 @@ void Backend::execute(std::vector args, RTLIL::Design *design) delete f; } -void Backend::extra_args(std::ostream *&f, std::string &filename, std::vector args, size_t argidx) +void Backend::extra_args(std::ostream *&f, std::string &filename, std::vector args, size_t argidx, bool bin_output) { bool called_with_fp = f != NULL; @@ -647,7 +647,7 @@ void Backend::extra_args(std::ostream *&f, std::string &filename, std::vectoropen(filename.c_str(), std::ofstream::trunc); + ff->open(filename.c_str(), bin_output ? (std::ofstream::trunc | std::ofstream::binary) : std::ofstream::trunc); yosys_output_files.insert(filename); if (ff->fail()) { delete ff; diff --git a/kernel/register.h b/kernel/register.h index c74029823..be836013f 100644 --- a/kernel/register.h +++ b/kernel/register.h @@ -109,7 +109,7 @@ struct Backend : Pass void execute(std::vector args, RTLIL::Design *design) YS_OVERRIDE YS_FINAL; virtual void execute(std::ostream *&f, std::string filename, std::vector args, RTLIL::Design *design) = 0; - void extra_args(std::ostream *&f, std::string &filename, std::vector args, size_t argidx); + void extra_args(std::ostream *&f, std::string &filename, std::vector args, size_t argidx, bool bin_output = false); static void backend_call(RTLIL::Design *design, std::ostream *f, std::string filename, std::string command); static void backend_call(RTLIL::Design *design, std::ostream *f, std::string filename, std::vector args); From 0c380f085576c2cead5e3576825cb60046bfd76b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 28 Sep 2019 09:50:29 +0200 Subject: [PATCH 4/4] Add aiger and protobuf backends binary support --- backends/aiger/aiger.cc | 2 +- backends/protobuf/protobuf.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/aiger/aiger.cc b/backends/aiger/aiger.cc index 0798fb35d..3e8b14dee 100644 --- a/backends/aiger/aiger.cc +++ b/backends/aiger/aiger.cc @@ -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(); diff --git a/backends/protobuf/protobuf.cc b/backends/protobuf/protobuf.cc index fff110bb0..671686173 100644 --- a/backends/protobuf/protobuf.cc +++ b/backends/protobuf/protobuf.cc @@ -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));