yosys/passes/memory/memory_collect.cc

56 lines
1.8 KiB
C++
Raw Permalink Normal View History

2013-01-05 11:13:26 +01:00
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
2015-07-02 11:14:30 +02:00
*
2013-01-05 11:13:26 +01:00
* 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.
2015-07-02 11:14:30 +02:00
*
2013-01-05 11:13:26 +01:00
* 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.
*
*/
#include "kernel/yosys.h"
2020-10-17 22:20:24 +02:00
#include "kernel/mem.h"
2013-01-05 11:13:26 +01:00
2014-09-27 16:17:53 +02:00
USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN
2013-01-05 11:13:26 +01:00
struct MemoryCollectPass : public Pass {
2013-03-01 10:17:35 +01:00
MemoryCollectPass() : Pass("memory_collect", "creating multi-port memory cells") { }
2020-06-19 01:34:52 +02:00
void help() override
2013-03-01 10:17:35 +01:00
{
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n");
log(" memory_collect [selection]\n");
log("\n");
log("This pass collects memories and memory ports and creates generic multiport\n");
log("memory cells.\n");
log("\n");
}
2020-06-19 01:34:52 +02:00
void execute(std::vector<std::string> args, RTLIL::Design *design) override {
2016-04-21 23:28:37 +02:00
log_header(design, "Executing MEMORY_COLLECT pass (generating $mem cells).\n");
2013-01-05 11:13:26 +01:00
extra_args(args, 1, design);
2020-10-17 22:20:24 +02:00
for (auto module : design->selected_modules()) {
if (module->has_processes_warn())
continue;
2020-10-17 22:20:24 +02:00
for (auto &mem : Mem::get_selected_memories(module)) {
if (!mem.packed) {
mem.packed = true;
mem.emit();
}
}
}
2013-01-05 11:13:26 +01:00
}
} MemoryCollectPass;
2015-07-02 11:14:30 +02:00
2014-09-27 16:17:53 +02:00
PRIVATE_NAMESPACE_END