E31 evaluation simulation


(ling) #1

hello, I have some question for the E31 rtl simulation, I try to use toolchain to generate hex file, and I write a timer interrupt program , but when I use vcs to simulate the E31 rtl with this program, I find that when the program try to access the address 0x02004000(the TIMER_CMP),the value of PC will jump into zero, what’s wrong with it ???


(Drew) #2

Can you share the source code?

Do you set mtvec in your application? It could be that you are taking a trap prior to setting up the trap entry/exit.


(ling) #3

yes, I see the bsp package have set mtvec at init.c


(ling) #4

but I just access the address 0x0200_0000,why it will produce a trap ??


(Megan A. Wachs) #5

What do you mean you are “accessing” the address? Are you reading, writing? Are you using the proper size access (lw, lh, lb, ld?) If you write the TIMER_CMP value, then it’s quite likely you take an interrupt which you may not have set up properly. Can you share the code that is causing the trap?


(Drew) #6

Address 0x0200_0000 is the Machine Software Pending register in the CLINT. If you write a 1 to the LSB of this register, and software interrupts are enabled in the mie, then this will cause a trap.

Without seeing your code, we don’t know for sure what is going on. What I wrote above is simply one possibility.


(ling) #7

thank you for your answer, I have solve the problem,but sometimes, I try to write the address 0x3000_0000 that is the periphery device region, It also produce a trap, why ?


(ling) #8

yes,I write the address, and it take a trap but not a interrupt