From 6fe3d5a1cf938081110db0470def2b2687dd665f Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 6 May 2016 23:02:37 +0200 Subject: [PATCH] Added synth_ice40 support for latches via logic loops --- techlibs/ice40/Makefile.inc | 1 + techlibs/ice40/latches_map.v | 11 +++++++++++ techlibs/ice40/synth_ice40.cc | 1 + 3 files changed, 13 insertions(+) create mode 100644 techlibs/ice40/latches_map.v diff --git a/techlibs/ice40/Makefile.inc b/techlibs/ice40/Makefile.inc index 83009d176..14761c6c8 100644 --- a/techlibs/ice40/Makefile.inc +++ b/techlibs/ice40/Makefile.inc @@ -23,6 +23,7 @@ techlibs/ice40/brams_init3.vh: techlibs/ice40/brams_init.mk $(eval $(call add_share_file,share/ice40,techlibs/ice40/arith_map.v)) $(eval $(call add_share_file,share/ice40,techlibs/ice40/cells_map.v)) $(eval $(call add_share_file,share/ice40,techlibs/ice40/cells_sim.v)) +$(eval $(call add_share_file,share/ice40,techlibs/ice40/latches_map.v)) $(eval $(call add_share_file,share/ice40,techlibs/ice40/brams.txt)) $(eval $(call add_share_file,share/ice40,techlibs/ice40/brams_map.v)) diff --git a/techlibs/ice40/latches_map.v b/techlibs/ice40/latches_map.v new file mode 100644 index 000000000..c28f88cf7 --- /dev/null +++ b/techlibs/ice40/latches_map.v @@ -0,0 +1,11 @@ +module \$_DLATCH_N_ (E, D, Q); + wire [1023:0] _TECHMAP_DO_ = "simplemap; opt"; + input E, D; + output Q = !E ? D : Q; +endmodule + +module \$_DLATCH_P_ (E, D, Q); + wire [1023:0] _TECHMAP_DO_ = "simplemap; opt"; + input E, D; + output Q = E ? D : Q; +endmodule diff --git a/techlibs/ice40/synth_ice40.cc b/techlibs/ice40/synth_ice40.cc index cadf3b038..0134c13c1 100644 --- a/techlibs/ice40/synth_ice40.cc +++ b/techlibs/ice40/synth_ice40.cc @@ -214,6 +214,7 @@ struct SynthIce40Pass : public ScriptPass run("abc", " (only if -abc2)"); run("ice40_opt", "(only if -abc2)"); } + run("techmap -map +/ice40/latches_map.v"); run("abc -lut 4"); run("clean"); } -- 2.30.2