I'm trying to figure out how can I read from and write to memory in RISCV when I'm using RoCCIO. But I couldn't clearly get what is happening. Especially how can I address the memory or how should I work with memory tag
.
Are there any resources that I can find how I can transfer data between Rocket core and my Accelerator?
In the uncore/src/main/scala/consts.scala
path they have mentioned different type of memory cmd
. But what else?
For example I want to pass starting address of an array and number of elements that I plan to fetch into the accelerator and then start fetching them. What signalling should I use?
Thanks
Within the RoCC interface, the
mem
field is a connection to the L1 cache. Thedmem
field is a connection to the L2 cache. Which one you want to use depends upon the memory bandwidth requirements of your accelerator.Rocket and the RoCC accelerator can either share data through the caches (remember to use a
fence
instruction on the Rocket core so the memory ordering is correct) or you can directly give data to Rocket through theresp
field in the RoCCIO.The L1 cache's IO can be found in Rocket's (https://github.com/ucb-bar/rocket/blob/master/src/main/scala/nbdcache.scala) whereas the L2 IO can be found in the uncore's (https://github.com/ucb-bar/uncore/blob/master/src/main/scala/tilelink.scala).
Although I don't know which memory
tag
you are referring to, typically thetag
is passed through the memory system and returned to you with the response untouched (if you have multiple requests inflight, this returning tag helps you identify which is which).I suspect if you want to fetch an array of data, you will need a state machine to request each individual address in your accelerator. Unless you go through the L2 cache interface, in which case I believe it comes in cache-line sizes.