Commit Graph

65 Commits

Author SHA1 Message Date
Mike Urbach 13948d32d8 [MSFT] Remove SwitchInstanceAttr and RootedInstancePathAttr.
These attributes and their use cases are now replaced by
hw::GlobalRefOp and hw::InnerRefAttr, respectively.
2021-12-27 13:52:14 -07:00
Mike Urbach a2a058b70e [MSFT] Refactor placement export to use hw::GlobalRefs.
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.
2021-12-27 13:51:57 -07:00
Mike Urbach 6d7e0e9118 [HW] Add Python bindings for GlobalRefAttr.
This adds the necessary CAPI boilerplate and a basic Python type for
holding GlobalRefAttr.
2021-12-27 11:32:05 -07:00
Mike Urbach 9f7a01a865 [HW] Add Python bindings for InnerRefAttr.
This adds the necessary CAPI boilerplate and a basic Python type for
holding InnerRefAttr.
2021-12-27 11:32:05 -07:00
Hideto Ueno 6c5e0ce771
[HW] Use StringAttr instead of StringRef in FieldInfo, nfc (#2325)
* [HW] Use StringAttr instead of StringRef in FieldInfo, nfc

This commit changes to use use StringAttr instead of StringRef
in FieldInfo to avoid unnecessary copies of field names.
Changes are mainly about parser/printer and CAPI.
This commit also changes Struct/UnionTypeImpl to use ArrayRefParameter
instead of ArrayRefOfSelfAllocationParameter in their tablegen
definition. And this deletes unnecessary allocators too.
2021-12-12 15:52:52 +09:00
Fabian Schuiki 58279f46dc
[LLHD] Add time attribute C API
Extend the LLHD C API to allow for `TimeAttr` to be created and
inspected.
2021-11-21 13:11:47 +01:00
Fabian Schuiki 36c2d395d2
[LLHD] Add type C API
Add a few functions to LLHD's C API to interact with the LLHD dialect
types.
2021-11-21 13:11:47 +01:00
mikeurbach bd05d96c11
[PyCDE] Add entry method for PhysicalRegions and their references. (#2174)
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.
2021-11-15 10:02:34 -08:00
mikeurbach a002a849b3
[MSFT] Re-work ExportQuartusTcl to export into verbatim nodes. (#2077)
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.
2021-11-09 19:25:16 -07:00
Mike Urbach 0d864829da [Python] Expose exportSplitVerilog API to Python.
This just needed to be plumbed through the CAPI.
2021-11-09 13:28:54 -07:00
mikeurbach e43d978a56
[MSFT] Move ExportQuartusTcl from a translation to a pass. (#2075)
This keeps the existing functionality based on attributes, and exports
to llvm::outs as part of the pass, in order to keep the existing
tests. Further changes based on the approach in #2068 will follow.
2021-11-03 21:31:21 -06:00
mikeurbach c5bda61046
[Python] Add bindings for hw::ParamVerbatimAttr. (#2051)
This just needs to be plumbed up to Python.
2021-10-28 17:57:44 -06:00
Mike Urbach 8be26b7c9b [Python] Fix bindings after upstream changes to aggregate building.
With the new CMake functionality upstream, we need to set the
ENABLE_AGGREGATION option when we call add_mlir_library. The easiest
way to do this is to just rely on the upstream helper
add_mlir_public_c_api_library, which does this and other important
settings for us.

Also, ensure the MSFT dialect's CAPI marks all of the public functions
as being exported.
2021-10-20 16:51:26 -07:00
John Demme 960e624d7f
[MSFT] [DeviceDB] Teach `walkPlacements` about boundaries (#2000)
`walkPlacements` now takes a bounding rectangle and a primitive type
upon which to filter.
2021-10-15 13:29:53 -07:00
John Demme 07c2778fa7
[MSFT] [DeviceDB] Add bindings to walk functions (#1942) 2021-10-06 21:46:15 -07:00
John Demme 5a4445ec3e [MSFT] [NFC] DeviceDB -> PrimitiveDB, combine all DB code
- Renames DeviceDB to PrimitiveDB.
- Puts both PrimitiveDB and PlacementDB in DeviceDB.h.
- Moves PlacementDB implementation into DeviceDB.cpp.
2021-10-06 14:23:55 -07:00
John Demme d488343996
[MSFT] [DeviceDB] Find nearest free location in column (#1937)
Find the nearest primitive in a column to the desired row. Said primitive should be of a given primitive type, and be unoccupied.
2021-10-06 11:12:01 -07:00
Chris Lattner 0de4aac499 [ExportVerilog] Move into Conversions/ tree.
ExportVerilog was an outlier living as the only child of the Translations
tree, move it into Conversions to be more similar to other passes.
2021-10-04 16:24:12 -07:00
John Demme 12720afe41
[MSFT] Use a DeviceDB to seed a PlacementDB (#1922)
Just checks validity of placements for now.
2021-10-02 17:40:40 -07:00
John Demme ee2a93886c
[MSFT] Adding DeviceDB (#1921)
Created a DeviceDB which doesn't do anything yet. The `devType` to
`primitiveType` change got wrapped up in this change.
2021-10-02 01:28:24 -07:00
John Demme ede291cdd5 [MSFT] Rename `devType` to `primitiveType` on PhysLocation attribute 2021-10-01 23:13:06 -07:00
John Demme daa5dc503e [MSFT] Rename DeviceType enum to PrimitiveType 2021-10-01 22:09:52 -07:00
Parker Mitchell f76fadad6e
[MSFT] Rename DeviceDB to PlacementDB (#1894)
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.
2021-10-01 18:24:10 -07:00
John Demme d046e6a7ec
[MSFT] Removing C++ generator code (#1918)
We've switched to Python-based generators. Ping-ponging between IR modifying
C++ and IR modifying Python was a massive mistake for pointer safety reasons.
2021-10-01 16:24:15 -07:00
John Demme 99f0092cac
[Python] Fix Python Bindings (#1858)
Closes #1810 

The changes to `hw.module` and `hw.instance` make them incompatible with `msft.module` and `msft.instance` as far as the python bindings are concerned. I'm not sure what I want to do here so I've marked that test as `xfail` for the moment.
2021-09-23 02:14:14 -07:00
John Demme 730b157be5
[MSFT] DeviceDB C API and Python bindings (#1717) 2021-09-03 20:12:16 -07:00
John Demme 0066f6dc79
[MSFT] Introduce `RootedInstancePath` and re-factor based on it (#1689)
A RootedInstancePath is just an instance path prepended with the root (aka top) module which the instance path is relative to. If we structure the placements based on this, we no longer have to walk the instance hierarchy while exporting TCL! This patch also removes support for locations not inside of instance switches. That use case required the design be fully elaborated which isn't really done.
2021-09-01 17:41:06 -07:00
John Demme 221e2db01c
Update LLVM submodule (#1687)
Co-authored-by: Andrew Young <youngar17@gmail.com>
2021-09-01 12:46:54 -07:00
John Demme 3ad8be3d88
[MSFT] [Python] Add a function to get an instance (#1613)
Given a root module and an instance path, find the corresponding instance from
the instance hierarchy. Return 'None' if the path wasn't found.
2021-08-20 13:57:35 -07:00
Fabian Schuiki 499cd357ca
[LLHD] Add C API
Add a minimal C API for the LLHD dialect.
2021-08-19 17:11:43 +02:00
John Demme 43ccc6584e
[MSFT] [Py] Add physical location and switch instance attributes to python module (#1606) 2021-08-18 20:03:07 -07:00
John Demme f537e0faba
[ESI] [Python] Move functionality through the C API (#1595)
Necessary to avoid linking issues on Windows.
2021-08-17 15:40:14 -07:00
Mike Urbach c9af2e1a44 [Python] Move remaining functionality behind the C-API, NFC.
There were some bits of the ESI and MSFT native pybind11 modules that
directly called into the CIRCT C++ libraries. This moves that
functionality out of the modules and behind the C-API. This proper
layering needs to be enforced before we can implement the upcoming
migration to use the improved upstream Python binding mechanism.

Also, this ensures all of the C-API functions used by the Python
bindings are annotated with MLIR_CAPI_EXPORTED, which will also become
required.
2021-07-27 13:55:15 -06:00
John Demme 2a7505c33f
[Py] [PyCDE] Add `get_fields` to struct type and use it in pycde (#1364)
PyCDE uses this for error checking and `.` access.
2021-07-05 20:36:54 -07:00
John Demme b57223d21b [C API] HWStructFieldInfo::Attribute -> ::Type 2021-07-05 18:42:01 -07:00
mikeurbach 8325991fbe
[CAPI][Python] Add support for TypeAliasType in CAPI and Bindings. (#1362)
This adds straightforward support for the TypeAliasType, as it stands
today, in the CAPI, then layers the Bindings directly on top of that.

Later improvements to the TypeAliasType's builder will of course
require refactoring part of this, but for now, this opens it up for
use in PyCDE.
2021-07-01 17:36:22 -06:00
mikeurbach 9dd73b174f
[PyCDE] Include parameters in generator registration and lookup. (#1298)
Previously, different parameterizations of the same module would end
up using the most-recently registered generator and the
parameterization used when it was registered.

This includes the parameterization in the registered mapping, and
looks for that same parameterization when looking up generators. This
is trivially supported since we already store the parameterization as
an attribute on the Operation.

Added a few lines to the polynomial integration test to ensure the
behavior.
2021-06-17 19:59:48 -06:00
John Demme 8b525e879b
[Py] Create syntactic sugar for some Array and Struct ops (#1234)
Recreating the C++ logic for ArrayCreateOp, ArrayGetOp, StructCreateOp, and StructExtractOp.
2021-06-10 11:46:09 -07:00
John Demme cc3d74cf69
[Py] Design entry language: generators (#1169)
Prototype of "generators". This version runs the generator for each and every op to lower and each time it is called, a new HWModuleOp is created at the top level. To fix this, I plan on unique'ing on the operation's attributes, result types, and operand types. This'll involve some refactoring since as of this PR the HWModuleOp creation and instantiation are both in the same callback.
2021-06-01 15:21:26 -07:00
Chris Lattner 53b1c077d6 [RTL->HW] Rename C++ namespace, command line flags and a bunch of other stuff. 2021-05-15 14:33:45 -07:00
Chris Lattner 4d43103122 [RTL->HW] Rename the string "RTL" to "HW"
This makes sure not to rename FIRRTL to HWRTL :-), and I spot checked a
many things to avoid changing general references to RTL (e.g. when referring
to external tools) but I suspect that I missed some.  Please let me know (or
directly correct) any mistakes in this mechanical patch.
2021-05-15 12:44:05 -07:00
Chris Lattner 84c94e8920 Correct a header comment. 2021-05-15 12:31:54 -07:00
Chris Lattner f922d2d9fb [RTL->HW] Move one more file I missed. 2021-05-15 12:28:31 -07:00
Chris Lattner 61e70086c6 [RTL->HW] Move a few more files in conversions and documentation. NFC. 2021-05-15 12:23:45 -07:00
Chris Lattner 91f77cf64b [RTL->HW] Move RTL directory structure/filenames to HW. NFC
This doesn't change the types or stuff declared in the file, just moves
things into place.
2021-05-15 12:07:47 -07:00
John Demme b26c078849
[ESI] Fix ESI integration tests (#1028) 2021-05-07 15:13:08 -07:00
Fabian Schuiki c180d6a29d
[CAPI] Guard esi::exportCosimSchema by CAPNP ifdef (#1023)
* C API fails to link on builds that have CAPNP disabled, since some of
  the symbols in the C++ API get dropped. Make the corresponding uses in
  the C API conditional on the presence of the same ifdef, so things
  link again.
2021-05-07 08:24:49 +02:00
John Demme 510d46e815
[ESI] [Python] Adding a call for export capnp (#1015) 2021-05-06 15:56:58 -07:00
mikeurbach 68dee0e70b
[Python] [RTL] Add RTL pybind module with array and struct type. (#1002) 2021-05-06 11:38:32 -06:00
mikeurbach faa0e1827a
[Seq] Add C API for Seq dialect and pass registration. (#1006) 2021-05-04 19:06:12 -06:00