aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2020-06-09 12:41:02 +0000
committerGitHub <noreply@github.com>2020-06-09 12:41:02 +0000
commit9a2cf5e3db15218af9a5320a8ca1a7f190aa236b (patch)
treea185df7153771283b6b9afb17ad918bdea60adac /kernel
parent3dc32490e071f221481c7bae9285957565026d76 (diff)
parent98e108034561bb3a9276594ebef2f80da38748ad (diff)
downloadyosys-9a2cf5e3db15218af9a5320a8ca1a7f190aa236b.tar.gz
yosys-9a2cf5e3db15218af9a5320a8ca1a7f190aa236b.tar.bz2
yosys-9a2cf5e3db15218af9a5320a8ca1a7f190aa236b.zip
Merge pull request #2128 from whitequark/flatten-processes
flatten: accept processes
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rtlil.cc12
-rw-r--r--kernel/rtlil.h2
2 files changed, 12 insertions, 2 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index b876862c8..ef81cac01 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -1536,13 +1536,13 @@ void RTLIL::Module::cloneInto(RTLIL::Module *new_mod) const
new_mod->addWire(it.first, it.second);
for (auto &it : memories)
- new_mod->memories[it.first] = new RTLIL::Memory(*it.second);
+ new_mod->addMemory(it.first, it.second);
for (auto &it : cells_)
new_mod->addCell(it.first, it.second);
for (auto &it : processes)
- new_mod->processes[it.first] = it.second->clone();
+ new_mod->addProcess(it.first, it.second);
struct RewriteSigSpecWorker
{
@@ -1913,6 +1913,14 @@ RTLIL::Memory *RTLIL::Module::addMemory(RTLIL::IdString name, const RTLIL::Memor
return mem;
}
+RTLIL::Process *RTLIL::Module::addProcess(RTLIL::IdString name, const RTLIL::Process *other)
+{
+ RTLIL::Process *proc = other->clone();
+ proc->name = name;
+ processes[name] = proc;
+ return proc;
+}
+
#define DEF_METHOD(_func, _y_size, _type) \
RTLIL::Cell* RTLIL::Module::add ## _func(RTLIL::IdString name, const RTLIL::SigSpec &sig_a, const RTLIL::SigSpec &sig_y, bool is_signed, const std::string &src) { \
RTLIL::Cell *cell = addCell(name, _type); \
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index f751bdce4..f3dc3af68 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -1175,6 +1175,8 @@ public:
RTLIL::Memory *addMemory(RTLIL::IdString name, const RTLIL::Memory *other);
+ RTLIL::Process *addProcess(RTLIL::IdString name, const RTLIL::Process *other);
+
// The add* methods create a cell and return the created cell. All signals must exist in advance.
RTLIL::Cell* addNot (RTLIL::IdString name, const RTLIL::SigSpec &sig_a, const RTLIL::SigSpec &sig_y, bool is_signed = false, const std::string &src = "");