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