ACE bus增加的內容:
1):5狀態的cache model
2):關於coherency的additional signal
3):兩個cache master訪問shared cache的additional channel
4):支持Barrier transaction來保證transaction order
ACE推薦的最小的cache line的大小:min-------16B或者width of data bus,max----2048byte或者Burst 16的最大data bus
Cache Coherent的控制有兩種方式,一種是SCU式集中的控制,另一種是ACE bus distribute的分散式的
Coherency model
每個master本地都有一個cache,通過cache interconnect連接到main memory
當store命令發生時,保證所有的cache中只有一個copy的cache存在。
store操作之后,允許一份cache有多個copy的對象。
在更新main memory時,也允許copy的cache存在,但是不推薦這樣做。
ACE bus可以實現cache copy是否唯一性的判斷,如果cache copy唯一,cache的修改都不需要notify其他的cache master
如果cache copy不唯一,cache的修改必須通過合適的transaction notify其他的cache master
Cache state model
以cache line為單位,可以分為:
Valid/Invalid:數據在當前cache中是否有效。
Unique/Shared:當前的cache line是否具有唯一性。
Clean/Dirty:clean不需要更新main memory,dirty需要更新main memory
當一個cache master得到一個新的copy cache line,其他的cache master可能也有一份該cache line的copy並且處於Unique狀態,
此時必須notify其他的cache master將cache line的狀態改為Shared
當一個cache master discard一個cache line時,不需要notify 其他的cache master,所以處於Shared State的cache line也可能是Unique狀態的。
當一個cache line相對於main memory被更新,且有多個copy時,必須只有一個cache中處於Dirty state
ACE相對於AXI4多的信號:
Read address:ARDOMAIN[1:0]/ARSNOOP[3:0]/ARBAR[1:0]
domain信號表示:00---Non-Shareable,01---Inner Shareable,10---Outer Shareable,11---system
AxCACHE中的cache比特為0時,只能用11 level
AXCACHE中的[3:2]不為零時,不能用11 level
BAR信號表示:00---Normal access(respecting barrier),01---Memory barrier,10---Normal access(ignoring barrier),11---Synchronization barrier
Snoop信號表示:Non-snooping/Coherent/Memory update/Cache maintenance/Barrier這幾種transaction
Write address:AWDOMAIN[1:0]/AWSNOOP[2:0]/AWBAR[1:0]/AWUNIQUE
AWUNIQUE信號,主要用在lower level的cache hierarchy操作中,像L3 cache。(支持WriteEvict操作的transaction才需要該信號)
Read data:RRESP[3:2]
RRESP[2]:PassDirty,從interconnect來,HIGH表示,initial master必須保證該cache line需要重新寫回main memory
Low表示,initial master沒有這樣的reponsibility
RRESP[3]:IsShared,從interconnect來,HIGH表示,另外還有copy,該cache line必須在Shared state
Low表示,沒有其他的copy,該Cache line處於Unique state
在write data和write resp中沒有增加信號。
ACE新增加的channel:
snoop address channel:針對snoop transaction,為cache master提供address和控制信號。
ACVALID/ACREADY
ACADDR/ACSNOOP[3:0]
ACPROT[2:0]
snoop response channel:針對snoop transaction,提供response。
CRVALID/CRREADY
CRRESP[4:0]
snoop data channel:可有可無的信號,一般用在一個read clean cache的操作,返回cache中的數據。
CDVALID/CDREADY
CDDATA/CDLAST
從Shared location進行load操作:
1):master component在read address發出一個read transaction
2):interconnect通過snoop transaction確定是否有其他的master hold copy,發出snoop address
3):snoop resp/snoop data傳到interconnect,interconnect將數據傳給initial master
或者interconnect發出一個到main memory的transaction,正常的read address得到數據,傳遞給initial master
4):master檢測到RACK信號,表示transaction結束
如果其他的master中的是一個dirty的cache,那么在將數據傳遞給intial master的同時,interconnect也必須更新main memory
Shared location進行store操作:
當一個master進行store的操作時,會移除所有copy的cache line,來保證發生store操作時,只有一個unique的copy,
新的數據只能在master接下來又發出read操作時,才能讀到cache line中。
store部分cache line中的數據:(必須先得到cache line的一份copy)
1):initial master在read address發出一個ReadUnique的命令,來將其他master的copy都移除。
2):interconnect通過snoop address channel將transaction傳遞給其他的cache
3):其他的cache master通過snoop response channel和snoop data channel將數據傳遞給interconnect
4):interconnect將數據數據和resp通過read data channel傳遞給initial master
如果其他的cache line中沒有copy,則從main memory中讀取。
5):intial master發出store命令,通過RACK來表示transaction的結束。
如果本身的cache line是一個Unique的,那么不需要對其他cache進行broadcase
store完整的cache line中的數據:(cache本身是)
1):在read address發出一個MakeUnique的命令,來移除其他cache中的cache line
2):interconnect通過snoop address channel將transaction傳遞給其他的cache,
3):interconnect將其他master的resp返回給initial master,snoop data channel不需要。
4):initial master進行store操作
store操作的cache line是shared的:
1):initial master在read address channel發出CleanUnique的transaction,移除其他cache line中的copy或者dirty copy寫入main memory。
此時不會返回cache line的數據到initial master
2):interconnect通過snoop address將transaction傳遞給其他的cache,Snoop master返回resp
其他的cache line已經被移除。
a dirty cache line已經寫入main memory
3):interconnect將resp通過read data channel傳遞給initial master
4):master發出store操作
Overlapping store 操作:
如果兩個master同時對一個shared location發出store操作,由interconnect決定order
ACE中支持的各種transaction:
1):Non-snooping transaction,不會引起snoop transaction,訪問的地址可以是Non-shareable/Device
具體可以分為ReadNoSnoop和WriteNoSnoop
2):Coherency transactions,來訪問shareable address location
load:ReadClean,只接受read clean cache,如果master沒有接受dirty cache的能力時使用。
ReadNotSharedDirty,只接受clean(unique/shared),unique dirty的cache
ReadShared,接受任何類型cache
當cache為一個dirty cache line時,interconnect負責將dirty line寫入main memory
如果初始的cache line是一個Unique state,copy之后,需要將狀態修改為Shared state
建議,使用snoop channel中的rdata,將數據傳遞給initial master
store:ReadUnique,在partial cache line的store操作中,沒有copy的cache line存在,獲得cache line的copy,並且沒有copy存在
CleanUnique,在partial cache line的store操作中,有copy的cache line存在,獲得cache line的copy,並將dirty cache寫入main memory,
沒有copy cache line存在。
MakeUnique,進行full cache line的store,invalid其他的copy的cache line
訪問Shared location但是no cache copy require
ReadOnce,得到一份cache copy但是原Unique cache不需要從Unique變為Shared
WriteUnique, 在write transaction之前移除所有的cache copy,在該命令之前必須保證dirty data已經都被寫入memory
WriteLineUnique,只能寫入full cache line,其他與WriteUnique相同
3):Memory update transaction
WriteBack,write a dirty line到main memory中,來free一個cache line
WriteCLean,將dirty line寫入到main memory中,同時保存一個cache line copy
WriteEvict,將cache line寫入一個lower level的cache中,不要求寫入main memory
Evict
這四種操作,並不會要求有snoop transaction的操作。
4):Cache maintenance transactions,master通過對系統中cache component的broadcast訪問,控制cache maintenance,
稱為software cache maintenance
CleanShared,如果有dirty cache line,在接收到該transaction之后,寫入main memory,並保存cache line的copy
CleanInvalid,如果有dirty cache line,在接收到該transaction之后,寫入main memory,所有的copy cache line都被移除。
MakeInvalid,所有的copy cache line被移除,dirty cache line也不會被寫入main memory
5):Snoop Transaction,通過snoop的三個channel來進行操作,是coherency和maintenance transaction的子集。
6):Barrier Transaction,保證系統中的order和observation transaction
memory barrier,domain中的另一個master能夠觀察到所有的transaction
synchronization barrier,在該barrier transaction之前所有的transaction都必須被某個domain內的master觀察到,甚至到達slave之后,該barrier才能結束。
Trasnaction的處理過程:
1):intial master發起一個transaction
2):根據address decode直接到slave,(不需要coherency支持)
交給interconnect中的coherency支持模塊。
3):coherency transaction與其他master的transaction的順序控制,order
4):interconnect發出snoop transaction
5):每個cache master收到snoop transaction,並提供resp,甚至data
6):interconnect決定是否需要進行main memory access
7):interconenct得到resp和data
8):initial master完成transaction
ACE中新增加的術語:
1):Domain,進行coherency/barrier操作時的master的集合。domain的定義是non-overlapping的。
ACE定義了四種level的shareability domain:
Non-shareable:包含一個master component
Inner Shareable:包含額外的master component
Outer Shareable:包含所有的Inner domain外,還包含master component
System:包含系統中所有的master component
2):barrier,包含一個address phase和一個resp,但是並沒有data transfer。
master component必須在read address/write address發出一個barrier transaction
軟件中的memory fence功能,主要是當前cpu的架構都是core內亂序執行,前后兩條指令並不完全是前后完成的。
如果某些場合需要,前后的串行執行,就需要memory fence的功能;
cpu core的亂序執行對單線程的處理,不會有問題,但是多線程的並發執行模型,就會有問題。
如果flag先於*a = (int)rand()執行,那么consume的執行就會出錯。
violate表示每次flag的值,都會被更新到主memory中。但是這不能阻止memory coherence的產生。