Implementing Custom Passes in Yosys for Module Integration and Signal Connection #4246
-
Hello Yosys Community, I am working on a synthesis toolchain project and am currently exploring the capabilities of Yosys for implementing custom synthesis passes. My objective is to integrate a custom module into my design through a Yosys pass and to establish specific signal connections between this module and other elements within the design. However, I am encountering difficulties in understanding how to effectively define and execute these custom passes within the Yosys framework. Could someone provide insights or examples on:
Thank you for your assistance and sharing your expertise! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
This document has an introduction to how to create your own pass: https://github.com/YosysHQ/yosys/blob/master/guidelines/GettingStarted To add a module, your pass can use the |
Beta Was this translation helpful? Give feedback.
-
Thanks for your thoughtful response! I'm currently trying - the RTLIL::Wire *a = module->addWire("\\a", 4);
a->port_input = true;
a->port_id = 1;
RTLIL::Wire *y = module->addWire("\\y", 4);
y->port_output = true;
y->port_id = 2; |
Beta Was this translation helpful? Give feedback.
-
Ah, yes, the perils of just going from memory... Your snippet is good, but it's enough to just set |
Beta Was this translation helpful? Give feedback.
-
Sorry for the delay in replying. I was able to create the desired path! Thank you for your kind support! |
Beta Was this translation helpful? Give feedback.
This document has an introduction to how to create your own pass: https://github.com/YosysHQ/yosys/blob/master/guidelines/GettingStarted
To add a module, your pass can use the
design->addModule(ID(your_custom_module_name))
function, and thenmodule->addPort()
,module->addWire()
, and all themodule->addXXX()
for internal cells to construct the module contents. To instantiate the module inside another existing module, you find the module you want usingdesign->module(ID(module_name))
, then usemodule->addCell(ID(your_custom_module_name))
to instantiate the custom module. Then you can usecell->setPort()
to connect it to wires within the existing module. If you need to add new ports to exist…