Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

Instruction master address is only up counting for Nioas II simulation on ModelSim

Hello

I am doing Nios II simulation on ModselSim.

I found strange behavior of simulator.

Some time, Instruction master address only up count from 0 after reset release.

Addres does not run on program area.

However, once simulate original hello_world program (original template), behavior of address become normal.

After simulation of original hello_world program, my own program can run with propriety.

Does somebody know what's happening?

My environment are following.

Quartus II v11.0

ModelSim v6,6b

Thank you.

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Is your CPU reset vector set to an address in program area? In theory, after reset the CPU should jump to the defined reset vector and execute code from there.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Dear Daixiwen,

    I appreciate your reply and pointing out.

    I understand that reset vector must be adjusted by relationship between SOPC builder and Nios EDS automatically.

    I s there any potential to break this coordination?

    After my post I found some deference in .objdump file between good case and bad case.

    In good case, there is following part in the .objdump file.

    00002000 is the my reset vector address.

    =========

    00002000 <__reset>:

    * Jump to the _start entry point in the .text section if reset code

    * is allowed or if optimizing for RTL simulation.

    */

    # if defined(ALT_ALLOW_CODE_AT_RESET) || defined(ALT_SIM_OPTIMIZE)

    /* Jump to the _start entry point in the .text section. */

    movhi r1, %hi(_start)

    2000: 00400034 movhi at,0

    ori r1, r1, %lo(_start)

    2004: 08480814 ori at,at,8224

    jmp r1

    2008: 0800683a jmp at

    0000200c <_exit>:

    ...

    ===============

    In bad case, there is not above part.

    Is it any hint?

    Tank you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes it is automatic. When you generate your system in SOPC builder, it creates or updates the .sopcinfo file that describes the vectors. Then Nios EDS uses that file to make the link script with all the memory sections.

    You should try and find out why you don't have the code at the reset address. It could be an option somewhere in the bsp settings.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Dear Daixiwen,

    Thank you very much for your suggestion for BSP setting.

    Now I am using BSP setting as default.

    In BSP setting, items in Linker Script tab seems relate my problem.

    Actually, Now my problem has disappeared since I built original "Hello_world.c".

    (I don't understand what affect my problem)

    So I captured screenshot of Linker Script tab, Memory Usage and memory map as evidence of good condition.

    Later, when I will meet same problem, I will compare the condition with good condition I captured.

    Highly appreciate your comment.

    Toshihito Habuka
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It's possible that at one point you compiled the BSP with a wrong .sopcinfo file that indicated another address for the reset exception. But I'm glad your problem disappeared!