-
Notifications
You must be signed in to change notification settings - Fork 33
new components: cam and replacement #259
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
base: main
Are you sure you want to change the base?
Conversation
removed wavedumper
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 is wonderful!
lib/src/memory/cam.dart
Outdated
| final int idWidth; | ||
|
|
||
| /// The "enable" bit for this interface, enabling a request. | ||
| Logic get en => port('en'); |
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.
why do we need an enable bit?
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.
To tell it to do the cam match. You are providing a tag in, and the en tells it to do a match and return the idx or data back. This is the same as a DataPortInterface providing an en and addr. Just replace those with en and tag.
You may not want it doing a match if you simply have the tag field set on the read port.
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.
the enable is needed for a write, but if you're doing a read isn't it the same if we just always read whatever address is given? what do you mean "doing a match"? is this for power savings? the combo logic is there either way
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.
Good point and simpler is better.
|
|
||
| /// An interface to a Content-Addressable Memory (CAM) that allows querying | ||
| /// for tags and returns the index of the matching tag if found. | ||
| class TagInterface extends Interface<DataPortGroup> { |
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.
but i only see it used in one way, and the write ports are DataPortInterfaces. Is there another place you're planning to use them?
lib/src/memory/cam.dart
Outdated
| final int idWidth; | ||
|
|
||
| /// The "enable" bit for this interface, enabling a request. | ||
| Logic get en => port('en'); |
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.
the enable is needed for a write, but if you're doing a read isn't it the same if we just always read whatever address is given? what do you mean "doing a match"? is this for power savings? the combo logic is there either way
| String? logicName, | ||
| }) : super(fields, name: logicName ?? config.name); | ||
|
|
||
| // Historically the CSR disallowed renaming because the architectural |
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.
@kimmeljo any concerns?
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.
these test files are getting pretty long. is there an opportunity to refactor a bit to reduce repetition by making some reusable infra?
Description & Motivation
These are two components needed to build various kinds of cache memory.
First is a CAM which is a contents-addressable memory. It addresses memory by using a tag instead of an address.
It primarily returns a 'hit' but also the address of where it is found (we can work to make this optional).
The CAM also provides a standard write interface for populating the tags as data, using the line address.
Second is a Replacement module which is abstract and one kind of policy implemented; pseudoLRU. This will eventually be an optional Module passed into a Cache that can be used to modify a Cache with different way replacement policies.
Related Issue(s)
None.
Testing
Basic testing of the CAM to allow for simultaneous tag writes then tag lookups.
Backwards-compatibility
No.
Documentation
No.