-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add Plru Docs #249
Draft
MahirAbbas
wants to merge
16
commits into
SpinalHDL:master
Choose a base branch
from
MahirAbbas:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add Plru Docs #249
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bda831d
Create Plru.rst
MahirAbbas a97ae45
Update Plru.rst
MahirAbbas c73c720
Update Plru.rst
MahirAbbas 70aff6d
Update Plru.rst
MahirAbbas 3d56a94
Update Plru.rst
MahirAbbas b3f4e3c
Update Plru.rst
MahirAbbas 13ac081
Add Dolu Code + comments, and give simple example area of plru
MahirAbbas 1b6d1f8
Update Plru.rst
MahirAbbas 1e6d80d
Update Plru.rst
MahirAbbas 7755afa
Update Plru.rst
MahirAbbas bb1dba5
Update Plru.rst
MahirAbbas 1da54c4
Update Plru.rst
MahirAbbas 9366335
Update Plru.rst
MahirAbbas 779a0e6
Update Plru.rst
MahirAbbas 9b252fe
Update Plru.rst
MahirAbbas 22f9980
Update Plru.rst
MahirAbbas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
.. role:: raw-html-m2r(raw) | ||
Check warning on line 1 in source/SpinalHDL/Libraries/Misc/Plru.rst GitHub Actions / test
|
||
:format: html | ||
|
||
Plru | ||
========================== | ||
|
||
Introduction | ||
-------------------- | ||
- Pseudo least recently used combinatorial logic | ||
- io.context.state need to be handled externaly. | ||
- When you want to specify a access to a entry, you can use the io.update interface to get the new state value. | ||
- plru.io.evict.id tells you the id of the next block to be evicted | ||
- plru.io.update.id lets you update what you recently used | ||
|
||
|
||
PLRU Code | ||
|
||
.. code-block:: scala | ||
|
||
val io = new Bundle{ | ||
val context = new Bundle{ | ||
//user -> plru, specify the current state | ||
val state = Plru.State(entries) | ||
//user -> plru, allow to specify prefered entries to remove. each bit set mean : "i would prefer that way to not to be selected by PLRU" | ||
val valids = withEntriesValid generate Bits(entries bits) | ||
} | ||
val evict = new Bundle{ | ||
//PLRU -> user, Tells you the least recently used entry for the given context provided above | ||
val id = UInt(log2Up(entries) bits) | ||
} | ||
val update = new Bundle{ | ||
// user -> PLRU specify which entry the user want to mark as most recently used | ||
val id = UInt(log2Up(entries) bits) | ||
// PLRU -> user specfy what should then be the new value of the PLRU status | ||
val state = Plru.State(entries) | ||
} | ||
} | ||
|
||
|
||
Example usage in a cache | ||
|
||
.. code-block:: scala | ||
|
||
val plru = new Area { | ||
// Define a Mem, to track the state of each set | ||
val ram = Mem.fill(nSets)(Plru.State(wayCount)) | ||
val write = ram.writePort | ||
val fromLoad, fromStore = cloneOf(write) | ||
write.valid := fromLoad.valid || fromStore.valid | ||
write.payload := fromLoad.valid.mux(fromLoad.payload, fromStore.payload) | ||
} | ||
|
||
|
||
Get the ID of the way to evict from | ||
|
||
.. code-block:: scala | ||
|
||
val replacedWay = plru.io.evict.id | ||
|
||
Update recently used way | ||
|
||
.. code-block:: scala | ||
|
||
plru.update.id := refillWay | ||
|
||
|
||
|
||
|
Oops, something went wrong.
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.
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.
I would say, this is when you have two pipeline (one load and one store) which want to update the PLRU state.
For the doc itself, we shouldn't have that complexity.
There is two example of PLRU usage you may haven't seen :