Open
Conversation
Signed-off-by: Ramli, Nurul Izziany <nurul.izziany.ramli@intel.com>
Signed-off-by: laeticiachee <laeticia.chee@gmail.com>
Signed-off-by: laeticiachee <laeticia.chee@gmail.com>
mkorbel1
requested changes
Aug 12, 2025
Contributor
mkorbel1
left a comment
There was a problem hiding this comment.
Thank you for your contribution! Some comments :)
| /// | ||
| /// Takes in [bus] of type [Logic]. | ||
| /// [pattern] is the pattern to be counted in the bus. | ||
| /// If [fromStart] is `true`, the count starts from the beginning of the bus. |
Contributor
There was a problem hiding this comment.
What is the meaning of counting from the start or the end? Shouldn't the resulting count be the same?
|
|
||
| if (generateError) { | ||
| // If pattern is not found (count equals to 0), return error | ||
| addOutput('error'); |
Contributor
There was a problem hiding this comment.
why is it an error if count is 0?
| count += valCheck.zeroExtend(count.width); | ||
| } | ||
|
|
||
| _output = addOutput('count', width: count.width); |
Contributor
There was a problem hiding this comment.
what's the purpose of the internal _output vairable? Why not just assign this.count <= count or something?
| /// Count the number of occurence of a fixed-width pattern in a bus. | ||
| /// | ||
| /// Takes in [bus] of type [Logic]. | ||
| /// [pattern] is the pattern to be counted in the bus. |
Contributor
There was a problem hiding this comment.
it may be worth explicitly stating that if the pattern width is greater than the width of the bus, the count will always be 0
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description & Motivation
Similar to the Count bit occurrence, but instead, find an entire multi-bit pattern
Related Issue(s)
Count pattern occurrence #170
Testing
Test are defined in test/count_pattern_test.dart with multiple cases
Backwards-compatibility
No
Documentation
Yes, documentation on how to use it, and some examples are added in doc/components/count_pattern.md