Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapcell: Add new command #4773

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

wrapcell: Add new command #4773

wants to merge 1 commit into from

Conversation

povik
Copy link
Member

@povik povik commented Nov 27, 2024

What are the reasons/motivation for this change?

Preserving arithmetic operator boundaries upto a backend tool requires putting them into a module of their own. This module must not be parametric, and should be given a human-readable name (so not the $paramod$... naming used by Yosys internally).

Combinations of techmap -extern, box_derive, chtype can be used for this but the sequencing grows awkward and requires custom techmap files.

Explain how this is achieved.

A new command let's you wrap selected internal cells into individual modules, with the name generated from a template by filling in parameter values.

E.g.

wrapcell -name MUL_{A_WIDTH}_{B_WIDTH}_{Y_WIDTH} t:$mul  # ignores signedness

std::optional<std::string> value = format(rule.value_fmt, cell->parameters);

if (!value)
log_error("Formatting error when processing cell '%s' in module '%s'\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this PR does currently works ok, but this pattern of log + log_error makes me wish for something like Result types in other languages. Ultimately what we want to do is return from format either a Result(formatted_string) or Error(msg) and if it's Error then return a Error(msg with pass-level context) from execute. This could kind of get it done, but there's no way to match on it, and std::variant is too annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants