E
Enno Luebbers
Hi there,
I'm currently implementing a processor cache in VHDL. There are the
obvious states IDLE, READ_HIT, READ_MISS, READ_MISS_DIRTY, WRITE_HIT,
WRITE_MISS, WRITE_MISS_DIRTY.
The *_DIRTY states are responsible for writing back the cacheline
contents to RAM before reading the new cacheline. So they essentially
do the same (i.e. generate the same output signals), except that
WRITE_MISS_DIRTY transitions to WRITE_MISS after writing back, and
READ_MISS_DIRTY transitions to READ_MISS.
So my question is: Is it more efficient to merge the two *_DIRTY states
into one and reserve an additional state_next register to hold the
state to transition to, or just duplicate the states?
The benefits of merging the states would seem to be:
- reduced number of states
- simpler logic for generating the "write back" signals
- only one place to change the write back code
On the other hand, there's the drawbacks:
- another state register
Did I miss something here? What's the "right" way to do this?
Thanks in advance,
Enno
I'm currently implementing a processor cache in VHDL. There are the
obvious states IDLE, READ_HIT, READ_MISS, READ_MISS_DIRTY, WRITE_HIT,
WRITE_MISS, WRITE_MISS_DIRTY.
The *_DIRTY states are responsible for writing back the cacheline
contents to RAM before reading the new cacheline. So they essentially
do the same (i.e. generate the same output signals), except that
WRITE_MISS_DIRTY transitions to WRITE_MISS after writing back, and
READ_MISS_DIRTY transitions to READ_MISS.
So my question is: Is it more efficient to merge the two *_DIRTY states
into one and reserve an additional state_next register to hold the
state to transition to, or just duplicate the states?
The benefits of merging the states would seem to be:
- reduced number of states
- simpler logic for generating the "write back" signals
- only one place to change the write back code
On the other hand, there's the drawbacks:
- another state register
Did I miss something here? What's the "right" way to do this?
Thanks in advance,
Enno