cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
5,248 Views
Registered: ‎12-13-2011

Is it possible to implement an OCP like custom interface?

I'm trying to implement an OCP like interface, but I have some issues with the timings. At a starting point I have implemented a simple WR and RD request:

#include "ap_cint.h"
#include "ap_utils.h"

#define	BUF_SIZE	10
	static uint64 buf[BUF_SIZE];

void test_slave3(
		uint32 mAddr,
		uint3 mCmd,
		volatile uint64 *mData,
		volatile uint1 *sCmdAccept,
		volatile uint1 *sDataAccept,
		volatile uint64 *sData,
		volatile uint2 *sResp)
{
#pragma HLS INTERFACE ap_ctrl_none port=return
#pragma HLS INTERFACE ap_none port=mData #pragma HLS INTERFACE ap_none port=sCmdAccept #pragma HLS INTERFACE ap_none port=sDataAccept #pragma HLS INTERFACE ap_none port=sData #pragma HLS INTERFACE ap_none port=sResp uint1 sCmdAcceptReg = 1; uint1 sDataAcceptReg = 0; uint64 sDataReg = 0; uint2 sRespReg = 0; switch (mCmd) { case 1: if (mAddr < BUF_SIZE) { buf[mAddr] = *mData; } break; case 2: if (mAddr < BUF_SIZE) { sDataReg = buf[mAddr]; sRespReg = 1; } break; case 0: default: sCmdAcceptReg = 1; sDataAcceptReg = 1; sDataReg = 111; sRespReg = 0; break; } *sCmdAccept = sCmdAcceptReg; *sDataAccept = sDataAcceptReg; *sData = sDataReg; *sResp = sRespReg; }

 The problem is that the resulting design gets a minimum interval of 2 cycles instead of 1, which is not acceptable for a "0 request accept latency". It seems that the FSM is swapping between 0 and 1 by each clock, independent on the mCmd applied.

 

Any idea how to solve this?

 

Thanks,

Christian

0 Kudos
1 Reply
Highlighted
Xilinx Employee
Xilinx Employee
5,177 Views
Registered: ‎03-24-2010

If you need to achieve II=1 for the function, you need add PIPELINE directive to the function. Such as:

 

void test_slave3(
  uint32 mAddr,
  uint3 mCmd,
  volatile uint64 *mData,
  volatile uint1 *sCmdAccept,
  volatile uint1 *sDataAccept,
  volatile uint64 *sData,
  volatile uint2 *sResp)
{
#pragma HLS PIPELINE
#pragma HLS INTERFACE ap_ctrl_none port=return
#pragma HLS INTERFACE ap_none port=mData
#pragma HLS INTERFACE ap_none port=sCmdAccept
#pragma HLS INTERFACE ap_none port=sDataAccept
#pragma HLS INTERFACE ap_none port=sData
#pragma HLS INTERFACE ap_none port=sResp

Regards,
brucey
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos