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

Is there a plan to implent moore in c++? #233

Closed
hunterzju opened this issue Nov 12, 2021 · 2 comments
Closed

Is there a plan to implent moore in c++? #233

hunterzju opened this issue Nov 12, 2021 · 2 comments

Comments

@hunterzju
Copy link

Excellent work! And I wonder if there is a plan to transform it to c++ implentation? Or how to do such a work?

@fabianschuiki
Copy link
Owner

Thanks @hunterzju! LLHD is slowly but steadily moving into the CIRCT project, where it will enjoy an awesome community and be useful to a larger group of people. I am planning to migrate Moore over to use the LLHD implementation in CIRCT instead of the llhd crate, by linking directly to CIRCT (see the mlir branch which has some initial work). If that goes well, my ultimate long-term plan is to start moving the Moore-internal IRs (AST, RST, HIR, MIR) over to an MLIR-based implementation in CIRCT, possibly up to a complete replacement with MLIR/C++. There are a few things in how Moore/SV have to deal with nodes in the IR (everything is on-demand and cannot be pass-based) which require some attention on the MLIR side, but there's nothing preventing this.

Long story short, the ideal way forward would be:

  • Link against CIRCT and directly emit LLHD using CIRCT
  • Move codegen from Rust over to C++, which requires implementing the Moore MIR dialect in MLIR, and the SV type system
  • Move type checking over to CIRCT, which requires implementing the Moore HIR dialect (or something similar) in MLIR
  • Move name and syntactic ambiguity resolution over to CIRCT, which requires implementing the AST/RST in CIRCT
  • Move parsing over to CIRCT (I would love to use a Pika parser for this, generated from a grammar file, with human guidance on how to resolve/represent ambiguities -- it makes no sense to handwrite all that SV because it becomes hard to adapt/troubleshoot, but human guidance is required because the grammar is so abysmally ambiguous)
  • At this point Moore would be pretty much a pure MLIR implementation

@fabianschuiki fabianschuiki pinned this issue Nov 12, 2021
@hunterzju
Copy link
Author

Thanks @hunterzju! LLHD is slowly but steadily moving into the CIRCT project, where it will enjoy an awesome community and be useful to a larger group of people. I am planning to migrate Moore over to use the LLHD implementation in CIRCT instead of the llhd crate, by linking directly to CIRCT (see the mlir branch which has some initial work). If that goes well, my ultimate long-term plan is to start moving the Moore-internal IRs (AST, RST, HIR, MIR) over to an MLIR-based implementation in CIRCT, possibly up to a complete replacement with MLIR/C++. There are a few things in how Moore/SV have to deal with nodes in the IR (everything is on-demand and cannot be pass-based) which require some attention on the MLIR side, but there's nothing preventing this.

Long story short, the ideal way forward would be:

  • Link against CIRCT and directly emit LLHD using CIRCT
  • Move codegen from Rust over to C++, which requires implementing the Moore MIR dialect in MLIR, and the SV type system
  • Move type checking over to CIRCT, which requires implementing the Moore HIR dialect (or something similar) in MLIR
  • Move name and syntactic ambiguity resolution over to CIRCT, which requires implementing the AST/RST in CIRCT
  • Move parsing over to CIRCT (I would love to use a Pika parser for this, generated from a grammar file, with human guidance on how to resolve/represent ambiguities -- it makes no sense to handwrite all that SV because it becomes hard to adapt/troubleshoot, but human guidance is required because the grammar is so abysmally ambiguous)
  • At this point Moore would be pretty much a pure MLIR implementation

Thanks for your reply, I am a newbie in LLVM, but interesting in the work. I'll learn it and see if I can do something. Thanks again.

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

No branches or pull requests

2 participants