Created
May 2, 2021 22:19
-
-
Save stellaraccident/4a73e395e5cc68a5244c8d88dd291396 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import circt.esi | |
import mlir.ir | |
with mlir.ir.Context() as ctx: | |
circt.register_dialects(ctx) | |
ChannelType = circt.esi.ChannelType | |
print(ChannelType.__mro__) | |
print(ChannelType.__bases__) | |
i32 = mlir.ir.Type.parse("i32") | |
i32_other = mlir.ir.Type(i32) | |
print(f"{i32} -> {i32_other}") | |
print(ChannelType.parse("i32")) | |
ct = circt.esi.ChannelType.get(i32) | |
print(ct) | |
ct2 = circt.esi.ChannelType(ct) | |
print(f"{ct2} -> {ct == ct2}") | |
try: | |
ct_illegal = circt.esi.ChannelType(i32) | |
except ValueError as e: | |
print(e) | |
print(ChannelType.isinstance(ct)) | |
print(ChannelType.isinstance(i32)) | |
print(f"Inner type: {circt.esi.ChannelType(ct).inner}") | |
print(f"Inner type: {ct2.inner}") | |
print(f"Inner type: {circt.esi.ChannelType(ct2).inner}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment