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

[partial-reconfig] Implementing PR design for ML410



Hi, all
I am making a partial reconfiguration design. I am using ISE, EDK 8.2. The
design is PPC based. Also the OPB_ICAP is used. It is similar with the
reference design of ML403 on Xilinx website. However, I am using ML410,
which is V4FX60.

I used the hwicap_init_test() function in the C code in the Lab 3 of ML403
design, but can not pass that. Does anyone have ideas for that?

The print-out message is:

****
-- ICAP Base Addr: 100E0000
Device is already initialized.-- ICAP Base Addr: 100E0000
-- Reading ICAP Status

 Status: 0
HWICAP Status Register:
   cfgerr_n: 0
   dalign: 0
   rip: 0
   in_abort_n: 0
   Always 1: 0
   Always 1: 0
   Always 1: 0
   Always 1: 0
   Done: 0
-- Reading Device IDCODE through ICAP:
Creating cmd bitstream...
Sending cmd bitstream to ICAP...
4.Failed to write: 21
Xilinx Partial Reconfiguration Demo (1 PRR and 2 RMs)
Thank you.

****

The code I used is shown as follow:

Could you please give me some hints for what should I modify for the
V4FX60 chip? Thank you very much

/***************************** Include Files
*********************************/
#include <stdio.h>
#include <string.h>

#include <xparameters.h>
#include "xhwicap.h"
#include "xhwicap_i.h"
//#include "xhwicap_cf.h"
#include <xstatus.h>
#include "xuartlite_l.h"

#define XHI_TARGET_DEVICE           XHI_XC4VFX60

#define XHI_EX_BITSTREAM_LENGTH     5
#define XHI_EX_ONE_WORD             1
#define XHI_EX_ADDRESS_OFFSET       0

static XHwIcap myICAP;

int hwicap_init_test(void)
{
         XStatus Status;
          Xuint32 Packet;


         xil_printf("-- ICAP Base Addr: %x\r\n", myICAP.BaseAddress);
         Status = XHwIcap_Initialize(&myICAP, XPAR_OPB_HWICAP_0_DEVICE_ID,
XHI_XC4VFX60);
         if (Status == XST_DEVICE_IS_STARTED)
         {
          xil_printf("Device is already initialized.");
         }
         else if (Status != XST_SUCCESS)
         {
          xil_printf("Failed to initialize: %d\r\n", Status);
          return XST_FAILURE;
         }

         if (Status == XST_SUCCESS) {
          xil_printf("ICAP initilized\r\n");
         }

         xil_printf("-- ICAP Base Addr: %x\r\n", myICAP.BaseAddress);

         xil_printf("-- Reading ICAP Status\r\n");

         Status = XHwIcap_mGetStatusReg(myICAP.BaseAddress);

         xil_printf("\r\n Status: %d\r\n", Status);
         xil_printf("HWICAP Status Register:\r\n");

         xil_printf("   cfgerr_n: %d\r\n",   (Status & 0x100) ? 1 : 0);
         xil_printf("   dalign: %d\r\n",     (Status & 0x80 ) ? 1 : 0);
         xil_printf("   rip: %d\r\n",        (Status & 0x40 ) ? 1 : 0);
         xil_printf("   in_abort_n: %d\r\n", (Status & 0x20 ) ? 1 : 0);
         xil_printf("   Always 1: %d\r\n",   (Status & 0x10 ) ? 1 : 0);
         xil_printf("   Always 1: %d\r\n",   (Status & 8    ) ? 1 : 0);
         xil_printf("   Always 1: %d\r\n",   (Status & 4    ) ? 1 : 0);
         xil_printf("   Always 1: %d\r\n",   (Status & 2    ) ? 1 : 0);
         xil_printf("   Done: %d\r\n",       (Status & 1    ) ? 1 : 0);

         //
------------------------------------------------------------------------------------
         xil_printf("-- Reading Device IDCODE through ICAP:\r\n");

         xil_printf("Creating cmd bitstream...\r\n");
   /*
    * Write bitstream to bram
    */
         Packet = XHwIcap_Type1Read(XHI_IDCODE) | 1;
         XHwIcap_StorageBufferWrite(&myICAP, 0, XHI_DUMMY_PACKET);
         XHwIcap_StorageBufferWrite(&myICAP, 1, XHI_SYNC_PACKET);
         XHwIcap_StorageBufferWrite(&myICAP, 2, Packet);
         XHwIcap_StorageBufferWrite(&myICAP, 3, XHI_NOOP_PACKET);
         XHwIcap_StorageBufferWrite(&myICAP, 4, XHI_NOOP_PACKET);

         xil_printf("Sending cmd bitstream to ICAP...\r\n");

   /*
    * Transfer Bitstream from BRAM to ICAP
    */
   Status = XHwIcap_DeviceWrite(&myICAP, XHI_EX_ADDRESS_OFFSET,
                                XHI_EX_BITSTREAM_LENGTH);
   if (Status != XST_SUCCESS)
   {
       xil_printf("Failed to write: %d\r\n", Status);
       return XST_FAILURE;
   }


   xil_printf("Reading from ICAP...\r\n");

   /*
    * Now readback one word into bram position XHI_EX_BITSTREAM_LENGTH
    */
   Status = XHwIcap_DeviceRead(&myICAP, XHI_EX_BITSTREAM_LENGTH,
XHI_EX_ONE_WORD);

   if (Status != XST_SUCCESS)
   {
       xil_printf("Failed to read: %d\r\n", Status);
       return XST_FAILURE;
   }

   /*
    * Return the Register value
    */
   Packet = XHwIcap_StorageBufferRead(&myICAP, XHI_EX_BITSTREAM_LENGTH);

   xil_printf("Device IDCODE is: %x\r\n", Packet);


 //
------------------------------------------------------------------------------------
   xil_printf("-- Reading Device IDCODE through ICAP:\r\n");

   xil_printf("Creating cmd bitstream...\r\n");
   /*
    * Write bitstream to bram
    */
   Packet = XHwIcap_Type1Read(XHI_IDCODE) | 1;
   XHwIcap_StorageBufferWrite(&myICAP, 0, XHI_DUMMY_PACKET);
   XHwIcap_StorageBufferWrite(&myICAP, 1, XHI_SYNC_PACKET);
   XHwIcap_StorageBufferWrite(&myICAP, 2, Packet);
   XHwIcap_StorageBufferWrite(&myICAP, 3, XHI_NOOP_PACKET);
   XHwIcap_StorageBufferWrite(&myICAP, 4, XHI_NOOP_PACKET);

   xil_printf("Sending cmd bitstream to ICAP...\r\n");

   /*
    * Transfer Bitstream from BRAM to ICAP
    */
   Status = XHwIcap_DeviceWrite(&myICAP, XHI_EX_ADDRESS_OFFSET,
                                XHI_EX_BITSTREAM_LENGTH);
   if (Status != XST_SUCCESS)
   {
       return XST_FAILURE;
   }


   xil_printf("Reading from ICAP...\r\n");

   /*
    * Now readback one word into bram position XHI_EX_BITSTREAM_LENGTH
    */
   Status = XHwIcap_DeviceRead(&myICAP, XHI_EX_BITSTREAM_LENGTH,
XHI_EX_ONE_WORD);

   if (Status != XST_SUCCESS)
   {
       return XST_FAILURE;
   }

   /*
    * Return the Register value
    */
   Packet = XHwIcap_StorageBufferRead(&myICAP, XHI_EX_BITSTREAM_LENGTH);

   xil_printf("Device IDCODE is: %x\r\n", Packet);
}

