Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Remaining bit operations #4

wants to merge 2 commits into from

Conversation

alastairreid
Copy link
Contributor

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

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
Copy link
Contributor

@math-fehr math-fehr left a 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.

Comment on lines +836 to +841
S: ClassVar = VarConstraint("S", BaseAttr(BitVectorType))
T: ClassVar = VarConstraint("T", BaseAttr(BitVectorType))

lhs = operand_def(S)
rhs = operand_def(IntegerType())
res = result_def(T)
Copy link
Contributor

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

Suggested change
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

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.

2 participants