0

I have a C program that needs to scan through memory from 0xC0000000 to 0xC0001FFF. Before the scanner loop begins there is a subroutine that fills the memory with 0xFFFFFFFF and this successfully goes through the entire memory space. When the main loop begins, however, the addr variable is resetting at 0xC00003e0 rather than 0xC0001FFF. Any ideas why this might be happening? Let me know if I need to include anything else. This program is running on a Basys3 FPGA using a Microblaze soft processor.

Currently the primary subroutines live in a while loop, while(addr <= MEM_TOP_ADDR) [checks if addr is less than or equal to the end of the address space]. My previous method was if(addr >= MEM_TOP_ADDR), both of these result in the same behavior.

while(1){ //The main loop

        while(addr <= MEM_TOP_ADDR){
        LFSR_runtime();
        MEM_SCANNER();
        MEM_SCANNER_1();
        addr += 4;
        addr_1 += 4;
        if(addr_1 >= MEM_1_TOP_ADDR){
            addr_1 = MEM_1_BASE_ADDR;
        }
        }
        addr = MEM_BASE_ADDR;

    }
addr = MEM_BASE_ADDR;

In the programs current space, it can count up to 0xC00003e0 and then the while loop exits. It should count up to 0xC0001FFF before exiting the while loop

1201ProgramAlarm
  • 32,384
  • 7
  • 42
  • 56
  • 1
    What are the types, declaration and how are initialized the variables: `addr` `MEM_TOP_ADDR` `MEM_1_TOP_ADDR` `MEM_1_BASE_ADDR` `addr_1`? What are `MEM_SCANNER_1` and `MEM_SCANNER()` and `LFSR_runtime()`? The snipped of code you posted has very little context. – KamilCuk Apr 25 '19 at 00:20
  • I can see how bare it is now, all the data types are u32 – NeedlessBird Apr 25 '19 at 00:47

1 Answers1

0

This was solved by moving the address variables into the MEM_SCANNER() function as opposed to having them as global variables.