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

Sum and Counter #89

Merged
merged 46 commits into from
Sep 16, 2024
Merged

Sum and Counter #89

merged 46 commits into from
Sep 16, 2024

Conversation

mkorbel1
Copy link
Contributor

@mkorbel1 mkorbel1 commented Sep 6, 2024

Description & Motivation

A Sum and Counter component. The Sum adds up all the things input combinationally, and the Counter adds a flop (essentially). The components are super flexible and generic.

Related Issue(s)

Fix #73

Testing

Added new tests

Backwards-compatibility

Is this a breaking change that will not be backwards-compatible? If yes, how so?

No

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

Yes

Copy link
Contributor

@desmonddak desmonddak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I did not walk through all logic as it is hairy. I learned some things like using inject and negEdge which I hadn't used before.

One thing I didn't check is if the Counter has good defaults for the common case (single increment, wraparound?)

@mkorbel1
Copy link
Contributor Author

if the Counter has good defaults for the common case (single increment, wraparound?)

Yes, the default is wrap-around and requires a list of interfaces. The Counter.simple constructor can just be given a clock, reset, and width (or max value) and it would be a simple increment-by-one counter. You need to provide something so width can be inferred, but beyond that I think the defaults are convenient for what most people expect.

Copy link
Contributor

@desmonddak desmonddak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is in great shape. My biggest question is: do we need both max and min in the same Counter. If not, the interface gets way simpler and easier to understand.

@mkorbel1
Copy link
Contributor Author

do we need both max and min in the same Counter

Yes, because we could have both incrementing and decrementing inputs, with variable amounts and enables.

@mkorbel1 mkorbel1 merged commit b731bd8 into intel:main Sep 16, 2024
4 checks passed
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.

Binary Counter
2 participants