Jump to content
  • 0

Partial reconfiguration and Copying Arrays


272627yjaaiyaiy

Question

#define BIT_SIZE 401220
 
 
char size1[BIT_SIZE];
char size2[BIT_SIZE];
char bitStreamBuffer[BIT_SIZE];
 
int main(){
 
//code to Initilize the PCAP
 
//To find the address to transfer my bitstreams
xil_printf("Address of the file1 is %0x\n\r",size1);
xil_printf("Address of the file2 is %0x\n\r",size2);
xil_printf("Address of the final file is %0x\n\r",bitStreamBuffer);
xil_printf("Press enter\n\r");
scanf("%c",&c);
 
xil_printf("Enter your choice\n");
    	xil_printf("*****************\n");
    	xil_printf("1.bitstream 1\n2.bitstream 2\n");
    	scanf("%d",&choice);
    	xil_printf("choice:%d\n\r",choice);
    	switch(choice){
    		case 1:
//method 1 to transfer the data to another array
    		memcpy(bitStreamBuffer, size1, BIT_SIZE);
 
//method 2 to transfer the data to another array
/*
		for (int i; i<=BIT_SIZE; i++)
		{
			bitStreamBuffer[i] = size1[i];
		}
*/
    		break;
    	case 2:
    		//method 1 to transfer the data to another array
    		memcpy(bitStreamBuffer, size1, BIT_SIZE);
			break;
    	default:
    		xil_printf("Wrong choice\n");
    		break;
    	}
 
//code to do the reconfiguration
	XDcfg_IntrClear(&DcfgInstance, XDCFG_IXR_D_P_DONE_MASK|XDCFG_IXR_DMA_DONE_MASK);
 
	Status = XDcfg_Transfer(&DcfgInstance, bitStreamBuffer, BIT_SIZE , (u8 *)XDCFG_DMA_INVALID_ADDRESS, 0, XDCFG_NON_SECURE_PCAP_WRITE);
	xil_printf("status after = %d\n",Status);
	if (Status != XST_SUCCESS) {
		xil_printf("PR failed\n\r");
		return XST_FAILURE;
	}
 
	Status = XDcfg_IntrGetStatus(&DcfgInstance);
	while ((Status & XDCFG_IXR_DMA_DONE_MASK) != XDCFG_IXR_DMA_DONE_MASK)
	{
		Status = XDcfg_IntrGetStatus(&DcfgInstance);
	}
	Status = XDcfg_IntrGetStatus(&DcfgInstance);
	while ((Status & XDCFG_IXR_D_P_DONE_MASK) != XDCFG_IXR_D_P_DONE_MASK)
	{
		Status = XDcfg_IntrGetStatus(&DcfgInstance);
	}
 
//rest of the code
 
return 0;
}

Hello Everyone,

 

I am facing rather strange problem while developing code for partial reconfiguration. Here is the code. I am using PCAP interface and Xdvcfg library for reconfiguration.

I have two partial bitstreams which I transfer to DDR memory to the addresses( via command: dow -data file1.bin 0x310C04) of size1 and size2 array (the exact adresse I get from the first part of the code). BIT_SIZE  is the size of my partial bitstreams. all the time the bitstreams transfers to DDR successfully.

 

After that I choose which bitstream I want to program and transfer that bitstream data to bitStreamBuffer array.

 

The problem is when I do data transfer to third array step, than it does not do the reconfiguration and it works as before. but when I directly use either size1 or size2 array in XDcfg_Transfer function for reconfiguration, it reconfigures the FPGA.

 

I have used 2 different method to transfer the bitstreams as shown in the code and checked the data in bitStreamBuffer array and it works but it just not does the reconfiguration.

 

Theoretically, this should work but I don't know what I am doing wrong here. Can someone point out my mistakes or suggest me a solution, It would be a great help to me.

 

Thank you!

 

PS: I have written manually some of the code here, so please ignore any syntax errors. Moreover, I am happy to provide bitstreams for reference.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...