This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with load and store data

Hey all!
I'm using Keil-uV3. Chip LPC2214 (Philips Semiconductors)
I have an external memory device connected to the expansion board.
The external device is using /CS0 and /CS1. Memory bank is 32 bits wide.
When moving data from external memory bank 1(at address 0x81000000) to 10words in bank 0, I wrote:

{
//R1-->address in bank 1
ldr r1,=0x81000000
//R2-->address in bank 0
ldr r0,=0x80000000
//R3=[R0]+10*4
add r3,r0,#40
loop:
LDR R1,[R0] //3MC
STR R1,[R2] //2MC
//Increment R0 to next memcells
ADD R0,#4 //1MC
//Compare with R3
CMP r3,r0 //1MC
//If r0==r3, exit, else return loop
bne loop //3MC

exit:
...
}
Loop waste 10MCs, but my project is only permit it <=6MCs,
I'm trying some way, but can't solve this prob, please help me!
Thanks before!

-----------
Tony Bui

Parents
  • Sorry, I think I read it wrong the first time - it repeats 10 times in the above example (loop increment is +4, not +1).

    Actual, this loop repeats 356 times! (^:^) If I rewrite this block 356 times, it is not a good suggest for my prob!<p>

    As I said, your assembler might have directives that allow repeating a block of code without having to explicitly type it. Something along the lines of

    .repeat 356
    <block of code>
    .endr

    Depending on how important memory is, loops can also be partially unrolled, so that the loop counter is checked every X (X > 1) repetitions instead of every single repetition. This reduces the time spent doing (useless) loop condition checks.

Reply
  • Sorry, I think I read it wrong the first time - it repeats 10 times in the above example (loop increment is +4, not +1).

    Actual, this loop repeats 356 times! (^:^) If I rewrite this block 356 times, it is not a good suggest for my prob!<p>

    As I said, your assembler might have directives that allow repeating a block of code without having to explicitly type it. Something along the lines of

    .repeat 356
    <block of code>
    .endr

    Depending on how important memory is, loops can also be partially unrolled, so that the loop counter is checked every X (X > 1) repetitions instead of every single repetition. This reduces the time spent doing (useless) loop condition checks.

Children
No data