I am using cyclone V to perform read/write on dual port RAM (HPS_master->FPGA_slave). For 32bit data, it able to perform by using ioread32 and iowrite32 but it not meet our targeted speed for data transfer(it takes longer cycle in signal tab after tuning only up to 400MHz).Cyclone V is using ARM Cortex-A9 MPCore Processor(32bit) but as stated in the datasheet, the AXI bus is able to configure up to 64bit. asm/io.h only supported up to ioread32/iowrite32. We try to configure 64bit in the HPS-FPGA using altera software and i try read/write using code below, but i am getting wrong data. Any proper solution and method to verify this?
static void iowrite64(u64 val, u64 addr)
{
iowrite32((u32)val, (u32) addr);
iowrite32(val >> 32, (u32)addr + 1);
}
static u64 ioread64 (u64 addr)
{
return ioread32(addr) | ((u64)ioread32((u32)addr + 1) << 32);
}
UPDATE/SOLUTION: We are able to read 64bit data from logram. Below are the changes we made. -driver/amba/bus.c, we change u32 to u64. -we add another inline function in io.h
static inline u64 __raw_readq(const volatile void __iomem *addr)
{
u64 val;
asm volatile("ldrd r2, %0" : "+Qo" (*(volatile u64 __force *)addr));
register u32 v1 asm ("r2");
val = v1;
register u32 v2 asm ("r3");
val=(val<<32) | v2;
return val;
}
-printk is able to print up to 32bit but we print 2 times.