diff options
author | Ruben Undheim <ruben.undheim@gmail.com> | 2016-11-03 23:18:00 +0100 |
---|---|---|
committer | Ruben Undheim <ruben.undheim@gmail.com> | 2016-11-03 23:18:00 +0100 |
commit | fefe0fc0430f4f173a25e674708aa0f4f0854b31 (patch) | |
tree | adb13b830212c269d58031f900d652f29013d2d7 /kernel | |
parent | 4f096fe65b77435daba019248273e547fa18d167 (diff) |
Imported yosys 0.7
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/celltypes.h | 4 | ||||
-rw-r--r-- | kernel/driver.cc | 4 | ||||
-rw-r--r-- | kernel/log.cc | 2 | ||||
-rw-r--r-- | kernel/rtlil.cc | 36 | ||||
-rw-r--r-- | kernel/rtlil.h | 6 | ||||
-rw-r--r-- | kernel/satgen.h | 11 | ||||
-rw-r--r-- | kernel/yosys.h | 5 |
7 files changed, 62 insertions, 6 deletions
diff --git a/kernel/celltypes.h b/kernel/celltypes.h index 900c12d0..f0ead1e8 100644 --- a/kernel/celltypes.h +++ b/kernel/celltypes.h @@ -118,6 +118,7 @@ struct CellTypes setup_type("$assume", {A, EN}, pool<RTLIL::IdString>(), true); setup_type("$initstate", pool<RTLIL::IdString>(), {Y}, true); setup_type("$anyconst", pool<RTLIL::IdString>(), {Y}, true); + setup_type("$anyseq", pool<RTLIL::IdString>(), {Y}, true); setup_type("$equiv", {A, B}, {Y}, true); } @@ -130,6 +131,7 @@ struct CellTypes IdString CTRL_IN = "\\CTRL_IN", CTRL_OUT = "\\CTRL_OUT"; setup_type("$sr", {SET, CLR}, {Q}); + setup_type("$ff", {D}, {Q}); setup_type("$dff", {CLK, D}, {Q}); setup_type("$dffe", {CLK, EN, D}, {Q}); setup_type("$dffsr", {CLK, SET, CLR, D}, {Q}); @@ -184,6 +186,8 @@ struct CellTypes for (auto c2 : list_np) setup_type(stringf("$_SR_%c%c_", c1, c2), {S, R}, {Q}); + setup_type("$_FF_", {D}, {Q}); + for (auto c1 : list_np) setup_type(stringf("$_DFF_%c_", c1), {C, D}, {Q}); diff --git a/kernel/driver.cc b/kernel/driver.cc index 5cfc4171..f8d00c38 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -510,7 +510,9 @@ int main(int argc, char **argv) #endif log_flush(); -#ifdef _WIN32 +#if defined(_MSC_VER) + _exit(0); +#elif defined(_WIN32) _Exit(0); #endif diff --git a/kernel/log.cc b/kernel/log.cc index 3f1d8881..abc401f5 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -207,6 +207,8 @@ void logv_error(const char *format, va_list ap) #ifdef EMSCRIPTEN log_files = backup_log_files; throw 0; +#elif defined(_MSC_VER) + _exit(1); #else _Exit(1); #endif diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 32efe4f0..66bbf042 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -866,6 +866,13 @@ namespace { return; } + if (cell->type == "$ff") { + port("\\D", param("\\WIDTH")); + port("\\Q", param("\\WIDTH")); + check_expected(); + return; + } + if (cell->type == "$dff") { param_bool("\\CLK_POLARITY"); port("\\CLK", 1); @@ -1030,7 +1037,7 @@ namespace { return; } - if (cell->type == "$anyconst") { + if (cell->type.in("$anyconst", "$anyseq")) { port("\\Y", param("\\WIDTH")); check_expected(); return; @@ -1069,6 +1076,7 @@ namespace { if (cell->type == "$_SR_PN_") { check_gate("SRQ"); return; } if (cell->type == "$_SR_PP_") { check_gate("SRQ"); return; } + if (cell->type == "$_FF_") { check_gate("DQ"); return; } if (cell->type == "$_DFF_N_") { check_gate("DQC"); return; } if (cell->type == "$_DFF_P_") { check_gate("DQC"); return; } @@ -1830,6 +1838,15 @@ RTLIL::Cell* RTLIL::Module::addSr(RTLIL::IdString name, RTLIL::SigSpec sig_set, return cell; } +RTLIL::Cell* RTLIL::Module::addFf(RTLIL::IdString name, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q) +{ + RTLIL::Cell *cell = addCell(name, "$ff"); + cell->parameters["\\WIDTH"] = sig_q.size(); + cell->setPort("\\D", sig_d); + cell->setPort("\\Q", sig_q); + return cell; +} + RTLIL::Cell* RTLIL::Module::addDff(RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity) { RTLIL::Cell *cell = addCell(name, "$dff"); @@ -1912,6 +1929,14 @@ RTLIL::Cell* RTLIL::Module::addDlatchsr(RTLIL::IdString name, RTLIL::SigSpec sig return cell; } +RTLIL::Cell* RTLIL::Module::addFfGate(RTLIL::IdString name, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q) +{ + RTLIL::Cell *cell = addCell(name, "$_FF_"); + cell->setPort("\\D", sig_d); + cell->setPort("\\Q", sig_q); + return cell; +} + RTLIL::Cell* RTLIL::Module::addDffGate(RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity) { RTLIL::Cell *cell = addCell(name, stringf("$_DFF_%c_", clk_polarity ? 'P' : 'N')); @@ -1984,6 +2009,15 @@ RTLIL::SigSpec RTLIL::Module::Anyconst(RTLIL::IdString name, int width) return sig; } +RTLIL::SigSpec RTLIL::Module::Anyseq(RTLIL::IdString name, int width) +{ + RTLIL::SigSpec sig = addWire(NEW_ID, width); + Cell *cell = addCell(name, "$anyseq"); + cell->setParam("\\WIDTH", width); + cell->setPort("\\Y", sig); + return sig; +} + RTLIL::SigSpec RTLIL::Module::Initstate(RTLIL::IdString name) { RTLIL::SigSpec sig = addWire(NEW_ID); diff --git a/kernel/rtlil.h b/kernel/rtlil.h index a426e0bd..9430dcb3 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -42,7 +42,8 @@ namespace RTLIL STn = 3, // edge sensitive: negedge STe = 4, // edge sensitive: both edges STa = 5, // always active - STi = 6 // init + STg = 6, // global clock + STi = 7 // init }; enum ConstFlags : unsigned char { @@ -1008,6 +1009,7 @@ public: RTLIL::Cell* addEquiv (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y); RTLIL::Cell* addSr (RTLIL::IdString name, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, RTLIL::SigSpec sig_q, bool set_polarity = true, bool clr_polarity = true); + RTLIL::Cell* addFf (RTLIL::IdString name, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q); RTLIL::Cell* addDff (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity = true); RTLIL::Cell* addDffe (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_en, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity = true, bool en_polarity = true); RTLIL::Cell* addDffsr (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, @@ -1032,6 +1034,7 @@ public: RTLIL::Cell* addAoi4Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_d, RTLIL::SigBit sig_y); RTLIL::Cell* addOai4Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_d, RTLIL::SigBit sig_y); + RTLIL::Cell* addFfGate (RTLIL::IdString name, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q); RTLIL::Cell* addDffGate (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity = true); RTLIL::Cell* addDffeGate (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_en, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity = true, bool en_polarity = true); RTLIL::Cell* addDffsrGate (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, @@ -1105,6 +1108,7 @@ public: RTLIL::SigBit Oai4Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_d); RTLIL::SigSpec Anyconst (RTLIL::IdString name, int width = 1); + RTLIL::SigSpec Anyseq (RTLIL::IdString name, int width = 1); RTLIL::SigSpec Initstate (RTLIL::IdString name); }; diff --git a/kernel/satgen.h b/kernel/satgen.h index 0a65b490..690f8e33 100644 --- a/kernel/satgen.h +++ b/kernel/satgen.h @@ -1293,7 +1293,7 @@ struct SatGen return true; } - if (timestep > 0 && (cell->type == "$dff" || cell->type == "$_DFF_N_" || cell->type == "$_DFF_P_")) + if (timestep > 0 && cell->type.in("$ff", "$dff", "$_FF_", "$_DFF_N_", "$_DFF_P_")) { if (timestep == 1) { @@ -1332,8 +1332,8 @@ struct SatGen if (model_undef) { - std::vector<int> undef_d = importUndefSigSpec(cell->getPort("\\D"), timestep-1); - std::vector<int> undef_q = importUndefSigSpec(cell->getPort("\\Q"), timestep); + std::vector<int> undef_d = importUndefSigSpec(cell->getPort("\\Y"), timestep-1); + std::vector<int> undef_q = importUndefSigSpec(cell->getPort("\\Y"), timestep); ez->assume(ez->vec_eq(undef_d, undef_q)); undefGating(q, qq, undef_q); @@ -1341,6 +1341,11 @@ struct SatGen return true; } + if (cell->type == "$anyseq") + { + return true; + } + if (cell->type == "$_BUF_" || cell->type == "$equiv") { std::vector<int> a = importDefSigSpec(cell->getPort("\\A"), timestep); diff --git a/kernel/yosys.h b/kernel/yosys.h index aab6b584..ae73146b 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -64,6 +64,7 @@ #include <string.h> #include <stdint.h> #include <stdio.h> +#include <limits.h> #ifndef _YOSYS_ # error It looks like you are trying to build Yosys without the config defines set. \ @@ -100,6 +101,10 @@ # endif #endif +#ifndef PATH_MAX +# define PATH_MAX 4096 +#endif + #define PRIVATE_NAMESPACE_BEGIN namespace { #define PRIVATE_NAMESPACE_END } #define YOSYS_NAMESPACE_BEGIN namespace Yosys { |