3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-24 01:25:33 +00:00
This commit is contained in:
Emil J. Tywoniak 2024-06-14 17:26:48 +02:00
parent eeb15ea2a2
commit 65d50db4ef
13 changed files with 74 additions and 67 deletions

View file

@ -314,9 +314,6 @@ void Pass::call(RTLIL::Design *design, std::vector<std::string> args)
size_t orig_sel_stack_pos = design->selection_stack.size();
auto state = pass_register[args[0]]->pre_execute();
ZoneScopedN(pass_name.c_str());
// ZoneText(pass_name.c_str(), pass_name.length());
ZoneColor((uint32_t)(size_t)pass_name.c_str());
pass_register[args[0]]->execute(args, design);
pass_register[args[0]]->post_execute(state);
while (design->selection_stack.size() > orig_sel_stack_pos)

View file

@ -2428,26 +2428,29 @@ RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, RTLIL::IdString type)
{
RTLIL::Cell *cell = new RTLIL::Cell;
// std::cout << "alloc " << (long long)cell << " called " << cell->name.c_str() << "\n";
cell->module = this;
cell->name = name;
cell->type = type;
if (RTLIL::Cell::is_legacy_type(type)) {
auto legOldCell = new RTLIL::OldCell;
legOldCell->name = name;
legOldCell->type = type;
std::cout << "new RTLIL::OldCell\n";
cell->legacy = new RTLIL::OldCell;
cell->legacy->name = name;
cell->legacy->type = type;
}
add(cell);
return cell;
}
// TODO ? brokey
// RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, const RTLIL::OldCell *other)
// {
// RTLIL::Cell *cell = addCell(name, other->type);
// cell->connections_ = other->connections_;
// cell->parameters = other->parameters;
// cell->attributes = other->attributes;
// return cell;
// }
RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, const RTLIL::Cell *other)
{
RTLIL::Cell *cell = addCell(name, other->type);
cell->module = this;
cell->connections_ = other->connections_;
cell->parameters = other->parameters;
cell->attributes = other->attributes;
add(cell);
return cell;
}
RTLIL::Memory *RTLIL::Module::addMemory(RTLIL::IdString name, const RTLIL::Memory *other)
{
@ -2493,9 +2496,9 @@ RTLIL::Process *RTLIL::Module::addProcess(RTLIL::IdString name, const RTLIL::Pro
add ## _func(name, sig_a, sig_y, is_signed, src); \
return sig_y; \
}
// DEF_METHOD(Not, sig_a.size(), ID($not))
// DEF_METHOD(Pos, sig_a.size(), ID($pos))
// DEF_METHOD(Neg, sig_a.size(), ID($neg))
DEF_METHOD(Not, sig_a.size(), ID($not))
DEF_METHOD(Pos, sig_a.size(), ID($pos))
DEF_METHOD(Neg, sig_a.size(), ID($neg))
DEF_METHOD(ReduceAnd, 1, ID($reduce_and))
DEF_METHOD(ReduceOr, 1, ID($reduce_or))
DEF_METHOD(ReduceXor, 1, ID($reduce_xor))

View file

@ -1776,13 +1776,13 @@ public:
throw std::out_of_range("FakeParams::size()");
}
}
bool empty() {
bool empty() const {
return !size();
}
// The need for this function implies setPort will be used on incompat types
void erase(const RTLIL::IdString& paramname) { (void)paramname; }
void erase(const RTLIL::IdString& paramname) const { (void)paramname; }
// The need for this function implies setPort will be used on incompat types
void clear() {}
void clear() const {}
// AAA
class iterator {
typedef std::bidirectional_iterator_tag iterator_category;
@ -1821,8 +1821,8 @@ public:
throw std::out_of_range("FakeParams::iterator::operator*()");
}
}
// std::pair<IdString, Const&> operator->() { return operator*(); }
// const std::pair<IdString, Const&> operator->() const { return operator*(); }
std::pair<IdString, Const&> operator->() { return operator*(); }
const std::pair<IdString, Const&> operator->() const { return operator*(); }
const std::pair<IdString, Const&> operator*() const {
if (parent->is_legacy()) {
auto it = parent->legacy->parameters.begin();
@ -1901,6 +1901,8 @@ public:
throw std::out_of_range("FakeParams::const_iterator::operator*() const");
}
}
std::pair<IdString, Const&> operator->() { return operator*(); }
const std::pair<IdString, Const&> operator->() const { return operator*(); }
};
const_iterator begin() const {
return const_iterator(parent, 0);
@ -1926,7 +1928,7 @@ public:
};
struct FakeConns {
RTLIL::Cell* parent;
RTLIL::SigSpec at(RTLIL::IdString name) {
RTLIL::SigSpec& at(RTLIL::IdString name) {
return parent->getMutPort(name);
}
const RTLIL::SigSpec& at(RTLIL::IdString name) const {
@ -2021,8 +2023,8 @@ public:
// The need for this function implies setPort will be used on incompat types
void erase(const RTLIL::IdString& portname) { (void)portname; }
// The need for this function implies setPort will be used on incompat types
void clear() {}
bool empty() {
void clear() const {}
bool empty() const {
return !size();
}
// AAA
@ -2064,8 +2066,8 @@ public:
throw std::out_of_range("FakeConns::iterator::operator*()");
}
}
// std::pair<IdString, SigSpec&> operator->() { return operator*(); }
// const std::pair<IdString, SigSpec&> operator->() const { return operator*(); }
std::pair<IdString, SigSpec&> operator->() { return operator*(); }
const std::pair<IdString, SigSpec&> operator->() const { return operator*(); }
const std::pair<IdString, SigSpec&> operator*() const {
if (parent->is_legacy()) {
auto it = parent->legacy->connections_.begin();
@ -2145,6 +2147,8 @@ public:
throw std::out_of_range("FakeConns::const_iterator::operator*() const");
}
}
std::pair<IdString, SigSpec&> operator->() { return operator*(); }
const std::pair<IdString, SigSpec&> operator->() const { return operator*(); }
};
const_iterator begin() const {
return const_iterator(parent, 0);
@ -2175,7 +2179,7 @@ public:
// Canonical tag
bool is_legacy() const {
return has_attrs || is_legacy_type(type);
return is_legacy_type(type);
};
bool has_memid() { return is_legacy() && legacy->has_memid(); }
@ -2186,7 +2190,7 @@ public:
}
// TODO stub
void set_src_attribute(const std::string &src) { (void)src; };
bool known () {
bool known () const {
return is_legacy() ? legacy->known() : true;
}
bool input(const RTLIL::IdString &portname) const {
@ -2220,7 +2224,7 @@ public:
// TODO is this reasonable at all?
const RTLIL::SigSpec &getPort(const RTLIL::IdString &portname) const;
RTLIL::SigSpec &getMutPort(const RTLIL::IdString &portname);
bool hasPort(const RTLIL::IdString &portname) {
bool hasPort(const RTLIL::IdString &portname) const {
return connections_.count(portname);
}
// The need for this function implies setPort will be used on incompat types
@ -2229,7 +2233,7 @@ public:
// TODO is this reasonable at all?
const RTLIL::Const& getParam(const RTLIL::IdString &paramname) const;
RTLIL::Const& getMutParam(const RTLIL::IdString &paramname);
bool hasParam(const RTLIL::IdString &paramname) {
bool hasParam(const RTLIL::IdString &paramname) const {
return parameters.count(paramname);
}
// The need for this function implies setPort will be used on incompat types