Adding Array in FPGA

I noticed there isn't a add array elements in FPGA and was wondering how I can go about doing this task another way?  Looking for something wiht less overhead as well.  Any takers?  I tried using a for loop, index array, then run that index into an addition element, from the additioin element to a shift register, then the shift register into the other end of the add element.  This works for the first N (for loop interation), but after that, it just keeps climbing in values.  Any ideas?
guilio_2008
Message Edited by guilio_2008 on 09-16-2008 11:59 AM

Another option would be to use a memory or FIFO block which is configured with the expected maximum number of elements.
Depending on your use case you may use the one or the other
Thanks,
ThSa
http://www.newgistics.com

Similar Messages

  • Solaris 10 01/06 (grub booting) on HP DL360 - adding array drivers to DVD

    I'm trying to install to a DL360. This has been successful using the DU diskette for the HP Smart Array. However, I want to automate the install from DVD so that it loads the drivers without using a floppy (or another CD/DVD).
    I have modified the /boot/x86.miniroot using root_archive to extract the miniroot, then adding the smart array drivers. This was then re-packaged and a new DVD made using mkisofs.
    This works - it boots from DVD, starts the install, and the array disk is visible. The install continues as normal.
    However, after a reboot I get the grub menu and it doesn't work. The failsafe works - presumably because this is just a copy of the x86.miniroot on the DVD - but the Solaris 10 install on disk does not boot - it starts to boot, I get the
    Generic_118844-26 i86pc i386 i86pc
    message and then the server reboots - I am assuming this is the point at which it switches to using the disk and it is not found.
    I have seen from the grub menu that it is attempting to load /platform/i86pc/boot_archive, and this file is installed/updated by the installation, but why are the Snart Array drivers not being loaded?
    Does anyone have any ideas?

    Hi Asgorath,
    Unfortunately I do not have an answer for you but I
    am experiencing the identical problem on a HP
    Proliant BL25p Blade Server. Here is my hardware
    config:
    CPU - Dual Opteron 2.6 Single Core
    Memory - 16gb
    Controller - HP Smart Array 6i
    Logical drives - 1 (2x72gb RAID1+0)
    I have tried the same things as you and I still get
    intermittant boots. Power on and off does not always
    work as the system still hangs. It's totally hit or
    miss. Once it soes boot it seems to work fine. I have
    also installed the latest Solaris 10 for x86 Patch
    Cluster in hopes that some of the kernal patches
    would fix the problem. So far no luck as the system
    continues to hang...HARD!! HP was out to my site
    today and the Eng. is going back to the group that
    qualified Solaris10 on the HP Blades and see if they
    have any input. If I receive anything back I will
    post it here. I know this post is late and if you
    have resolved please post your fix.Hi doc42755,
    I have not come up with a solution as of yet, if I do come up with a solution i will most certainly post it here.
    However, if you find the solution could you let us know in this thread aswell.
    Thanks
    Asgaroth

  • Parsing Boolean Array in FPGA

    Hi All,
    Although I have programmed in LabVIEW many times, I am quite a novice when it comes to programming on an FPGA, and I have been learning as I go (which up to this point has worked with little issue).  However, I have been unable to resolve my latest issue, and the more I read about the FPGA, the less certain I am that what I am trying to do in even possible.
    The task at hand involves reading in a set number of bits from the digital input/output lines of the FPGA and parsing these bits into specific words/"bytes."  For the purposes of the VI that I have attached, I have faked reading in a set number of bits by supplying three 26-bit words (78 bits total) that have been been defined on the front panel.  After supplying the specified bits, I am trying to parse the bit array into specific words that are given by the following logic:
    1.  Search for a start bit of 0 (false bit).
    2.  Once the start bit of 0 (false bit) is found the word that is trying to be parsed is the next 10 bits.
    3.  After the start bit and ten data bits is a stop bit of 1 (true bit).
    4.  Repeat steps 1-3, five additional times.
    From the above logic, there should be six parsed words in total for the supplied VI.  Unfortunately, I cannot simply take 12 bits (1 start bit, 10 data bits, and 1 stop bit) at a time, as the number of filler bits in between successive words is variable.  The VI that I have supplied is one version of how I have proposed to accomplish the aforementioned logic, but I cannot compile the VI/project, as I continually receive errors that "Arrays must be fixed in size."  To my knowledge, all the arrays in the VI have been preallocated and the logic seems deterministic.
    If anyone has any suggestion as to why this VI is not compiling, I would be greatly appreciative.  Thank you in advance for taking the time to look at this, and I look forward to resolving this issue.
    With gratitude,
    Gregory
    Solved!
    Go to Solution.
    Attachments:
    Example_Bit_Parser.vi ‏9 KB

    Unfortunately, you're going to have to rework this VI to make it run on an FPGA.  You can't relocate arrays in memory in an FPGA the way you can on a PC.  You have a variable-sized array as the output of delete from array, because the length input isn't fixed at compile time.  Also, two dimensional arrays aren't allowed.  Remember that when you code for an FPGA you're actually writing the hardware - each value in an array is essentially a circuit (this is my overly-simplified understanding).  The compiler can't allocate the right number of wires to carry an array if it can't determine the array size.  The array isn't in memory so there's no way to rearrange it at run-time.
    There are a couple of ways you could work around this, all of which will require iterating through every element in the input array.  You could use an FPGA FIFO, and only put the values into the FIFO that are data (ie, loop until you hit a start bit, put the next 10 values into the FIFO).  Then on the other side of the FIFO, possibly in a separate loop, read 10 bits at a time to get your data words.  Another approach is to rearrange the array as you go.  Keep track of the current location in the input array.  Whenever you hit a start bit, move the next 10 bits (you may have to do this one at a time) to the current location in the input array, incrementing the current location each time.  When you've finished all the input, all the data words will be at the beginning of the array in 10-bit units, which you can then split out as needed.

  • Added Array, Now What?

    Forgive my incompetence about adding an array, but all the posts about people losing everything has me apprehensive about restarting the system. I do have stuff backed up, but do not want to create a mess if something goes wrong at this point.
    I added a RAID 5 array, filling out the lower half of an Xserve. Raid admin recognizes it under arrays & drives. The arrays are listed under the picture as 1 RAID 5 and 2 RAID 5.
    Now what?
    Do I just use "Add System" in Raid Admin? (right now it shows one system with an address) or, do I shut everything down, restart and then run disk utility according to the manual?

    You should enable journaling. It doesn't affect performance in any meaningful way.
    What journaling DOES do is prevent the system from having to run 'fsck' on the disk, should it be shut down uncleanly. On a 1 TB volume, fsck can take an hour (or hours!) to run, and the system cannot finish booting until this time, so what you'll see is that your system appears to "hang" at boot time, and unless you know what's going on and have the patience to wait 1 or 2 or 3 hours until it completes, will probably panic and think your machine is hosed. I've seen it way too many times. Enable journaling, please

  • Need help with adding arrays to invoice.java please willing to pay?

    Using your Invoice class created in lab02, write a client program that allows the user to input three Invoice objects into an array of Invoice objects. After you have inputted all of the invoices, print a heading and then output all of the array elements (Invoice objects) by calling the method from your Invoice class that displays all of the data members on a single line using uniform field widths to insure that all Invoice objects will line up in column format (created in Lab04). At the end of the loop, display the calculated total retail value of all products entered in the proper currency format.
    Example of possible program execution:
    Part Number : WIDGET
    Part Description : A fictitious product
    Quantity : 100
    Price          : 19.95
    (etc.)
    Example of possible output
    Part Number          Part Description          Quantity          Price     Amount
    WIDGET          A fictitious product     100          19.95     199.95
    Hammer               9 pounds          10          5.00     50.00
    (etc.)
    Total Retail Value:                                   249.95
    This is what i have so far Invoice Test
    //Lab 2 InvoiceTest.java
    //Application to test class Invoice.
    //By Morris Folkes
    public class InvoiceTest
    public static void main( String args[] )
    Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );
    // display invoice1
    System.out.println( "Original invoice information" );
    System.out.printf( "Part number: %s\n", invoice1.getPartNumber() );
    System.out.printf( "Description: %s\n",
    invoice1.getPartDescription() );
    System.out.printf( "Quantity: %d\n", invoice1.getQuantity() );
    System.out.printf( "Price: %.2f\n", invoice1.getPricePerItem() );
    System.out.printf( "Invoice amount: %.2f\n",
    invoice1.getInvoiceAmount() );
    // change invoice1's data
    invoice1.setPartNumber( "001234" );
    invoice1.setPartDescription( "Blue Hammer" );
    invoice1.setQuantity( 3 );
    invoice1.setPricePerItem( 19.49 );
    // display invoice1 with new data
    System.out.println( "\nUpdated invoice information" );
    System.out.printf( "Part number: %s\n", invoice1.getPartNumber() );
    System.out.printf( "Description: %s\n",
    invoice1.getPartDescription() );
    System.out.printf( "Quantity: %d\n", invoice1.getQuantity() );
    System.out.printf( "Price: %.2f\n", invoice1.getPricePerItem() );
    System.out.printf( "Invoice amount: %.2f\n",
    invoice1.getInvoiceAmount() );
    Invoice invoice2 = new Invoice( "5678", "PaintBrush", -5, -9.99 );
    // display invoice2
    System.out.println( "\nOriginal invoice information" );
    System.out.printf( "Part number: %s\n", invoice2.getPartNumber() );
    System.out.printf( "Description: %s\n",
    invoice2.getPartDescription() );
    System.out.printf( "Quantity: %d\n", invoice2.getQuantity() );
    System.out.printf( "Price: %.2f\n", invoice2.getPricePerItem() );
    System.out.printf( "Invoice amount: %.2f\n",
    invoice2.getInvoiceAmount() );
    // change invoice2's data
    invoice2.setQuantity( 3 );
    invoice2.setPricePerItem( 9.49 );
    // display invoice2 with new data
    System.out.println( "\nUpdated invoice information" );
    System.out.printf( "Part number: %s\n", invoice2.getPartNumber() );
    System.out.printf( "Description: %s\n",
    invoice2.getPartDescription() );
    System.out.printf( "Quantity: %d\n", invoice2.getQuantity() );
    System.out.printf( "Price: %.2f\n", invoice2.getPricePerItem() );
    System.out.printf( "Invoice amount: %.2f\n",
    invoice2.getInvoiceAmount() );
    } // end main
    } // end class InvoiceTest

    i suck in java There are 2 possible reasons for this:
    1. you haven't studied
    2. you aren't cut out for programming
    and there r hardly any tutors at my school. plus i work 2 jobs day n night. Please, I'm only want help thats allYou have the help of the ENTIRE WORLD COMMUNITY right here, right now. But you're not willing to make any effort whatsoever. You think people will help or even respect you? You may fail your class and you may fail in life!
    Cheaters don't win and winners don't cheat!

  • Hi, I'm having a problem adding arrays.

    I am using the double-click property, and after each double click I want to add up each new array which has just been opened from each file. How can I add each new array to the previous one after every double-click??

    Your confusing how and when to use shift registers and locals...The logic should be as follows;
    If new file has been double-clicked read the array from it and add it with the results from the previous addition. Wire the result to a shift register and use the left terminal of the shift register to get the previous result used in the addition...
    Attached is a picture showing this.
    You may also want to put the save case outside the double-clicked case so that you can save whenever you want and not just the next time you double-click(?)..
    MTO
    Attachments:
    partially_corrected.gif ‏46 KB

  • Adding arrays - confusing question

    I am in the process of writing a java program where I have to add arrays. The question asks:
    This program asks you to assume that your computer has the very limited capability of being able to read and write only single-digit integers and to add together two integers consisting of one decimal digit each. Write a program that can read in two integers of up to 40 digits each, add these digits together, and display the result. Test your program using pairs of numbers of varying lengths. You must use arrays in this problem.
    I think I understand up to there is says"Write a program that can read in two integers of up to 40 digits each" from there I am lost.
    Can anyone help explain what is needed?
    This is what i have so far:
    import java.util.*;
    public class add
        public static void main(String[] args)
          Scanner in = new Scanner(System.in);
          int x = in.nextInt();
          int y = in.nextInt();
            int[] a = {x};
            int[] b = {y};
            int[] ab = new int[a.length + b.length];
            System.arraycopy(a, 0, ab, 0, a.length);
            System.arraycopy(b, 0, ab, a.length, b.length);
            System.out.println(Arrays.toString(ab));
    }

    Yeh, sorry about that didn't have the time to go ahead and drag some of the code over when I first found this forum, first thing I tried a quick compile and run just to see what problems I'd get and I got this runtime error of: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 7
         at java.lang.String.charAt(String.java:687)
         at Joseph_Ryan_P2.main(Joseph_Ryan_P2.java:36)
    I threw in some print statements to see how far it gets before the error occurs and it seems to be right before the for loop(see code below)
    In this program I'm reading in from a text file that will read two numbers from the same line that are seperated by a space and eventually add them, is the best way to do that by using a tokenizer or some sort of space delimiter? Or is there an easier way? If the tokenizer is best how would i go about that I haven't learned too much about them besides the fact that they exist so far.
    Thanks for any help you or suggestions you guys can give.
    //Joseph_Ryan_P2.java
    //Big Integer Program
    //Description:
    //     Design and implement a BigInteger class that can add and subtract integers with up to 25 digits. Your
    //     class should also include methods for input and output of the numbers.
    // Must Use Arrays
    import java.io.*;               //neccessary imported libraries
    import java.util.*;
    public class Joseph_Ryan_P2          
         public static void main(String[] args)          //the programs main method
              try
                   Scanner scan = new Scanner(new File("BigInts")); //Scanner to read in from plaintext file
              String numline = scan.next();
              int x=0;
              int [] big1 = new int [numline.length()];
              System.out.println(numline);
                   int [] big2 = new int [numline2.length()];
                   String numline2= scan.nextLine();
                   System.out.println(numline2);
              for(int i = numline.length() - 1; i >= 0; i++)
              char current = numline.charAt(i);
              int d = (int) current - (int) '0';
                   big1[i] = d;
              }//end for loop
              }//end try
              catch(FileNotFoundException exception)
    System.out.println("The file could not be found.");
    catch(IOException exception)
    System.out.println(exception);
    } //end catch statements
         }//end main
    }//end class

  • Adding array value

    I want to append a number to an array. How could I accomplish this?

    Problem.. =(
    import java.util.ArrayList;This is at the top of my program
    I'm creating a new ArrayList object:
    ArrayList multiples = new ArrayList();Then I'm running this line of code:
    multiples.add(x);x is an integer value
    I compile using -Xlint:unchecked and get this error:
    warning [unchecked] unchecked call to add(E) as a member of the raw type java.util.ArrayList
    multiples.add(x);
    ^
    I don't know what to do here. I searched google but I couldn't find anything helpful. Possibly one of you guys know? =)

  • Adding array item when button clicked

    When a button is clicked I want to take text from 4 different text fields and add them to the end of their respective arrays. I declared the array's as class arrays in a different JFrame, is it possible to take the text from this new JFrame's Textfields and add it to the arrays. Here's the code
      NewJFrame.AirlineName.add(jTextField1.getText());NewJFrame is the original frame, then it pops up a new frame when a button is clicked. They add text to the textfields and click add. It will then take the text and add it to the arrays.

    rhino17 wrote:
    That might be the problem. I'm creating a whole new Jframe, not a dialog box. Using a dialog will probably make the GUI work more smoothly and will allow you to display and retrieve information modally, but won't change basic object to object communication.
    I'm new to this whole Java Business ( HS student, learning w/o an actual teacher) . I'll do reasearch on a dialog box, or if u have a quick link to a tut that would be great. [How to Make Dialogs|http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html]
    And i did not understand BDLH's original message, he sounded like he was trying to be a ... you get the point.If you stay around this board for long, you'll see that BDLH is one of the nicer posters around. He'll kid at times but almost always in a gentle fashion. I however can be a flaming asshole at times.
    Is there a way to retrieve more than one input value?Absolutely. For instance if you used a JOptionPane, you could place a JPanel within it that has several JTextFields, and easily extract this information. But note that there are always messy quick and dirty ways of doing this that don't scale well as your project grows or changes. What BDLH was suggesting was to keep your logic and your GUI separate and your class coupling loose so as to avoid these pitfalls. Also know this. If you see him disagreeing with something someone here says (including or especially me), I'd go with his interpretation over mine any day as he's a pro.

  • Adding FPGA reference causes problems

    Hi,
    I have a programme which runs on the RT engine and calls up an FPGA reference, samples data from this and then carries out some calculations on it.  I'm currently trying to modify this to add more functionality, but have hit a problem.  The picture attached is the original programme which works fine, but when I add another "Open FPGA VI reference" above the one shown, which is targeted to the same PXI 7833R card, but calls a different VI, it causes the original code to stop running properly.  I haven't been able to track down the root of the problem, but it appears to be affecting the sampling of data in the original programme.  I'm thinking it is something to do with timing as I haven't changed a single part of the programme except adding this extra FPGA reference, so all I think it could be affecting is the speed the programme runs at.
    Does anyone know of any problems associated with opening two FPGA references at once?
    Just in case you need to know, I'm running Labview 7.1, with a PXI 1042 chassis, PXI 8186 controller, PXI 7833R FPGA card and PXI 8461 CAN card.
    Thanks,
    Nick
    Attachments:
    working.jpg ‏73 KB

    Nick,
    As you add more code to the FPGA VI it will take longer to compile. If you get close to filling up the FPGA the compile time may increase significantly as the compiler spends more time to optimize the code that is generated to fit onto the FPGA.
    Using large arrays on the front panel of the main VI or anywhere within your VIs will increase the size of the code and increase the compile time.
    There are different ways to get around using large arrays but it is difficult to recommend a specific solution without knowing more about your application. All of these solutions will use the block memory available on the FPGA to store the data in one way or another. You should probably look at using FIFOs if you stream the data between the host and FPGA. Using FIFOs you can pass one data value at a time between host and FPGA, reading them from or writing them to the FIFO. You will need some form of handshaking to synchronize the host/FPGA communication.
    An alternative is to use the DMA FIFOs which will further simplify the communication between host and FPGA.
    If you want to pass blocks of data to the FPGA so that the data can be accessed repeatedly (like a lookup table) then you should use memory blocks on the FPGA to store your data. That provides random access by address to a predefined block of the memory on the FPGA.
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

  • Dma host to fpga

    Use the DMA to transfer a array data from the RT system to the FPGA,and indicate the array data in the FGPA.
    Now,If the array data in the RT is a array including one element ,Ican recevie well in the FPGA VI,bcause in the FPGA VI the function of DMA Read only accept the single element,you can not put a array indication .But I want to transfer a array including many elements.How can i do?  

    Hi,
    You must use only fixed-size arrays in FPGA VIs. If you have a For Loop without a set number of iterations, you must use a Numeric Constant or a control to set the number of iterations. Alternatively, if you are building an array by using the Insert Into Array function, substitute with the Replace Array Subset function.
    I don’t know if this solve your problem, if not attach your VI and I goanna see what’s happen.
    Hope this helps,
    Benjamin R.
    R&D Software Development Manager
    http://www.fluigent.com/

  • No loop in swf array?

    Hey everyone.  So, I have this flash movie I've been working on for awhile.  Everything's going great thanks to a lot of help I've received in these forums.   I have my file set to load an array of swfs.  Now, though, I'm wondering how to keep it from looping.  At the end of the last swf, I want the movie to go to the last swf and then just stop.  Here is my code:
        var listener:Object = new Object();
        var mcl:MovieClipLoader = new MovieClipLoader();
        mcl.addListener(listener);
           // When the swf loads, set it up to constantly check its current frame
        // against the total frames, and if those match, the swf is done playing.
        // If that's the case, then load the next one.
        listener.onLoadInit = function(targ:MovieClip):Void {
           theTargetClip_mc.onEnterFrame = function():Void {
              if (this._currentframe == this._totalframes) {
                 loadNext();
                 delete this.onEnterFrame;
    //Previous and Next Swf Buttons
    function loadNext():Void {
        currentSwf++;
        if (currentSwf >= swfs.length) currentSwf = 0;
        loadSWF(currentSwf);
    function loadSWF(nextSWFToLoad){
       mcl.loadClip(swfs[nextSWFToLoad],theTargetClip_mc);
    loadSWF(currentSwf);
    function loadPrevious():Void{
       currentSwf--;
       if(currentSwf==-1) currentSwf = swfs.length-1;
       loadSWF(currentSwf);
    previous_btn.onRelease = loadPrevious;
    next_btn.onRelease = loadNext;
    //End Previous and Next Swf Buttons
    //Play Button
    play_btn.onRelease = function() {
        theTargetClip_mc.play();
    //Pause Button
    pause_btn.onRelease = function() {
        theTargetClip_mc.stop();

    Cuwen_26 wrote:
    Does anybody know how to add that kind of code to the code I already have?  Help would be very much appreciated!!  I'm really curious to see how this would be done.
    NOTE:  take note of the SWF titles I have in the added Array declaration line . . . . (var swfs:Array=new Array("etc,etc,etc") below in the code)
    CODE:
    var listener:Object = new Object();
    //change the titles in the array to whatever your content swfs are called
    //in your directory.  Store the swfs in the same directory
    //as your FLA
    var swfs:Array= new Array("swf_01.swf","swf_02.swf");
    var container:MovieClip = createEmptyMovieClip("container",getNextHighestDepth());
        var mcl:MovieClipLoader = new MovieClipLoader();
        mcl.addListener(listener);
           // When the swf loads, set it up to constantly check its current frame
        // against the total frames, and if those match, the swf is done playing.
        // If that's the case, then load the next one.
        listener.onLoadInit = function(targ:MovieClip):Void {
                trace("loaded listener");
    theTargetClip_mc.onEnterFrame = function():Void {
              if (this._currentframe == this._totalframes) {
                 //loadNext();
                 delete this.onEnterFrame;
    //Previous and Next Swf Buttons
    var currentSwf:Number=0;
    function loadNext():Void {
        currentSwf++;
        if (currentSwf >= swfs.length){
              //currentSwf = 0;
        loadSWF(currentSwf);
    function loadSWF(nextSWFToLoad){
       mcl.loadClip(swfs[nextSWFToLoad],theTargetClip_mc);
    //loadSWF(currentSwf);
    function loadPrevious():Void{
       currentSwf--;
       trace(currentSwf+" currentSwf");
       if(currentSwf==1) {
            currentSwf = swfs.length-1-1;
       trace(currentSwf+" currentSwf");
       loadSWF(currentSwf);
    previous_btn.onRelease = loadPrevious;
    next_btn.onRelease = loadNext;
    //End Previous and Next Swf Buttons
    //Play Button
    play_btn.onRelease = function() {
        loadSWF(currentSwf);
    //Pause Button
    pause_btn.onRelease = function() {
         mcl.unloadClip(theTargetClip_mc);

  • Long FPGA compilation time ( 30 hrs)

    I am writing some small test programs to check a PXI-7831R FPGA card.
    One program is a FOR loop inside a WHILE loop with a single AI read. I run the FOR 1000 times, then output a 1000-element array of 16-bit AI values through auto-indexing. This program compiled for 31 hours and 15 minutes before I aborted.
    Is there a reason for such a long compile time (too large an array)?
    Are there certain programming architectures that I should avoid on FPGA (e.g., nested loops)?
    I am running LVRT7.1 on a PXI-8145RT. There is also a 7350 motion board installed, though not used in this program.
    Thanks.
    Laine

    I've read somewhere in the FPGA documentation that arrays in FPGA applications should be limited to 32 elements. The consume a large amount of space on the chip, so you need to be careful when using them.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • JavaCard Memory

    I made a simple applet to test the speed of adding arrays, depending whether they are saved in EEPROM or RAM. Since working with variables stored in RAM should be faster, I was really surprised when I noticed no difference between them. I would really like to know where I went wrong, but simply can-t figure it out, so any help would be really appreciated. I used Eclipse 3.2 with JCOP Tools 3.1.1b and JCOP31 v2.2 JavaCard. The code I produced is:
    package test;
    import javacard.framework.APDU;
    import javacard.framework.ISO7816;
    import javacard.framework.Applet;
    import javacard.framework.ISOException;
    import javacard.framework.JCSystem;
    public class SimpleMemoryTest extends Applet {
         private static final short ARRAY_SIZE = 32;
         byte[] eeprom_a,  eeprom_b, eeprom_c;
         byte[] ram_a, ram_b, ram_c;
         short[] mem;
         private SimpleMemoryTest() {
              this.mem = new short[2];
         public static void install(byte[] bArray, short bOffset, byte bLength) {
              new SimpleMemoryTest().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
         public void process(APDU apdu) {
              if (selectingApplet()) return;
              byte[] buf = apdu.getBuffer();
              switch (buf[ISO7816.OFFSET_INS]) {
              case (byte) 0x00: { // Print memory info to verify where arrays are stored
                   mem[0] = JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT);
                   mem[1] = JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT);
                   buf[0] = (byte)(mem[0] / 256);
                   buf[1] = (byte)(mem[0] % 256);
                   buf[2] = (byte)(mem[1] / 256);
                   buf[3] = (byte)(mem[1] % 256);
                   apdu.setOutgoingAndSend((short)0, (short)4);
                   break;
              case (byte) 0x01: { // Put arrays in EEPROM.
                   this.eeprom_a = new byte[ARRAY_SIZE];
                   this.eeprom_b = new byte[ARRAY_SIZE];
                   this.eeprom_c = new byte[ARRAY_SIZE];
                   break;
              case (byte) 0x02: { // Put arrays in RAM.
                   this.ram_a = JCSystem.makeTransientByteArray(ARRAY_SIZE, JCSystem.CLEAR_ON_DESELECT);
                   this.ram_b = JCSystem.makeTransientByteArray(ARRAY_SIZE, JCSystem.CLEAR_ON_DESELECT);
                   this.ram_c = JCSystem.makeTransientByteArray(ARRAY_SIZE, JCSystem.CLEAR_ON_DESELECT);
                   break;
              case (byte) 0x03: { // Add arrays in EEPROM 100 times
                   short i, j;
                   for (i = (short) 0; i < (short) 100; i++) {
                        for (j = (short) 0; j < (short) ARRAY_SIZE; j++) {
                             eeprom_c[j] = (byte)(eeprom_a[j] + eeprom_b[j]);
                   break;
              case (byte) 0x04: { // Add arrays in RAM 100 times
                   short i, j;
                   for (i = (short) 0; i < (short) 100; i++) {
                        for (j = (short) 0; j < (short) ARRAY_SIZE; j++) {
                             ram_c[j] = (byte)(ram_a[j] + ram_b[j]);
                   break;
              default:
                   ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
    }

    When you create a byte array, all values are initialized to 0. Looking at your loops, it seems you're adding 0's only. Smart card operating systems normally do a read before write, to make sure not the same value is written. It saves time, and in case of EEPROM also to prolong the lifetime. I think this is the reason why you see no difference .. because there is no writing. Do something like
    eeprom_c[j] = (byte)(i + j);
    Matjaz wrote:          case (byte) 0x03: { // Add arrays in EEPROM 100 times
                   short i, j;
                   for (i = (short) 0; i < (short) 100; i++) {
                        for (j = (short) 0; j < (short) ARRAY_SIZE; j++) {
                             eeprom_c[j] = (byte)(eeprom_a[j] + eeprom_b[j]);
                   break;
              case (byte) 0x04: { // Add arrays in RAM 100 times
                   short i, j;
                   for (i = (short) 0; i < (short) 100; i++) {
                        for (j = (short) 0; j < (short) ARRAY_SIZE; j++) {
                             ram_c[j] = (byte)(ram_a[j] + ram_b[j]);
                   break;

  • Hunting a non-reproduceable crash

    I've got a Utility app which uses AudioQueue services for recording and playing samples. It runs fine on the Simulator and on both my test devices for hours and hundreds of launches. But I have a couple of users who are reporting that it crashes on their device (quits back to the home screen 2 seconds after launch).
    I've tried the usual stuff in my test environments: checking all status return values, running Instruments to check for memory usage and leaks, surrounding pointer accesses with NULL pointer checks, adding array bounds checks. But I haven't found any good candidates for the problem cause yet.
    Any other ideas on what to look for to hunt down this kind of problem?
    Anything I should try asking a random and remote iPhone user to report about their particular device?
    Thanks.

    Hi. I know it's quite some time after the original post, but did you (or anyone else) ever get any resolution on this? We have a couple of users reporting that our game crashes on startup, but it's not something we've ever seen first hand. So far though, the numbers are low, over 4 figure sales and less than a handful of crash problems, all but 1 (so far as we know) of which wasn't fixed by rebooting the iPhone.
    Our games have a fairly large set sound samples for audio, and use the AudioQueue services too.
    Any advice would be appreciated.
    Cheers,
    Steve

Maybe you are looking for

  • IPod not recognized in iTunes 7.4

    Hi. I recently purchased an ipod nano (1st gen, obviosly) from her, and it fell in the bath a few weeks ago. anyway when i looked at it, it said "Use iTunes to restore". I connected it to my laptop, and opened itunes. i managed to restore the ipod, a

  • HTMLEditorKit, Custom Tags and CSS???

    I have an editor that will allow the user to insert merge fields. The document is in HTML and the editor supports basic document styling (bold, italics, etc). For the merge fields I would like to use either a custom tag or a generic tag like span. Un

  • .Mac Web Gallery WIDGETS not all displaying.

    DESPITE UPDATING to iWeb 2.0.3, Web Gallery Widgets are still problematic- In the application & through Safari and Firefox. I have deleted then re-pasted the widgets; some of them display while others attempt to load but remain blacked-out. In my tro

  • Posting Depreciation to two G/L accounts

    Hi All, We are implementing another ledger and I am using the additional accounts approach for USGAAP ledger. Depreciation is posting to two G/L Accounts. SAP doesn't allow posting to Cost Center for the non leading Ledger. Business wants to see post

  • Copy history problems

    Hi all- I'm trying to "copy history" in one of my bbm conversations to save for future reference.  However, when I go into the conversation and hit copy history, then go to paste it into an email, the conversation that is pasted is one that I copied