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

[ImportVerilog] Support Generate constructs #7243

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

angelzzzzz
Copy link
Contributor

Support loop generate constructs and conditional generate constructs.
Because genvar only exists in the declaration and the variable exists as a parameter in GenerateBlock, genvar can be skipped.

Comment on lines +389 to +392
for (const auto *member : genArrNode.entries) {
if (failed(member->asSymbol().visit(MemberVisitor(context, loc))))
return failure();
}
Copy link
Member

Choose a reason for hiding this comment

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

Oh interesting. Does Slang resolve generate statements in their side?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Slang will expand all structures as GenerateBlock, here is the JSON of two GenerateBlocks, we can figure out which will be generated by isUninstantiated:

{
  "name": "",
  "kind": "GenerateBlock",
  "addr": 110809374896152,
  "members": [
    {
      "name": "g3",
      "kind": "Variable",
      "addr": 110809374896280,
      "type": "int",
      "initializer": {
        "kind": "IntegerLiteral",
        "type": "int",
        "value": "2",
        "constant": "2"
      },
      "lifetime": "Static"
    }
  ],
  "constructIndex": 3,
  "isUninstantiated": false
},
{
  "name": "",
  "kind": "GenerateBlock",
  "addr": 110809374896624,
  "members": [
    {
      "name": "g3",
      "kind": "Variable",
      "addr": 110809374896752,
      "type": "int",
      "initializer": {
        "kind": "IntegerLiteral",
        "type": "int",
        "value": "3",
        "constant": "3"
      },
      "lifetime": "Static"
    }
  ],
  "constructIndex": 3,
  "isUninstantiated": true
}

Copy link
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@hailongSun2000 hailongSun2000 merged commit ce121a0 into llvm:main Jun 28, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants