Commit Graph

2991 Commits

Author SHA1 Message Date
Andrew Lenharth 76cda20533 [NFC] Rename confusing api.
.get() on a type should construct a new type.  BaseAlias was using this function to ALSO return the wrapped type.  Rename the accessor to not conflict with the factory.
2024-01-24 16:14:08 -06:00
Nandor Licker be15910448
[Seq] Add a representation for clock inverters (#6575) 2024-01-22 20:45:56 +02:00
Andrew Lenharth 2a809a3565 [FIRRTL] Make the Field Source analysis more robust to newer ops 2024-01-22 11:55:31 -06:00
Fabian Schuiki ce274399ee
[FIRRTL] Create debug info scopes for inlined modules (#6512)
When inlining and flattening FIRRTL instances, create `dbg.scope`
operations to track information about the original hierarchy in the
debug info.

To do this, the FIRRTL inliner now creates a `dbg.scope` op for every
inlined instance. When renaming the operations in the inlined module's
body, debug operations are assigned this scope (unless they already had
a scope assigned). This retains information about the original
hierarchy.

Unfortunately, this approach currently only works for debug variables
and scopes. Instances have no `scope` operand where a parent scope can
be annotated. As a result, instance ops whose parent module got inlined
do not properly track their original scope. This limitation will go away
in the future once we are either able to interact with and modify the
implicit scope created by instances, or instances scopes get passed in
as explicit operands.
2024-01-22 08:57:45 -08:00
Megan Wachs 28d430dd25
bump llvm submodule to tip of main (103fa3250c46) (#6589) 2024-01-19 09:45:35 -06:00
Sprite 7b7134c4fd [FIRRTL][CAPI] Expose `foldFlow` function 2024-01-18 08:35:52 +08:00
John Demme 9af79e2f66
[ESI] Lower manifest op to a ROM (#6585)
Since ESI hardware embeds the manifest, lower the zlib-compressed version of it to a module to be instantiated by a BSP.
2024-01-16 22:47:12 -08:00
John Demme c2d9d36aec
[ESI] Introduce MMIO std service (#6584)
Currently, can only request a single 32-bit register. In the future,
we'll add the ability to request structs of config/status registers.
2024-01-16 21:34:35 -08:00
Bea Healy 05d0886671
Update FSMToSV summary (#6580) 2024-01-15 17:03:54 +00:00
Schuyler Eldridge fe27e456b9
[FIRRTL] Add Layer Association to Probes
Add support for representing an optional layer in each probe type.  This
only handles storage and MLIR printing/parsing.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-01-12 15:30:09 -05:00
Andrew Lenharth 7cdf3fc71c
[NFC] Convert getPortAttributes back to ArrayRef (#6531)
Several functions had to be pessimized when converting to module type. Start moving them back to more optimized forms.
2024-01-12 14:28:14 -06:00
Nandor Licker 3ce5370b50 [NFC][FIRRTL] Move the clock gate intrinsic to the instrinsics file 2024-01-12 03:19:42 -08:00
Nandor Licker 904187e845 [NFC][Seq] Rename the ClockDivider to ClockDividerOp 2024-01-12 02:22:19 -08:00
Martin Erhart c07347a71d
[Arc] StateOp: latency instead of lat in assembly format (#6562)
Spelling out latency should make it easier to understand what this
attribute means.
2024-01-12 07:54:39 +01:00
Andrew Lenharth b49fa9b4f6 [NFC] Fix some types on loops for getNumPorts. Thanks to @Tang-Haojin. May fix windows build. 2024-01-11 11:14:15 -06:00
Andrew Lenharth f28128c955
Bump LLVM (#6566) 2024-01-11 11:04:57 -06:00
Martin Erhart e76a757e06
[Arc] Use CallOp instead of latency 0 StateOp (#6560)
This simplifies the `arc.state` operation by always requiring latency > 0 and uses `arc.call` operations instead of the latency 0 states.
2024-01-11 13:48:51 +01:00
John Demme 1e78a4ea78 [ESI] Fix WrapValidReadyOp folder bug
Worked until now, but the upcoming llvm bump doesn't like it.
2024-01-11 01:04:02 +00:00
Schuyler Eldridge b9dc46e1fa
[FIRRTL] Miscellaneous Whitespace Cleanup, NFC
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-01-10 13:59:19 -05:00
Nandor Licker cc8fabb16d
[Sim] Initial implementation of the `sim` dialect (#6561) 2024-01-10 18:02:39 +02:00
Andrew Lenharth ccdef1740c
[NFC] Bump LLVM over mnemonic change (#6563) 2024-01-09 16:01:06 -06:00
Nandor Licker 258de7b792
[HW] Select the better name when dropping wires (#6559) 2024-01-09 22:50:49 +02:00
Nandor Licker 36eaec3fa1 [FIRRTL] Move intrinsics into their own tablegen file 2024-01-08 07:26:41 -08:00
Schuyler Eldridge 659e587421
[FIRRTL] Whitespace .td cleanup, NFC
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-01-04 16:20:48 -05:00
Schuyler Eldridge 78e6620db4
[support] Add debug header print helpers
Add two helpers for printing boilerplate that is commonly used when
generating LLVM debugging information for passes.  This will be used to
replace this boilerplate in passes in a future commit.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2024-01-04 01:45:54 -05:00
Will Dietz 6e50da9210
[FIRRTL] Intrinsics: Fix lifetime issues in lambda. (#6534)
Fixes #6533.
2023-12-20 15:36:49 -06:00
Andrew Lenharth c3ca208b07 [NFC] zip_equal ensures correctness 2023-12-19 16:33:53 -06:00
Nandor Licker f7833081e7
[FIRRTL] Framework for intrinsic lowering (#6527) 2023-12-16 09:15:39 +02:00
Amelia 3707c382fb
[HW to BTOR2] btor2 conversion pass (#6378)
* Added missing tool in integration test

* Fixed formatting

* Fixed whitespace issue

* Fixed typo in VerilogGeneration.md

* Added skeleton for btor2 lowering pass

* added pattern match skeleton to lowering pass

* Added initial emission of inputs and hw::constant ops

* added constant emission

* added emission for most operations and final assertion

* Added support for muxes, assumptions and wire aliases

* Added support for inputs in btor2

* fixed bug in input generation

* added support for missing comb operations

* Changed input registration to allow for booleans

* Made input type check more robust

* WIP register state transition system generation

* Added support for registers

* refactored hardcoded string

* added names to btor2 states

* Added state initialization support

* Removed state initializer, it should be a firrtl construct and not a btor one

* Removed temporary file emission

* Added back accidentally removed btor2 string printing

* Ran clang-format

* Ran clang-format

* WIP refactored typeswitch

* refactored giant type switch

* Made all string litterals constexpr

* attempting to fix sanity check

* fixed variable name typo

* Attempting to satisfy clang-tidy

* renamed things to make clang happy

* inlined useless helper methods

* Clarified the necessity of important data structures in comments

* fixed formatting

* Changed pass into a Conversion pass

* refactored helper methods

* Checked for case where next is a port when emitted transitions

* Added newline at EOF

* Inherited visitors instead of using a big typeswitch

* Throw an error for unsupported ops and explicitly ignore the rest

* Removed unnecessary functions and refactored runOnOperation

* Fixed formatting

* Attempted to add some test

* Added in ops that weren't covered by visitors

* Added in missing declaration in header

* Included pass in CAPI CmakeLists

* Added infrastructure for btor integration tests

* Revert "Added infrastructure for btor integration tests"

This reverts commit a5ec3da4ec.

* various nitpicking comments accounted for

* used generalized ids for btor2 testcase

* fixed typo in test

* updated test and found small bug

* clang-format

* added support for arbitrary resets

* Updated test to reflect new handling of reset

* Switched to a DFS strategy for emission

* Updated test to align with preemission of register declarations

* Removed gratuitous lookups.

* inlined a bunch of string constatns

* removed certain silent fails and added out of order test
2023-12-15 20:30:07 +01:00
Andrew Lenharth 96ddd2fed1
[NFC] Make CHIRRTL more normal in preparation for moving some stuff in (#6521) 2023-12-13 17:40:21 -06:00
Nandor Licker febac22899
[FIRRTL] Add a pass to specialize instance choices (#6507)
The `SpecializeOptions` pass eliminates instance choices and replaces them with instances targeting the modules associated with a case provided through the options.
2023-12-13 19:18:41 +02:00
Nandor Licker 4b498413a9
[FIREmitter] Bump the version to 4.0.0 (#6522) 2023-12-13 18:54:30 +02:00
Nandor Licker b45cfc065f [NFC][FIRRTL] Add an accessor to the cases of instance choices 2023-12-13 03:56:00 -08:00
Nandor Licker 34c5329073 [FIRRTL][NFC] Add more accessors to instance choices 2023-12-13 02:05:37 -08:00
Nandor Licker 9bc37425c4
[FIRRTL] Add options and instance choices (#6504) 2023-12-13 11:52:04 +02:00
leothaud 2a0deb37cb
[Scheduling] Define problem to model operator chaining in cyclic problem. (#6485)
This PR defines a ChainingCyclicProblem, which models a hybrid problem of ChainingProblem and CyclicProblem and adapts the simplex scheduler to solve this problem. It is mainly done by reusing and adapting codes from the two base problems. This problem represents the problem a static HLS tool will solve for loop pipelining.

---------

Co-authored-by: leothaud <dylan.leothaud@irisa.fr>
2023-12-12 09:43:26 +01:00
Fabian Schuiki 91e8b3dd9a
[Arc] Add support for struct and array states (#6508)
Allow `!arc.state` to carry HW structs and arrays. The state only has to
be able to compute the bit width of the inner type, but it does not care
what exactly this type is.

Rework the Arc-to-LLVM lowering to do the entire lowering in one full
conversion, instead of two separate ones. There is no real need for the
split, and combining all patterns into one large conversion allows all
Arc types to be directly converted to LLVM types. Previously, after the
first partial conversion the IR would be in a strange in-between state
of mixing Arc types into LLVM operations (for example, loads and stores
of HW struct/array types).
2023-12-11 14:22:25 -08:00
Fabian Schuiki 08665a1b16
[Arc] Partially enable reset/enable detection (#6506)
Enable the `InferStateProperties` pass in the arcilator pipeline and
make its enable and reset signal detection individually controllable.
The enable portion is already supported by the rest of the arcilator
pipeline and can produce 20%-35% speedup on the cores in arc-tests.
Turn on enable detection by default.

The reset portion is not fully supported yet and causes the simulation
to misbehave. It is disabled by default.

As a minor refactoring this removes the `constructor` field from the
pass definition, such that the constructor and plumbing for options gets
generated automatically. As a side effect, the constructor is now called
`arc::createInferStateProperties` instead of the previous
`arc::createInferStatePropertiesPass`. (Thanks @uenoku for the pointer.)

Shoutout to @maerhart and @TaoBi22 for this fantastic pass!
2023-12-08 15:21:34 -08:00
Fabian Schuiki 594b8f65df
[Debug] Add scope op (#6454)
Add the `dbg.scope` operation to the debug dialect. The op creates an
additional level of hierarchy in the DI, a "scope", which can be used to
group variables and other scopes.

Operations such as `hw.module` introduce an implicit scope. All debug
operations within a module are added to that implicit scope, unless they
have an explicit `scope` operand. Providing an explicit scope can be
used to represent inlined modules.

Scopes in DI do not necessarily have to correspond to levels of a module
hierarchy. They can also be used to model things like control flow
scopes, call stacks, and other source-language concepts.

This commit also introduces an optional `scope` operand on
`dbg.variable`. The `DebugInfo` analysis, which traverses the IR and
builds up a canonical representation of the DI, honors this operand and
adds the variables to the corresponding scope.
2023-12-08 09:38:46 -08:00
Nandor Licker b8aedcb634
[InstancePath] Add accessors to allow ops to reference multiple targets (#6446) 2023-12-08 19:06:54 +02:00
Fabian Schuiki 5838a9ed2f
[Arc] Use seq.clock_gate op (#6501)
The arc dialect currently provides its own `arc.clock_gate` operation.
Since the seq dialect has a proper `seq.clock_gate` now, switch over to
that and remove custom arc op.

Fixes #6500.
2023-12-07 17:14:59 -08:00
Fabian Schuiki e658bba6fc
[firtool] Add option to treat EICG_wrapper as intrinsic (#6499)
Add the `--fixup-eicg-wrapper` option to firtool and the LowerIntrinsics
pass. Setting the option will treat `EICG_wrapper` modules like an
intrinsic and replace them with the `firrtl.int.clock_gate` operation.

In the long run, Chisel/FIRRTL designs will directly emit the clock gate
intrinsic, and `EICG_wrapper` extmodules will be gone. However until we
get there, this option provides an incremental path towards deprecating
the `EICG_wrapper` pattern. It allows us to switch the CIRCT side of the
flow over to the intrinsic without having to make changes to Chisel in
lockstep. Once all relevant existing designs work with this switch
enabled, Chisel projects can opt into emitting clock gates directly, and
can gradually upgrade. At that point we can make firtool emit
deprecation warnings for uses of `EICG_wrapper` extmodules, and at some
point we can entirely drop special handling of these modules altogether.

This switch is disabled by default and does not affect existing flows.
2023-12-07 14:47:57 -08:00
Prithayan Barua 2d822eabf6
[FlattenIO] Fix module input and output port name order. (#6495)
This PR has the following two changes:

*  Fix module input and output port orders

* Add option to update join character, required for external modules
2023-12-07 09:09:33 -08:00
Sprite d6b83cc174 [FIRRTL][CAPI] Build open bundle for fields containing non-base types 2023-12-07 02:46:42 +08:00
Nandor Licker 06b4b0518b [NFC] Remove trailing whitespace 2023-12-05 03:31:17 -08:00
Will Dietz e8f841c679
[Pipeline] Use Block::BlockArgListType to avoid const. (#6489)
ArrayRef<BlockArgument> makes the elements 'const' unnecessarily,
causing issues with upcoming LLVM bump, due to http://llvm.org/PR72765 .

There's no BlockArgumentRange, so use Block's typedef (=MutableArrayRef).
2023-12-04 19:29:01 -06:00
Andrew Lenharth 7fe09dee82 [NFC] clang-format fixes 2023-12-04 16:05:13 -06:00
Andrew Lenharth 2dc1a3a7cf [FIRRTL] Fix fieldIDs in annotations and symbols when lowering signatures 2023-12-04 14:37:05 -06:00
Nandor Licker 79baf6c364
[FIRRTL] Add helpers for the implementation of FIRRTL instance-like ops (#6484) 2023-12-04 20:12:00 +02:00
Mike Urbach 670a34716a
[OM] Update result type for EmptyPathOp. (#6481)
It looks like this may have been intended for this to be PathType.
2023-12-02 12:49:37 -07:00