Add a `circt-capi` target that depends on all C API libraries. Introduce
a new `add_circt_public_c_api_library` CMake function that wraps around
the MLIR equivalent, but also adds a dependency from `circt-capi`. Make
at least the short integration tests CI job build the `circt-capi`
target to ensure it has a bit of CI coverage.
This PR ads MLIR pass plugin functionality to firtool pipeline to dynamically load pass plugins and execute passes.
`*.so` file is load with`--load-pass-plugin` option. Currently we can insert passes to 4 places in the pipeline: (1) after FIRRTL parsing (2) before LowerToHW (3) after HW lowering (4) after SV lowering.
This moves most of the circt-lec code into a CIRCT library. No existing library directories seemed appropriate, hence the addition of the Verification directories.
---------
Co-authored-by: frog-in-the-well <106834163+frog-in-the-well@users.noreply.github.com>
This PR adds a functionality to include build information in output files.
The format of the version string is `<releases tag name>-
<how many commits since the tag>-g(means git)<current commit hash>[-dirty]`
Two cmake flags are added to control version strings,
`CIRCT_RELEASE_TAG_ENABLED` (default is On) and
`CIRCT_RELEASE_TAG` (default is `circtorg`).
If `CIRCT_RELEASE_TAG_ENABLED` is false, the version string becomes
"unknown" and cmake script is ran only at the first cmake configuration. Example,
```
$ cmake .. -DCIRCT_RELEASE_TAG=pycde
// Generated by CIRCT pycde-0.0.5-28-ge846cf26e
module Bar(
$ cmake .. -DCIRCT_RELEASE_TAG=sifive
// Generated by CIRCT sifive/0/9/0-31-ge846cf26e
module Bar(
$ cmake .. -DCIRCT_RELEASE_TAG_ENABLED=Off
// Generated by CIRCT unknown git version
```
Co-authored-by: Hideto Ueno <uenoku.tokotoko@gmail.com>
Changes:
- Add `return failure()` where necessary now that `ParseResult` has
gained the `LLVM_NODISCARD` attribute.
- Adapt to new MLIR type alias syntax (no longer needs "type"), e.g.
`!foo = !hw.struct ...` instead of `!foo = type !hw.struct ...`
- Adapt to new attribute self-type parsing. Attributes now derive the
self-type from syntax like `#attr : !hw.some_type`. No longer need
an explicit type param `<T>` in stuff like `#firrtl.invalidvalue<T>`.
- Improve `add_circt_doc` to allow for multiple tablegen parameters and
add `add_circt_dialect_doc` to unify the way dialect documentation is
generated. The latter also passes the `-dialect` option to tablegen to
sort out issues in the generated documentation if a dialect
transitively includes another dialect. (This used to show up as
multiple doc files having the name of another dialect.)
- Add `let useDefaultTypePrinterParser = 1` and
`let useDefaultAttributePrinterParser = 1` to the dialect definitions
where appropriate, since these have become off-by-default upstream.
Ensure that during installation we produce a `CIRCTTargets.cmake` file
to allow out-of-tree users to link against CIRCT more easily. This
requires adding an `install(TARGETS ...)` command to
`add_circt_library_install`, and an `install(EXPORT CIRCTTargets ...)`
to `cmake/modules/CMakeLists.txt`.
Update the `cmake/modules/CMakeLists.txt` file and friends such that the
config file also includes the `CIRCT_TOOLS_BINARY_DIR` variable, and the
generation of that file resembles that in MLIR more closely. This should
make it easier in the future to use some of LLVM's cmake utilities.
Add the `CIRCTConfig.cmake` and `AddCIRCT.cmake` files to the list of
installed files. This mimics the behaviour implemented in MLIR, and
allows for CIRCT to be used out of tree (e.g. as part of the Moore
compiler, among other things).
Generally speaking, this should allow
cake -DCIRCT_DIR="<something>/lib/cmake/circt" myprojectdirectory, where <something> is
either a build or install area. Then in your project cmake file you can have:
find_package(CIRCT REQUIRED CONFIG)
This also updates the README to include some building information.
Lots of caveats:
- This is all experimental
- The actual tool isn't interesting yet.
- The naming is arbitrary and will likely change.
- Much of the cmake files were cargo culted from other places
because I don't know what I'm doing.