Skip to content

Commit f9ab6e1

Browse files
committed
mem: only import attributes from ports if the memory doesn't have them yet
1 parent 080da69 commit f9ab6e1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

kernel/mem.cc

+6-3
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ void Mem::emit() {
149149
wr_port_xlat.push_back(i);
150150
for (auto &port : rd_ports) {
151151
for (auto attr: port.attributes)
152-
cell->attributes.insert(attr);
152+
if (!cell->has_attribute(attr.first))
153+
cell->attributes.insert(attr);
153154
if (port.cell) {
154155
module->remove(port.cell);
155156
port.cell = nullptr;
@@ -213,7 +214,8 @@ void Mem::emit() {
213214
cell->setPort(ID::RD_DATA, rd_data);
214215
for (auto &port : wr_ports) {
215216
for (auto attr: port.attributes)
216-
cell->attributes.insert(attr);
217+
if (!cell->has_attribute(attr.first))
218+
cell->attributes.insert(attr);
217219
if (port.cell) {
218220
module->remove(port.cell);
219221
port.cell = nullptr;
@@ -251,7 +253,8 @@ void Mem::emit() {
251253
cell->setPort(ID::WR_DATA, wr_data);
252254
for (auto &init : inits) {
253255
for (auto attr: init.attributes)
254-
cell->attributes.insert(attr);
256+
if (!cell->has_attribute(attr.first))
257+
cell->attributes.insert(attr);
255258
if (init.cell) {
256259
module->remove(init.cell);
257260
init.cell = nullptr;

0 commit comments

Comments
 (0)