[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [partial-reconfig] ICAP programming.



Hello Robin,
I am use OPB HWICAP peripheral and nothing special.
I am not instantiating ICAP_VIRTEX2 directly in my module.
Only then I need to take care of byte order with respect to ICAP
and BRAM as someone else pointed out.
And only if you are using this peripheral, you could use
API's like XHwICAP_xxx.  If you had instantiated ICAP directly, then
you are on your own.

If you had chosen OPB HWICAP provided by Xilinx, I do not see why
it shouldnt work. It works for me, in the sense I can read Idcode from
ICAP. But reprogramming with partial bitstream doesnt work. It just
hangs. Below i have provided my code which reads from sysace and
writes onto the ICAP using drivers provided by Xilinx for this
purpose. Can anyone point issues with the below code?

#include "xparameters.h"
#include "xhwicap_reconfig.h"
#include "xhwicap_i.h"
#include "xuartlite.h"
#include "sysace_stdio.h"

#define BLOCKSIZE_BYTES (128)
#define BLOCKSIZE_WORDS (32)

char file01[] = "top0.bit"; // partial bitfile of reconfig modules
char file10[] = "top1.bit";
Xuint32 buf[BLOCKSIZE_WORDS];  /* 128 bytes temp buffer */

XHwIcap InstIcap;

int reprogram (void *fd)
{
    int bytes;

	// Should the ICAP be desynced
	XHwIcap_CommandDesync(&InstIcap);

   while (1) {
	bytes = sysace_fread(buf, 1, BLOCKSIZE_BYTES, fd);
	if (!bytes) {
	  break;
	} else {
	  XHwIcap_SetConfiguration(&InstIcap, buf, bytes/4);
	  if (bytes != BLOCKSIZE_BYTES) {
		break;
	  }
        }
    }
}


int
main(void)
{
    void* fd;
    unsigned long *lptr;
    XStatus status;
    unsigned int current;
    int i, j;
    unsigned char c;

    memset(&InstIcap, 0, sizeof(InstIcap));

    status = XHwIcap_Initialize(&InstIcap,
				XPAR_OPB_HWICAP_RECONFIG_0_DEVICE_ID,
				XHI_READ_DEVICEID_FROM_ICAP);
    if (status != XST_SUCCESS) {
	xil_printf("XHwICAP Initialize failed %x status %x\r\n",
				InstIcap.DeviceIdCode, status);
	exit(1);
    }
    xil_printf("XHwICAP initialize success id read %x\r\n",
				InstIcap.DeviceIdCode);

    current = 1;
    while (1) {
	xil_printf("dynamic reprogramming menu..\r\n");
	xil_printf("Will Program or revert back based on current config (%d)\r\n", current);
	xil_printf("press 'y' to continue....");

	do {
	  c = XUartLite_RecvByte(XPAR_RS232_UART_BASEADDR);
	} while (c != 'y');

	if (current == 1) {
	   fd = sysace_fopen(file01, "r");
	   if(0 == (int)fd) {
	 	xil_printf("file open failed");
		return 2;
	   }
	} else {
	   fd = sysace_fopen(file10, "r");
	   if(0 == (int)fd) {
		xil_printf("file open failed");
		return 2;
	   }
 	}
	if (reprogram(fd) == 0) {
	   xil_printf("programming successful\r\n");
	   current ^= 1;
	} else {
	   xil_printf("programming failed\r\n");
	}
	sysace_fclose(fd);
    }
    return 0;
}

Can anyone point issues with this piece of code?? Especially
the reprogram() function which gets the bitfile(partial) and writes
onto the ICAP?

Thanks
LN



On Sat, 29 Oct 2005, #LUO JIANWEN# wrote:

> Hello LN,
>
> I don¡¯t think there's any modification needed to be done with the partial bitstream. See this http://www.itee.uq.edu.au/~listarch/partial-reconfig/archive/2005/03/msg00027.html
>
> In fact, I have problems with ICAP too. After I initialize ICAP, I get nothing feedback. Can you share some experience how to establish the ICAP?
> My code doesn¡¯t work. Anything wrong?
>
>    XStatus Status;
>    XHwIcap *InstancePtr;
>    Xuint32 Idcode;
>
>    xil_printf(" icap self test ");
>
>    Status = XHwIcap_Initialize(InstancePtr, XPAR_OPB_HWICAP_0_DEVICE_ID, XHI_READ_DEVICEID_FROM_ICAP);
>    Idcode = XHwIcap_GetConfigReg(InstancePtr, XHI_IDCODE);
>    xil_printf("IDCODE is 0x%08x \n\n\r", Idcode);
>
> Regards,
> Robin
>
> -----Original Message-----
> From: owner-partial-reconfig@xxxxxxxxxxxxxx [mailto:owner-partial-reconfig@xxxxxxxxxxxxxx] On Behalf Of Lakshmi Narasimhan. S
> Sent: ÐÇÆÚÁù, 29 Ê®ÔÂ, 2005 0:13
> To: partial-reconfig@xxxxxxxxxxxxxx
> Subject: [partial-reconfig] ICAP programming.
>
> Hello team:
> I have a few questions about using ICAP for self reconfiguration.
>
> I got a system built successfully that does partial reconfiguration,
> if I were to send the bitfiles via JTAG port.
>
> Now I would to extend this to do self-reconfiguration.
> I have put the partial bitfile onto the FLASH and able to
> read the file from the central processor. These bitfiles
> are partial bitfiles.
>
> Onboard ICAP is working, I was able to read the IDCODE from the
> ICAP successfully.
>
> Now to my questions.
>
>    I tried dumping the contents of the bitfiles directly onto the
>    ICAP. No processing, just read them from FLASH and write onto ICAP.
>    I see no difference, infact the system hangs!!!
>
> So, is there some processing that needs to be done onto the  partial
> bitstream before sending it off to ICAP?
>
> Any inputs, snippets of code or references to design which does it
> would be greatly appreciated.
>
> Thanks
> LN
> ___________________________
> partial-reconfig mailing list
> partial-reconfig@xxxxxxxxxxxxxx
> Mailing List Archive : http://www.itee.uq.edu.au/~listarch/partial-reconfig/
>

___________________________
partial-reconfig mailing list
partial-reconfig@xxxxxxxxxxxxxx
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/partial-reconfig/