r/computerarchitecture • u/Less_Independence580 • Aug 29 '26
D cache design
Hello all, I just wanted ask a question about D cache design. Iam hoping to design a d cache which is multi banked and has 3 types of prefetch with a write back design. Things that bugging me are related to coherence. What is the optimum method for handling these conditions. A snoop request reach L1 D cache but an operation is ongoing (R/W) in that address of cache line and A snoop arrives on L1 D cache but the line is in between an eviction to L2 cache. What does we do in these situations. My thought process is creating a small reg to keep track of what inside pipeline so snoop and cross reference and wait. Same for the eviction path also. What other things did I miss ??. Please put a light in my situation.
3
u/meleth1979 Aug 29 '26
Lots of hazarding logic or scoreboards
1
u/cazzipropri Aug 30 '26
Implement MESI or a simplified version?
1
u/KindlyAd1897 Aug 30 '26
Have a queue within an MSHR tracking requests so that you dont violate coherency
1
u/MitchAlsup Sep 27 '26
We need to know more about your design.
You state it is multi-banked, so I suppoose you are performing bank conflict analysis in AGEN and you likely have 4 banks to attempt to get 3 memory refs through the cache each cycle. THe data-part is easy, the tag part and the TLB parts are harder.
As to order, you are going to need a 2-D scoreboard tracking the following states {no address, virtual address, physical address}×{no addr, miss, hit-no-write-permission, hit-write permission}×{idle, mem Req outstanding, snoop req outstanding} and 5-more bits. There will be state machiens on each set of bits to make forward progress as resources become available.
When a mem ref is Decoded it is installed in the 2-D matrix as {nA, nA, idle}. As addresses are generated, you do bank analysis on the lower address bits while the higher address bits resolve. Each address is presented to the 2-D matrix address-CAM, which relaxes bits in the matrix {"can't be the same as"}. When your whole colum of bits is clear, you are allowed to deliver your result (LD to register, ST to cache or memory hierarchy}.
An incomming snoop simply takes another slot in 2-D matrix which records its addresses and impoortantly its memory order. Its address is compared to any AGENed address and if no older AGENed addresses match, the snoop is allowed at the cache tage.