-
Notifications
You must be signed in to change notification settings - Fork 299
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
[LLHD] Add extract field operations #35
Conversation
* Add operations to statically and dynamically extract an element from a vector or tuple * They can also operate on signals by returning an alias signal to the specified element of the underlying type of the target signal, this means they don't perform any kind of probing like the llhd.prb instruction
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.
Seems ok to me in a quick glance, but I didn't do a detailed review
@@ -101,3 +101,118 @@ def LLHD_DextsOp : LLHD_Op<"dexts", [ | |||
unsigned getTargetWidth() { return getLLHDTypeWidth(target().getType()); } | |||
}]; | |||
} | |||
|
|||
def LLHD_ExtfOp : LLHD_Op<"extf", [ |
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.
prefer complete words. IS this "Extend Float?" "Extract field?" "External foobar?" "Example Tensorflow?"
PredOpTrait<"'index' has to be smaller than the 'target' size", | ||
CPred<"$index.cast<IntegerAttr>().getInt() < getTargetWidth()">>, | ||
TypesMatchWith<"'result' type has to match type at 'index' of 'target', in " | ||
"case 'target' is a singal, consider the underlying types of the 'target'" |
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.
singal -> signal
NoSideEffect, | ||
PredOpTrait<"'index' has to be smaller than the 'target' size", | ||
CPred<"$index.cast<IntegerAttr>().getInt() < getTargetWidth()">>, | ||
TypesMatchWith<"'result' type has to match type at 'index' of 'target', in " |
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.
This seems awkwardly worded to me. The description doesn't quite seem to match the predicate?
"getElementTypeAtIndex($index.cast<IntegerAttr>().getInt())) " | ||
": getElementTypeAtIndex($index.cast<IntegerAttr>().getInt()))"> | ||
]> { | ||
let summary = "Extract an element from a vector or tuple"; |
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.
or a signal with with vector or tuple type?
}]; | ||
} | ||
|
||
def LLHD_DextfOp : LLHD_Op<"dextf", [ |
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.
Oh no, it's random sequence of letters op!
* llhd.extf -> llhd.extract_element * llhd.dextf -> llhd.dyn_extract_element
@stephenneuendorffer Thanks for your review! I renamed |
Sounds good I think. |
a vector or tuple
specified element of the underlying type of the target signal, this
means they don't perform any kind of probing like the llhd.prb
instruction