-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remaining bit operations #4
base: main
Are you sure you want to change the base?
Conversation
Note that several of these operations have result types that require calculations based on the input values/types. For example func Replicate(x : bits(M), y : bits(N)) -> bits(M+N) I don't know how to capture that dependency yet so I generalized the types like this func Replicate(x : bits(M), y : bits(N)) -> bits(O) ^^^^^^^ This lets me continue without getting blocked on how we will represent dependent types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I just added a comment about style when defining operations, but otherwise everything looks good!
For the dependent types, I think we need to decide in which dialect this will be. Either we want a separate dialect for the dependent types, or we want to include it in this.
S: ClassVar = VarConstraint("S", BaseAttr(BitVectorType)) | ||
T: ClassVar = VarConstraint("T", BaseAttr(BitVectorType)) | ||
|
||
lhs = operand_def(S) | ||
rhs = operand_def(IntegerType()) | ||
res = result_def(T) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually just replace this with
S: ClassVar = VarConstraint("S", BaseAttr(BitVectorType)) | |
T: ClassVar = VarConstraint("T", BaseAttr(BitVectorType)) | |
lhs = operand_def(S) | |
rhs = operand_def(IntegerType()) | |
res = result_def(T) | |
lhs = operand_def(BitVectorType) | |
rhs = operand_def(IntegerType()) | |
res = result_def(BitVectorType) |
The VarConstraint are only really used whenever you need two types to be exactly equal
Note that several of these operations have result types that require calculations based on the input values/types. For example
I don't know how to capture that dependency yet so I generalized the types like this
This lets me continue without getting blocked on how we will represent dependent types