Exemplo n.º 1
0
        public void ConfigureFPGA(XilinxBitstream bitstream, statusUpdate target)
        {
            for(int i=0; i < bitstream.NumPages; ++i)
            {
                PageQualifier type;

                //get the current page to be configured
                byte[] page = bitstream.getPage(i);

                //determine any special characteristics of this page
                if(i == 0)
                {
                    //First page starts configuration.
                    type = PageQualifier.First;
                }
                else if(i == bitstream.NumPages - 1 )
                {
                    //Last page finalizes configuration- and has a slightly different structure.
                    type = PageQualifier.Last;

                    //As the last page isn't neccesarily full, it is prefixed with a byte
                    //specifying its length.

                    //create a page buffer to accomodate the extra byte
                    byte[] newPage = new byte[page.Length + 1];

                    //copy the old data
                    page.CopyTo(newPage, 1);

                    //and prefix the page-data appropriately
                    newPage[0] = (byte)page.Length;

                    //replace the pagebuffer with the new, updated pagebuffer
                    page = newPage;
                }
                else
                {
                    type = PageQualifier.Normal;
                }

                //If a delegate has been provided to accept status updates, inform it of the update.
                if (target != null)
                    target((float)i / (float)(bitstream.NumPages - 1));

                //send the configuration data to the FPGA
                device.SendFPGAPage(page, type);

            }
        }
Exemplo n.º 2
0
 public void ConfigureFPGA(XilinxBitstream bitstream)
 {
     ConfigureFPGA(bitstream, null);
 }