Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: azonenberg/yosys
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d989007a1522^
Choose a base ref
...
head repository: azonenberg/yosys
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1cb8b2cf7028
Choose a head ref
  • 6 commits
  • 4 files changed
  • 2 contributors

Commits on Aug 28, 2017

  1. Copy the full SHA
    d989007 View commit details
  2. recover_tff: Fix copypasta error

    ArcaneNibble authored and azonenberg committed Aug 28, 2017
    Copy the full SHA
    59849a1 View commit details
  3. Added TFF_x_ALWAYS cells

    azonenberg committed Aug 28, 2017
    Copy the full SHA
    858f158 View commit details
  4. Copy the full SHA
    d50120f View commit details
  5. Copy the full SHA
    69c3f7a View commit details
  6. Copy the full SHA
    1cb8b2c View commit details
Showing with 636 additions and 0 deletions.
  1. +2 −0 passes/techmap/Makefile.inc
  2. +90 −0 passes/techmap/recover_tff.cpp
  3. +25 −0 passes/techmap/tff_retechmap.v
  4. +519 −0 passes/techmap/tff_untechmap.v
2 changes: 2 additions & 0 deletions passes/techmap/Makefile.inc
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@ OBJS += passes/techmap/hilomap.o
OBJS += passes/techmap/extract.o
OBJS += passes/techmap/extract_fa.o
OBJS += passes/techmap/extract_reduce.o
OBJS += passes/techmap/recover_tff.o
$(eval $(call add_share_file,share/untechmap,passes/techmap/tff_untechmap.v))
OBJS += passes/techmap/alumacc.o
OBJS += passes/techmap/dff2dffe.o
OBJS += passes/techmap/dffinit.o
90 changes: 90 additions & 0 deletions passes/techmap/recover_tff.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2017 Robert Ou <rqou@robertou.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/

#include "kernel/yosys.h"

USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN

struct RecoverTFFPass : public ScriptPass
{
RecoverTFFPass() : ScriptPass("recover_tff", "recovers toggle flip-flops from gates") {}
virtual void help() YS_OVERRIDE
{
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n");
log(" recover_tff [options]\n");
log("\n");
log("recovers toggle flip-flops from gates\n");
log("\n");
log("Reconstructs toggle flip-flops given a netlist of gates. This pass is intended\n");
log("to be used as part of a circuit reverse-engineering workflow, but it does also\n");
log("work with synthesis. Note that this command will completely destroy the\n");
log("structure of combinatorial logic as it works.\n");
log("\n");
log("\n");
log("The following commands are executed by this command:\n");
help_script();
log("\n");
}

bool no_final_abc;

virtual void clear_flags() YS_OVERRIDE
{
no_final_abc = false;
}

virtual void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
{
clear_flags();

size_t argidx;
for (argidx = 1; argidx < args.size(); argidx++)
{
if (args[argidx] == "-no_final_abc") {
no_final_abc = true;
continue;
}
break;
}
extra_args(args, argidx, design);

log_header(design, "Executing recover_tff.\n");
log_push();

run_script(design, "", "");

log_pop();
}

virtual void script() YS_OVERRIDE
{
run("abc -g AND,XOR");
run("extract -map +/untechmap/tff_untechmap.v");
run("read_verilog -lib +/untechmap/tff_untechmap.v");

if (!no_final_abc)
run("abc");

run("clean");
}
} RecoverTFFPass;

PRIVATE_NAMESPACE_END
25 changes: 25 additions & 0 deletions passes/techmap/tff_retechmap.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module __TFF_PP0_ALWAYS (C, R, Q);
input C, R;
output wire Q;

__TFF_PP0_ TECHMAP_REPLACE_(
.C(C),
.R(R),
.Q(Q),
.T(1'b1)
);

endmodule

module __TFF_PP0_ALWAYS_CINV (C, R, Q);
input C, R;
output wire Q;

__TFF_PP0_ TECHMAP_REPLACE_(
.C(C),
.R(R),
.Q(Q),
.T(1'b1)
);

endmodule
Loading