Skip to content

Support HW structs - #13

Open
PetrifiedPanda wants to merge 45 commits into
mainfrom
hw_struct_support
Open

Support HW structs#13
PetrifiedPanda wants to merge 45 commits into
mainfrom
hw_struct_support

Conversation

@PetrifiedPanda

@PetrifiedPanda PetrifiedPanda commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Added support for the !hw.struct types. This is supported by exploding struct typed registers into separate scalar registers, which required loosening the type restrictions on register operations. To remove the hw struct operations, the canonicalizer in combination with exploding struct registers is sufficient.
Another necessary change was adding a canonicalization pattern that legalizes hw.constants of non-signless types to hwarith.constant.

…rently only for scalar registers, not register files
…registers and to see whether all struct operations are canonicalized out
…s of non-signless types. This fixes an error happening in longnail when inlining a function of a struct type. The canonicalizer tries to insert a hw.constant op if the struct members are constants. It does not respect signedeness, which causes this error
@PetrifiedPanda
PetrifiedPanda requested a review from 7FM August 11, 2026 12:07
@PetrifiedPanda
PetrifiedPanda removed the request for review from 7FM August 18, 2026 09:28
@PetrifiedPanda
PetrifiedPanda marked this pull request as draft August 18, 2026 09:28
…new one in each function call, and formatting
…arate function, as it was needed by both Get and Set ops. (Also had different behaviour, so this unifies the behaviour for both)
…se is impossible, because the op would be invalid if base was larger than maxIndexWidth
…exploding itself and is used in places where we are not exploding the structs
@PetrifiedPanda
PetrifiedPanda marked this pull request as ready for review August 31, 2026 11:54
@PetrifiedPanda
PetrifiedPanda requested a review from 7FM August 31, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant