Commit b26c580
Moritz Scherer
[ImportVerilog] Add support for string materialization and typed ret
This patch extends the ImportVerilog conversion to handle SystemVerilog string constants and improves function return handling.
- **String literal support**
- Added `Context::materializeString` to convert Slang string constants into `moore.format_literal` ops.
- Integrated string materialization into `Context::materializeConstant`, enabling automatic lowering of string constant values.
- **Typed return conversion**
- Updated `StmtVisitor::visit(ReturnStatement)` to infer the enclosing function’s return type.
- When known, the return expression is converted using the expected type, ensuring proper type consistency for function returns.
- Added `testStrLiteralReturn` to `basic.sv` verifying:
- Emission of `moore.fmt.literal` for string literals.
- Proper conversion and return of string-typed values.1 parent 8c321f9 commit b26c580
File tree
4 files changed
+40
-0
lines changed- include/circt/Dialect/Moore
- lib/Conversion/ImportVerilog
- test/Conversion/ImportVerilog
4 files changed
+40
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
574 | 589 | | |
575 | 590 | | |
576 | 591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1578 | 1578 | | |
1579 | 1579 | | |
1580 | 1580 | | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
1581 | 1592 | | |
1582 | 1593 | | |
1583 | 1594 | | |
| |||
1660 | 1671 | | |
1661 | 1672 | | |
1662 | 1673 | | |
| 1674 | + | |
| 1675 | + | |
1663 | 1676 | | |
1664 | 1677 | | |
1665 | 1678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3381 | 3381 | | |
3382 | 3382 | | |
3383 | 3383 | | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
0 commit comments