I am looking for a good way to model a ROMPatch-like function on pvbus. This implementation should monitor the bus for return the data from its own registers if the address matches (instead of returning from the end slave device, say a RAMDevice). Otherwise, it will let the transaction through to the intended slave.
From the documents, it seems that the best way to achieve this is to have a piece of bus fabric (a slave device) that intercepts the all transaction. It will re-issue a identical transaction to the intended slave it the matching fails. Otherwise, it will return the "patch" value from its own register to the original master. This, however, will significantly impacts the simulation performance.
Is there another way to achieve this without significantly compromising the performance? Any ideas will be great! Thanks.
It's not difficult to build such a bridge to intercept the bus transactions. I would recommend using SystemC TLM-2.0.
Do you need to intercept memory ranges containing code which is executing using DMI (direct memory interface)? Disabling DMI will drastically reduce performance.
If this is for a range of memory which is for peripherals or less frequently accessed data memory which is not the main memory for code execution then performance will still be good and code can still execute with DMI on.
Sorry for the late reply.
Yes, I need to intercept some specific memory location (instead of ranges). These specific memory locations is from the main code memory.
On your suggestion of building a bridge, can you point me to some example? I have been reading on the SystemC Export but I think this is not what I want.
If you wish to patch dynamically using a listening component in the bus chain, then I'm afraid your only option is the slow way you have outlined.
If you just wish to have the effect and not have an actual device in the chain, one possibility is to patch beforehand using a CADI client that writes the specific new data to the physical address seen by the core at startup.
Noted. The patch is updated during run-time, hence, patching beforehand may not be possible.
I will try out the idea of having a listen component to check if the speed is OK.
Many thanks for the idea!