void usleep(unsigned int useconds)
{

  int i,j;
  for (j=0;j<useconds;j++)
    for (i=0;i<26;i++) asm("nop");
}
int getNumber (){

        Xuint8 byte;
        Xuint8 uartBuffer[16];
        Xboolean validNumber;
        int digitIndex;
        int digit, number, sign;
        int c;

        while(1){
                byte = 0x00;
                digit = 0;
                digitIndex = 0;
                number = 0;
                validNumber = XTRUE;

                //get bytes from uart until RETURN is entered

                while(byte != 0x0d){
                        byte =
XUartLite_RecvByte(XPAR_RS232_UART_1_BASEADDR);
                        uartBuffer[digitIndex] = byte;
                        XUartLite_SendByte(XPAR_RS232_UART_1_BASEADDR,byte);
                        digitIndex++;
                }

                //calculate number from string of digits

                for(c = 0; c < (digitIndex - 1); c++){
                        if(c == 0){
                                //check if first byte is a "-"
                                if(uartBuffer[c] == 0x2D){
                                        sign = -1;
                                        digit = 0;
                                }
                                //check if first byte is a digit
                                else if((uartBuffer[c] >> 4) == 0x03){
                                        sign = 1;
                                        digit = (uartBuffer[c] & 0x0F);
                                }
                                else
                                        validNumber = XFALSE;
                        }
                        else{
                                //check byte is a digit
                                if((uartBuffer[c] >> 4) == 0x03){
                                        digit = (uartBuffer[c] & 0x0F);
                                }
                                else
                                        validNumber = XFALSE;
                        }
                        number = (number * 10) + digit;
                }
                number *= sign;
                if(validNumber == XTRUE){
                        return number;
                }
                print("This is not a valid number.\n\r");
        }
}

void menu(void)
{
         xil_printf("--------------------------------------------------------\r\n");
         xil_printf("      Press m or M for multiplication
configuration\n\r");
         xil_printf("      Press a or A for addition configuration\n\r");
         xil_printf("      Press b or B for blanking configuration\n\r");
         xil_printf("      Press o or O to enter operands and display
result\n\r");
         xil_printf("      Press q or Q to quit the demo\n\r");
}


int main()
{

    char key, key1;
    XHwIcap MyIcap;
    XStatus Status;
    int rc, innerloop;

    /* Obtain access to the ICAP device. */


    Status = XHwIcap_Initialize(&MyIcap, XPAR_OPB_HWICAP_0_DEVICE_ID,
                                XHI_TARGET_DEVICE);
    if (Status == XST_DEVICE_IS_STARTED) {
        xil_printf("ICAP Device is already initialized.");
    } else if (Status != XST_SUCCESS) {
        xil_printf("Failed to initialize ICAP: %d \n\r",Status);
        exit(-1);
    }

    hwicap_init_test();

    /* Print out title bar. */
         xil_printf("\r\n\r\n");
         xil_printf("Xilinx Partial Reconfiguration Demo (1 PRR and 2
RMs)\r\n");
         //menu();



    /* User is done with us... */
    xil_printf("Thank you. \n\r");


}

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