- Got an integration test which wasn't running working.
- Fixed a pybind11_stubgen error.
- Fixed an AppID constructor warning.
- Mitigated a poor hash function.
Add a poll method to ports, a master poll method to the Accelerator, and the ability to poll from the service thread. Also, only spin up the service thread if it's requested.
The service thread polling (in particular) required some ownership changes: Accelerator objects now belong to the AcceleratorConnection so that the ports aren't destructed before the service thread gets shutdown (which causes an invalid memory access). This particular binding isn't ideal, is brittle, and will be an issue for anything doing the polling. Resolving #7457 should mitigate this issue.
Backends are now _required_ to call `disconnect` in their destructor.
Add more utilities to help with resizing `FVInt`s, including
- counting the active bits for signed and unsigned interpretation
- truncation
- zero/sign extension
Also add a default constructor that produces a zero-bit zero value,
allow `FVInt`s to be hashed, and consider bit width for equality
comparisons.
Printing of `FVInt`s would continuously shift the value right by the
log2 of the radix. This triggers an assertion in `APInt` in the case
where the bit width is less than the number of bits being shifted.
Precompute a symbol to layer mapping inside LowerLayers and uses this
instead of a symbol table. This is both faster and avoids problems of
trying to compute a symbol table while modules may be created.
Repurpose the functions that were being used to create macro declarations
to also compute this symbol to layer mapping. Rename these to indicate
that they are now doing generic layer preprocessing.
Fixes#7434.
h/t @youngar for the fix suggestion.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Practically it is very useful to verify equivalence between modules in two different MLIR files. This commit changes `inputFilename` to a list and implements a very simple module merge that moves operations in the second module to the first by resolving the symbol.
This PR adds an option `--shared-libs` to load shared lib in the JIT engine in a similar way to what circt-lec does for loading z3 shared lib. With this change DPI library could be linked in arcilator.
This PR implements initial support for lowering Sim DPI operations to Arc.
* sim::LowerDPIFuncPass implements lowering from `sim.dpi.func` to `func.func` that respects C-level ABI.
* arc::LowerStatePass is modified to allocate states and call functions for `sim.dpi.call` op.
Currently unclocked call is not supported yet.
The ibis.design op will be removed after the IbisContainersToHW pass, and there may be ibis.component's inside the design that have the same name as the design; we want that name to persist, and not be falsely considered a duplicate.
Co-authored-by: Morten Borup Petersen <mpetersen@microsoft.com>
* [Support] Allow erasing names in Namespace
Allowing erasing names in a namespace seems more sane than micro-managing which names gets added to a namespace. E.g., it's convenient to use `Namespace::add(SymbolCache &` to efficiently prime a namespace, and then surgically removing some known identifier,, instead of having to re-implement how symbols are added to the namespace.
* Add lock
---------
Co-authored-by: Morten Borup Petersen <mpetersen@microsoft.com>
Slang compiler relies on the third-party libraries like unordered_dense and fmt
library. The fmt library provides two ways to integrated it:
1.Headers-only
2.Seperately compiled
The main purpose of this commit is to avoid installation failure of CIRCT project due
to finding fmt header file in wrong path which is in circt `include` directory when
CMake_slang_Frontend_enabled is turned on. We hope to not install header files coming
from fmt library.
Instead of using the SCF dialect and its `scf.if` and `scf.while`
operations for control flow, switch over to the CF dialect and its
`cf.br` and `cf.cond_br`. This allows us to support SystemVerilog's
`continue`, `break`, and `return` statements which don't map well to the
Structured Control Flow dialect.
BoolAttr's are IntegerAttr's, check them first.
IntegerAttr's that happen to have the characteristics of
BoolAttr will accordingly become Python boolean values.
Unclear where these come from but we do lower booleans
to MLIR bool constants so make sure to handle that.
Add test for object model IR with bool constants.
Add the `FVInt` class to CIRCT's support library. This class can
represent arbitrary precision integers where each bit can be one of the
four values 0, 1, X, and Z. The name intends to suggest a *four-valued
APInt*, with the option to also introduce a *nine-valued NVInt* in the
future.
Internally, `FVInt` uses two `APInt`s to store its data: `value` stores
whether a bit is 0/X or 1/Z, and `unknown` stores whether a bit is known
(0 or 1) or unknown (X or Z). Together they allocate 2 bits of storage
for each of the `FVInt`'s digits, which allows for four different values
per digit. This representation as `value` and `unknown` makes many of
the logical and arithmetic operations pretty straightforward to
implement. Most four-valued operations can be trivially implemented by
performing the equivalent two-valued operation on `value`, and then
accounting for X and Z bits through a few logic operations on `unknown`.
Note that Slang defines its own version of this (`SVInt`). But since
Slang is an optional dependency of CIRCT, it makes sense to have a CIRCT
equivalent that is built around LLVM's `APInt`, for use in our dialects.
This first version of `FVInt` has a rather incomplete set of operations,
but it covers basic AND, OR, XOR, NOT, negation, addition, subtraction,
and multiplication as a proof-of-concept. The remaining operations will
be added in future commits. We are also going to need a four-valued
equivalent of `IntegerAttr` based on `FVInt`.
This commit is motivated by the Slang frontend, which now supports
enough of SystemVerilog to make some test designs start to hit the lack
of number literals with X and Z.
Previously a FIRRTL vector was lowered into a packed array and there was no way
to generate an open array. This PR changes to use unpacked open array which is
supported by several tools (at least verilator and vcs) by default.
Fix an issue in the mapping of the logical `&&`, `||`, `->`, and `<->`
operators, where the left and right-hand side could have different value
domains in the AST (one `logic`, one `bit`).
Similarly, fix an issue with the `?:` ternary operator where the true
and false expressions could have different but cast-compatible types.
Add a missing conversion for OM to Python conversion where only OM
integers and not arbitrary MLIR integers would be converted to Python.
This could result in failures in Python scripts that needed to consume OM.
This fixes a bug introduced in: 17c036f87c
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add support for assignment patterns like `'{42, 9001}` in rvalue
position. These are roughly SystemVerilog's equivalent of
`struct_create` and `array_create`. This commit also adds an
`array_create` op to support assignment patterns for arrays.
If circt-verilog is run in lint-only mode, actually make the tool exit
out after the initial parsing through Slang. All diagnostics have been
reported at that point, and we can just exit out without bothering with
any IR modifications.
Also refactor the way circt-verilog populates its pass pipeline a bit.
Ignore type parameter AST nodes since these are already handled during
Slang's type checking pass. Also tweak the diagnostics on unsupported
SV constructs to be a bit more descriptive.
Add missing conversions for cases where the Slang AST has expressions
operating directly on packed structs/arrays, but the Moore IR expects
a conversion to a simple bit vector type.
Also clean up a few things and remove an invalid `struct_inject`
conversion.
Primary change is to only generate and populate mappings for
sources of values, and not each value themselves.
Values are identified using these base numberings plus an appropriate
offset.
The main benefit of this is to greatly reduce the number of entries in the
`indices` map.
When handling operations with many block arguments (module-like's with many
ports) or with many results (instances of those module-like's) this greatly
reduces the pressure on the `indices` map. For these designs, dedup now runs
dramatically faster and uses significantly less memory.
Also separates location of the value impl, such that if a Value's impl is storage
inline into an Operation or Block such that there is aliasing, the two
are given different numbers (and especially the numbering isn't changed).
On a synthetic design containing a module with 2^20 ports and 256 instances of
that module, this is the difference between completing in 20s and OOM'ing on my
machine after running for 30 minutes.
Functional changes:
Fixes#7415.
Fixes#7416.
Also fixes deduping if block arg types are different (but unused).
This is done by hashing block count, and each block's numbering between
as well as the types of its arguments before that block's operations.
Additionally fixes use of numberings (indices) before it was
populated where attribute processing for inner symbol ports
hashed using the block argument's numbering before it was populated.
Internally, primitive OM EvaluatorValues are represented as
TypedAttributes. This is great internally, but when we pass these from
C++ out to Python, we have to use a very inefficient method to pull
the Python value out of the attribute.
This updates how primitives are handled at the Python <> C++ interface
to directly construct the appropriate Python values and return
them. Similarly, for top-level inputs to the Evaluator, Python values
are directly accepted and converted to Attributes internally.
On large designs, this was shown to decrease single threaded CPU time
to process large amounts of OM data by roughly 70%. There is no
difference in the output.
This adds a default layer specialization mode attribute to the FIRRTL
CircuitOp. This will be used by the layer specialization pass to
specialize layers that were not explitly enabled or disabled.
Rework the Moore dialect operations that manipulate struct values. These
are intended to operate on `StructType` and `UnpackedStructType` values
directly, but were defined in ODS as operating on references to structs.
This was likely a hold-over from early development where we were still
figuring out the distinction between ref types and value types in SV.
This commit adjusts the struct ops such that they actually operate on
struct values instead of references to structs. It also moves more
operand constraints into ODS and simplifies the op verifiers by
factoring out some common code into helper functions.
Enhance the `struct_inject` canonicalizer to also consider
`struct_create` operations as part of the inject chain. This allows an
initial `struct_create` that is modified by a subsequent inject to be
canonicalized into a new `struct_create` with updated values.
Add missing basic and error tests for the struct-related ops, and
simplify the variable destructuring test by removing unrelated
operations.
Also fixes an issue in variable op destructuring where a variable with
initial value would have its initial value discarded during
destructuring. Initial values now prevent destructuring. Alternatively,
we may choose to insert appropriate `struct_extract` ops to destructure
the initial value in the future.
This PR proposes a new set of ops aimed at enabling the use of formal contracts to abstract away module instances during verification.
There is still some work needed to handle these ops in PrepareForFormal, which will be done in a later PR.