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

[Bind2] Add support for compile guard around bind #1315

Merged
merged 15 commits into from
Sep 22, 2023

Conversation

rsetaluri
Copy link
Collaborator

Adds support for emitting ifdef around bind calls. The syntax for this is:

with m.compile_guard(...):
    m.bind2(...)

which emits MLIR like:

sv.ifdef ... {
  sv.bind ...
}
`ifdef ...
  bind ...
`endif

One important thing to note is that in the case of split verilog, the output file attribute annotation has to be applied up the compile guard stack, i.e. the sv.ifdef surrounding the sv.bind also needs the hw.OutputFileAttr attached.

@rsetaluri rsetaluri requested a review from leonardt August 31, 2023 16:29
@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2023

Codecov Report

Patch coverage: 96.26% and project coverage change: +0.04% 🎉

Comparison is base (2a34fa6) 85.95% compared to head (2c67370) 86.00%.

❗ Current head 2c67370 differs from pull request most recent head 93061b6. Consider uploading reports for the commit 93061b6 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1315      +/-   ##
==========================================
+ Coverage   85.95%   86.00%   +0.04%     
==========================================
  Files         169      170       +1     
  Lines       17727    17810      +83     
==========================================
+ Hits        15237    15317      +80     
- Misses       2490     2493       +3     
Files Changed Coverage Δ
magma/backend/mlir/mlir.py 94.62% <71.42%> (-0.94%) ⬇️
magma/common.py 92.73% <87.50%> (-0.22%) ⬇️
magma/backend/mlir/mlir_passes.py 95.23% <95.23%> (ø)
magma/backend/mlir/hardware_module.py 96.83% <100.00%> (+0.02%) ⬆️
magma/backend/mlir/sv.py 98.13% <100.00%> (+0.04%) ⬆️
magma/backend/mlir/translation_unit.py 93.33% <100.00%> (+0.31%) ⬆️
magma/bind2.py 95.94% <100.00%> (+0.56%) ⬆️
magma/compile_guard.py 94.24% <100.00%> (+1.08%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

magma/backend/mlir/hardware_module.py Outdated Show resolved Hide resolved
magma/backend/mlir/mlir.py Outdated Show resolved Hide resolved
magma/backend/mlir/mlir_passes.py Outdated Show resolved Hide resolved
magma/compile_guard.py Outdated Show resolved Hide resolved
@rsetaluri rsetaluri force-pushed the bind2-add-compile-guard branch from bbbf8ff to 93061b6 Compare September 21, 2023 15:26
@rsetaluri rsetaluri requested a review from leonardt September 21, 2023 15:29
@leonardt leonardt merged commit 07f4cb8 into master Sep 22, 2023
4 checks passed
@leonardt leonardt deleted the bind2-add-compile-guard branch September 22, 2023 19:51
rsetaluri added a commit that referenced this pull request Sep 22, 2023
Adds support for emitting `ifdef` around `bind` calls. The syntax for
this is:

```python
with m.compile_guard(...):
    m.bind2(...)
```

which emits MLIR like:

```MLIR
sv.ifdef ... {
  sv.bind ...
}
```

```Verilog
`ifdef ...
  bind ...
`endif
```
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.

3 participants