No longer inherit the specific type, which involved some black magic.
Move to a more sane class hierarchy and base everything around the new
PyCDE type class hierarchy. Eventually, we'd like to have `Type` be the
root of the hierarchy, but inheriting from `mlir.ir.Type` makes the
transition less painful.
Enables using the standard python function overrides to both print more
reasonable type strings and avoid some of the `isinstance` switch-like
structures elsewhere. More of the latter to come.
The default git describe command will simply return the most recent
tag. We want the most recent tag prefixed with "pycde", otherwise we
might try to parse the version from the wrong tag.
Previously, a sub-path could be specified by encoding it in the name
of the attribute using a certain scheme. This is brittle and
non-standard. To make this more natural and robust, the sub-path is
added as a field of the attribute definition as a StringRef. It is not
required, in which case an empty StringRef can be used. The attribute
name for placement attributes is no longer used in any logic.
This refactors ExportQuartusTcl to use the hw::GlobalRefs and arrays
of hw::InnerRefAttrs directly. This greatly simplifies the
implementation, and removes the need for SwitchInstanceAttr. That
attribute will be fully removed in a follow up.
This replaces the use of msft::SwitchInstanceAttr on leaf entities
with a hw::GlobalRefOp. The global ref specifies the same path, using
an array of hw::InnerRefAttrs. It also has an attribute containing the
same placement information as the msft::SwitchInstanceAttr had.
This will simplify ExportQuartusTcl by letting it simply generate Tcl
referring to the hw::GlobalRefs. It will also make the placements
robust to changes in the instance hierarchy via the guarantees
provided by hw::GlobalRef's verifier and utilities for rebuilding
hw::GlobalRefs.
The "design partition" feature supports scenarios wherein the designer needs the RTL output module hierarchy to be different than the logical hierarchy they are designing. With this feature, they just create a design partition then "tag" various entities with it. Upon compilation, CIRCT will refactor the hierarchy to move the tagged entities into the specified target partition. The design partition _must_ be found in the module hierarchy above (or in the same module as) the tagged entities.
Partial progress towards #2365.
- Modeling in CIRCT and PyCDE
- Move entities in the same module as the partition
The comparator subclasses didn't subclass OpView when they should
have, which prevents them from being automatically wrapped with PyCDE
Values.
The create extension for ArrayConcat was simply missing.
This extends the Instance wrapper to wrap not just instances but also
registers. Additionally, in the Tcl export, this looks for registers,
adds them to the symbol cache, and uses their symbol names.
Users are now able to place CompRegOp when its innerSym attribute is
set. If they create a CompRegOp directly, the inner_sym must be passed
explicitly, but the `reg(...)` helper on Value is extended to use the
name as the inner_sym when passed.
The `obj_to_value` and `var_to_attribute` functions used to be publicly
exposed since they had to occasionally used by users. Now that we've
patched all the cases, "hide" them. Also rename to be more consistent
with each other.
This adds new `pycde.dialects` modules which can be imported instead
of their corresponding `circt.dialects` modules. All ops in the
`pycde.dialects` modules are enhanced to have their constructor
create a PyCDE Value. The `create` methods already work with PyCDE
Values as operands, because they generally call `support.get_value`,
which supports PyCDE Values through duck typing. Together, this means
that all PyCDE generators can uniformly work with Values, as long as
users import `pycde.dialects` and use those definitions.
This add the necessary Python binding boilerplate to create
PhysicalBounds and PhysicalRegionRef attributes. A new API is added to
System, which inserts a PhysicalRegion. A wrapper class for
PhysicalRegion allows creating a region, adding bounds, and getting a
reference attribute suitable for use with the add_attribute API.
Add an attribute to `msft.module` specifying the filename in which the
generated SystemVerilog should be placed. In PyCDE, use the module name
as the output filename.
The previous usage of environment variables and shell redirection
wouldn't work on Windows. Replace that with a command line argument
and --input-file respectively.
This was previously needed to get the LegalizeNames side-effects
before applying placements. Now that we apply placements and use
instance name symbols before LegalizeNames and ExportVerilog, it is
unnecessary.
Recent always_ff lowering changes now kick in for the compreg, and it
lowers to always_ff. Since that's the behavior we want, update the
test and lock it in.
This is the preferred way to output design collatoral. Closes
https://github.com/llvm/circt/issues/2068.
The ExportQuartusTcl pass is removed, and the functionality is moved
into LowerMSFTToHW. The pass now populates a SymbolCache of the things
we care about in the export, namely instances. It produces verbatim
ops containing the Tcl, which can then be emitted from ExportVerilog.
The old Python API to run the export is removed in favor of the new
approach. PyCDE now exports both System Verilog and Tcl using the
exportSplitVerilog API to output files into a directory.
The op is identical to hw.module.extern, but it can be referred to by
a msft.instance op. This adds a cleaner layering where PyCDE only
generates msft.module/msft.module.extern/msft.instance ops. Before, it
would generate msft.module/hw.module.extern, leading to a mix of
msft.instance/hw.instance for LowerMSFTToHW to consume. This change
introduces a clear contract for PyCDE's output: all module and
instance ops are from the MSFT dialect.
Some of the implementation is duplicated into MSFTOps.cpp from
HWOps.cpp, but refactoring is left as a future exercise, captured in
https://github.com/llvm/circt/issues/2107.
Previously, `circt.msft` contained the attributes and pysical design
functionality, and `circt.dialects.msft` contained the ops. To unify
things and avoid confusion, combine these into the
`circt.dialects.msft` Python namespace.
This removes the local part of the version, which includes a commit
hash. The commit hash is redundant since the number of commits since a
version is already included in the version string, and we don't
rewrite git history. The local part of the version isn't compatible
with package registries, so we remove it.
* Support a new CIRCT_EXTRA_CMAKE_ARGS environment variable to allow
CIs or users to add extra arguments to cmake.
* Set the --parallel option when building.
- Now that MSFT instances are symbols, we have to manually uniquify them.
- Legalize names is no longer a pass. Since it's a part of export verilog, run that instead 'cause code run after `run_passes` may rely on legal names.
- Update some of the tests.
These fix the broken PyCDE tests.
This adds two changes to PyCDE's setup.py to help build wheels in CI:
* Adds an optional CIRCT_DIRECTORY environment variable for CIs to
pass a path to the CIRCT root. This is needed, for example, when
building with cibuildwheel.
* Makes the path to LLVM relative to CIRCT, assuming the submodule is
used. This previously looked for an LLVM directory sibling to the
CIRCT directory, which puts an assumption on how LLVM is downloaded.
The submodule is the documented location, and if something else is
required, we can add an environment variable for that.
Adds a setter on the generator argument which sets the value of the output
port. Also provides a `set_all_ports` method for programatic access and easy
legacy conversion.
There are two advantages of this: (1) Symbolic port names vs. string port
names. (2) More importantly, exceptions are raised when the code tries to set an
output port value, which provides a traceback to the relevant line.
No functional changes. This PR simply renames DeviceDB to PlacementDB within the MSFT dialect. The "DeviceDB" name may be used in a future PR and live alongside the PlacementDB.
Keep all the raw CIRCT module ops in `pycde.System`. Enables the same PyCDE
modules to be used multiple Systems (theoretically, unsupported/untested for
now). It is also the only class which runs CIRCT passes, so it knows when to
invalidate the symbol cache. The symbol cache is the only data structure which
holds CIRCT module ops. Increases memory safety.
This is required by the yapf tool we use to enforce formatting. Switch
back to using bash syntax for this check. Also re-format a few spots
that slipped in while the check was broken. Fixes#1162.
This is a _massive_ refactor. There's still some rough edges, but it should be far simpler, more logical, and "safer" from MLIR operation memory perspective. This refactor does break the instance/appid features, which I'll fix later on. That test is marked XFAIL for the moment. This closes out #1755.