2018-02-18 06:52:49 -06:00
|
|
|
/*
|
|
|
|
* yosys -- Yosys Open SYnthesis Suite
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef YOSYS_ENABLE_VERIFIC
|
|
|
|
|
|
|
|
#include "DataBase.h"
|
|
|
|
|
|
|
|
YOSYS_NAMESPACE_BEGIN
|
|
|
|
|
2018-03-01 04:40:43 -06:00
|
|
|
extern int verific_verbose;
|
2018-02-28 04:45:04 -06:00
|
|
|
|
2018-06-20 16:45:01 -05:00
|
|
|
extern bool verific_import_pending;
|
2019-03-13 14:42:18 -05:00
|
|
|
extern void verific_import(Design *design, const std::map<std::string,std::string> ¶meters, std::string top = std::string());
|
2018-06-20 16:45:01 -05:00
|
|
|
|
2018-02-18 06:52:49 -06:00
|
|
|
extern pool<int> verific_sva_prims;
|
|
|
|
|
|
|
|
struct VerificImporter;
|
|
|
|
|
2018-03-04 06:48:53 -06:00
|
|
|
struct VerificClocking {
|
|
|
|
RTLIL::Module *module = nullptr;
|
2018-02-18 06:52:49 -06:00
|
|
|
Verific::Net *clock_net = nullptr;
|
2018-03-04 06:48:53 -06:00
|
|
|
Verific::Net *enable_net = nullptr;
|
|
|
|
Verific::Net *disable_net = nullptr;
|
|
|
|
Verific::Net *body_net = nullptr;
|
2018-03-07 13:06:02 -06:00
|
|
|
Verific::Net *cond_net = nullptr;
|
2018-02-18 06:52:49 -06:00
|
|
|
SigBit clock_sig = State::Sx;
|
2018-03-04 06:48:53 -06:00
|
|
|
SigBit enable_sig = State::S1;
|
|
|
|
SigBit disable_sig = State::S0;
|
|
|
|
bool posedge = true;
|
2018-06-01 06:25:42 -05:00
|
|
|
bool gclk = false;
|
2018-03-04 06:48:53 -06:00
|
|
|
|
|
|
|
VerificClocking() { }
|
2018-03-26 06:04:10 -05:00
|
|
|
VerificClocking(VerificImporter *importer, Verific::Net *net, bool sva_at_only = false);
|
2018-03-04 06:48:53 -06:00
|
|
|
RTLIL::Cell *addDff(IdString name, SigSpec sig_d, SigSpec sig_q, Const init_value = Const());
|
|
|
|
RTLIL::Cell *addAdff(IdString name, RTLIL::SigSpec sig_arst, SigSpec sig_d, SigSpec sig_q, Const arst_value);
|
|
|
|
RTLIL::Cell *addDffsr(IdString name, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, SigSpec sig_d, SigSpec sig_q);
|
2018-03-04 12:29:26 -06:00
|
|
|
|
|
|
|
bool property_matches_sequence(const VerificClocking &seq) const {
|
|
|
|
if (clock_net != seq.clock_net)
|
|
|
|
return false;
|
|
|
|
if (enable_net != seq.enable_net)
|
|
|
|
return false;
|
|
|
|
if (posedge != seq.posedge)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
2018-02-18 06:52:49 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct VerificImporter
|
|
|
|
{
|
|
|
|
RTLIL::Module *module;
|
|
|
|
Verific::Netlist *netlist;
|
|
|
|
|
|
|
|
std::map<Verific::Net*, RTLIL::SigBit> net_map;
|
|
|
|
std::map<Verific::Net*, Verific::Net*> sva_posedge_map;
|
2018-05-24 10:07:06 -05:00
|
|
|
pool<Verific::Net*, hash_ptr_ops> any_all_nets;
|
2018-02-18 06:52:49 -06:00
|
|
|
|
2018-03-07 12:40:34 -06:00
|
|
|
bool mode_gates, mode_keep, mode_nosva, mode_names, mode_verific;
|
2019-08-07 08:31:49 -05:00
|
|
|
bool mode_autocover, mode_fullinit;
|
2018-02-18 06:52:49 -06:00
|
|
|
|
2019-08-07 08:31:49 -05:00
|
|
|
VerificImporter(bool mode_gates, bool mode_keep, bool mode_nosva, bool mode_names, bool mode_verific, bool mode_autocover, bool mode_fullinit);
|
2018-02-18 06:52:49 -06:00
|
|
|
|
|
|
|
RTLIL::SigBit net_map_at(Verific::Net *net);
|
|
|
|
|
2018-12-18 09:01:22 -06:00
|
|
|
RTLIL::IdString new_verific_id(Verific::DesignObj *obj);
|
2018-02-18 06:52:49 -06:00
|
|
|
void import_attributes(dict<RTLIL::IdString, RTLIL::Const> &attributes, Verific::DesignObj *obj);
|
|
|
|
|
|
|
|
RTLIL::SigSpec operatorInput(Verific::Instance *inst);
|
|
|
|
RTLIL::SigSpec operatorInput1(Verific::Instance *inst);
|
|
|
|
RTLIL::SigSpec operatorInput2(Verific::Instance *inst);
|
|
|
|
RTLIL::SigSpec operatorInport(Verific::Instance *inst, const char *portname);
|
2018-05-24 10:07:06 -05:00
|
|
|
RTLIL::SigSpec operatorOutput(Verific::Instance *inst, const pool<Verific::Net*, hash_ptr_ops> *any_all_nets = nullptr);
|
2018-02-18 06:52:49 -06:00
|
|
|
|
|
|
|
bool import_netlist_instance_gates(Verific::Instance *inst, RTLIL::IdString inst_name);
|
|
|
|
bool import_netlist_instance_cells(Verific::Instance *inst, RTLIL::IdString inst_name);
|
|
|
|
|
|
|
|
void merge_past_ffs_clock(pool<RTLIL::Cell*> &candidates, SigBit clock, bool clock_pol);
|
|
|
|
void merge_past_ffs(pool<RTLIL::Cell*> &candidates);
|
|
|
|
|
2019-03-13 17:05:55 -05:00
|
|
|
void import_netlist(RTLIL::Design *design, Verific::Netlist *nl, std::set<Verific::Netlist*> &nl_todo);
|
2018-02-18 06:52:49 -06:00
|
|
|
};
|
|
|
|
|
2018-03-07 13:06:02 -06:00
|
|
|
void verific_import_sva_assert(VerificImporter *importer, Verific::Instance *inst);
|
|
|
|
void verific_import_sva_assume(VerificImporter *importer, Verific::Instance *inst);
|
|
|
|
void verific_import_sva_cover(VerificImporter *importer, Verific::Instance *inst);
|
|
|
|
void verific_import_sva_trigger(VerificImporter *importer, Verific::Instance *inst);
|
|
|
|
bool verific_is_sva_net(VerificImporter *importer, Verific::Net *net);
|
2018-02-18 06:52:49 -06:00
|
|
|
|
2018-09-04 13:06:10 -05:00
|
|
|
extern int verific_sva_fsm_limit;
|
|
|
|
|
2018-02-18 06:52:49 -06:00
|
|
|
YOSYS_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|