Keeping module parameters as variables, so they become BTOR2 input
s
#3531
-
Hi all! Love Yosys -- this is a really impressive project that has sped along my current research in so many ways (synthesis for various backends, compilation to Verilog via the JSON format...). So thank you! My goal: to compile Verilog modules to BTOR2, with both module parameters and ports becoming BTOR2 Current status: Module ports become BTOR2 My understanding of why this happens:
It seems like the fix to my issue lies not in step 2 (the Verilog->BTOR2 compiler) but instead in step 1 (the Verilog importer for Yosys). This makes the problem a lot more daunting! So I have a few questions.
Thanks everyone! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi! I'm afraid with the current intermediate representation this is not possible in the general case. The problem is that parameters are usually used to affect not just the values of some signals, but the geometry of the design itself. A very common use is for the width of the signals - but in the RTLIL netlist (and in the BTOR2 format iirc), the width cannot be symbolic, it has to be a concrete value. Even worse for parameters that are used in generate statements, and can affect the existence and/or number and/or connectivity of many cells in the netlist. RTLIL can only represent a concrete netlist, which is why the frontend resolves all parameters to constants when you import the design. What you propose could only work in the very limited context where parameters are used to specify some constants used in value assignments in the design, and in that case I think a verilog-to-verilog rewriter based on a parser with a better AST than Yosys would be an easier tool for the job! |
Beta Was this translation helpful? Give feedback.
Hi! I'm afraid with the current intermediate representation this is not possible in the general case. The problem is that parameters are usually used to affect not just the values of some signals, but the geometry of the design itself. A very common use is for the width of the signals - but in the RTLIL netlist (and in the BTOR2 format iirc), the width cannot be symbolic, it has to be a concrete value. Even worse for parameters that are used in generate statements, and can affect the existence and/or number and/or connectivity of many cells in the netlist. RTLIL can only represent a concrete netlist, which is why the frontend resolves all parameters to constants when you import the design…