litex icon indicating copy to clipboard operation
litex copied to clipboard

Clock domain crossing for peripherals

Open rhgndf opened this issue 1 year ago • 3 comments

Is it possible to use soc.add_slave to add peripherals on a different clock domain? Possible use cases are running some peripherals such as spi flash or sd card at a higher frequency than the main cpu to allow for faster accesses.

rhgndf avatar Jan 11 '24 05:01 rhgndf

Hi @rhgndf,

for now this is not directly integrated in the framework and still have to be done manually in the user logic (ie first add a CDC to run the MMAP interface in sys_clk). This is a features that will probably be added in the future.

enjoy-digital avatar Jan 12 '24 07:01 enjoy-digital

Thanks for the reply.

If I'm not wrong to do this manually this involves making a new Wishbone/AXI CDC wrapper where all the bus lines are used in a BusSynchronizer for both directions?

rhgndf avatar Jan 12 '24 08:01 rhgndf

For Wishbone, we don't have yet a CDC module, but for AXI-Lite, you can use: https://github.com/enjoy-digital/litex/blob/master/litex/soc/interconnect/axi/axi_lite.py#L489-L527

enjoy-digital avatar Jan 12 '24 10:01 enjoy-digital