From 3db69b7a105b2c7497fc00b0dc01602f28c5be67 Mon Sep 17 00:00:00 2001 From: chunlin min Date: Mon, 8 Jul 2024 17:03:03 -0400 Subject: [PATCH] inline all tests. Add switch to remove init values as PolarFire DFFs do not support init --- techlibs/microchip/synth_microchip.cc | 17 +++++++-- tests/arch/microchip/dff_opt.v | 42 ---------------------- tests/arch/microchip/dff_opt.ys | 22 ++++++++++-- tests/arch/microchip/ram_SDP.v | 39 -------------------- tests/arch/microchip/ram_SDP.ys | 22 +++++++++++- tests/arch/microchip/ram_TDP.v | 52 --------------------------- tests/arch/microchip/ram_TDP.ys | 36 ++++++++++++++++++- tests/arch/microchip/reduce.v | 29 --------------- tests/arch/microchip/reduce.ys | 11 ++++-- tests/arch/microchip/uram_ar.v | 38 -------------------- tests/arch/microchip/uram_ar.ys | 22 ++++++++++-- tests/arch/microchip/uram_sr.v | 40 --------------------- tests/arch/microchip/uram_sr.ys | 25 ++++++++++++- tests/arch/microchip/widemux.v | 31 ---------------- tests/arch/microchip/widemux.ys | 14 +++++--- 15 files changed, 152 insertions(+), 288 deletions(-) delete mode 100644 tests/arch/microchip/dff_opt.v delete mode 100644 tests/arch/microchip/ram_SDP.v delete mode 100644 tests/arch/microchip/ram_TDP.v delete mode 100644 tests/arch/microchip/reduce.v delete mode 100644 tests/arch/microchip/uram_ar.v delete mode 100644 tests/arch/microchip/uram_sr.v delete mode 100644 tests/arch/microchip/widemux.v diff --git a/techlibs/microchip/synth_microchip.cc b/techlibs/microchip/synth_microchip.cc index 12dc9e221..727bf9ac6 100644 --- a/techlibs/microchip/synth_microchip.cc +++ b/techlibs/microchip/synth_microchip.cc @@ -90,6 +90,9 @@ struct SynthMicrochipPass : public ScriptPass { log(" -noabc9\n"); log(" Use classic ABC flow instead of ABC9\n"); log("\n"); + log(" -discard-ffinit\n"); + log(" discard FF init value instead of emitting an error\n"); + log("\n"); log("\n"); log("The following commands are executed by this synthesis command:\n"); help_script(); @@ -99,6 +102,7 @@ struct SynthMicrochipPass : public ScriptPass { std::string top_opt, edif_file, blif_file, vlog_file, family; bool flatten, retime, noiopad, noclkbuf, nobram, nocarry, nowidelut, nodsp; bool abc9, dff; + bool discard_ffinit; int lut_size; // debug dump switches @@ -122,6 +126,7 @@ struct SynthMicrochipPass : public ScriptPass { abc9 = true; dff = false; lut_size = 4; + discard_ffinit = false; debug_memory = false; debug_carry = false; @@ -218,6 +223,10 @@ struct SynthMicrochipPass : public ScriptPass { debug_carry = true; continue; } + if (args[argidx] == "-discard-ffinit") { + discard_ffinit = true; + continue; + } break; } extra_args(args, argidx, design); @@ -314,6 +323,8 @@ struct SynthMicrochipPass : public ScriptPass { run("opt"); run("memory -nomap"); run("opt_clean"); + if (discard_ffinit || help_mode) + run("attrmap -remove init", "(only if -discard-ffinit)"); } if (check_label("map_memory")) { @@ -454,15 +465,15 @@ struct SynthMicrochipPass : public ScriptPass { // D-flop with async reset and enable // posedge CLK, active low reset to 1 or 0, active high EN - params += " -cell $_DFFE_PN?P_ 01"; + params += " -cell $_DFFE_PN?P_ x"; // D-flop with sync reset and enable, enable takes priority over reset // posedge CLK, active low reset to 1 or 0, active high EN - params += " -cell $_SDFFCE_PN?P_ 01"; + params += " -cell $_SDFFCE_PN?P_ x"; // D-latch + reset to 0/1 // posedge CLK, active low reset to 1 or 0 - params += " -cell $_DLATCH_PN?_ 01"; + params += " -cell $_DLATCH_PN?_ x"; run("dfflegalize" + params, "(Converts FFs to supported types)"); } diff --git a/tests/arch/microchip/dff_opt.v b/tests/arch/microchip/dff_opt.v deleted file mode 100644 index 67d8c3d51..000000000 --- a/tests/arch/microchip/dff_opt.v +++ /dev/null @@ -1,42 +0,0 @@ -/* -ISC License - -Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries - -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. -*/ - -module dff_opt( - input clk, - input [1:0] D_comb, - input [1:0] EN_comb, - input [1:0] RST_comb, - output bar -); - -// DFF with enable that can be merged into D - -reg foo; - -assign bar = foo; - -// sync reset -always@(posedge clk) begin - if (&RST_comb) begin - foo <= 0; - end else begin - foo <= &D_comb; - end -end - -endmodule diff --git a/tests/arch/microchip/dff_opt.ys b/tests/arch/microchip/dff_opt.ys index 3c3125d62..e4647dc5d 100644 --- a/tests/arch/microchip/dff_opt.ys +++ b/tests/arch/microchip/dff_opt.ys @@ -14,10 +14,28 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -read_verilog dff_opt.v +# reset can be merged into D LUT +read_verilog <