UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
8,735 Views
Registered: ‎05-21-2009

PowerPC 440 SDK: How to set MSR

Jump to solution

Hi. Can anyone please tell me how do I manually set the value of the MSR? I've written a program in SDK 11.1 which should perform a few divides on each interrupt, but the value of the MSR changes the moment I enter the interrupt service routine, so the SDK assumes I have no FPU. Is there a function I could use to set the MSR to the correct value before I service the interrupt?

 

Thanks.

Tags (4)
0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
11,182 Views
Registered: ‎04-23-2008

Re: PowerPC 440 SDK: How to set MSR

Jump to solution

See mtmsr() in xpseudo_asm_gcc.h.  I'd strongly recommend against attempting to perform floating point math in an interrupt handler. Nothing involved supports reentrancy.

 

-Brian

View solution in original post

0 Kudos
8 Replies
Xilinx Employee
Xilinx Employee
11,183 Views
Registered: ‎04-23-2008

Re: PowerPC 440 SDK: How to set MSR

Jump to solution

See mtmsr() in xpseudo_asm_gcc.h.  I'd strongly recommend against attempting to perform floating point math in an interrupt handler. Nothing involved supports reentrancy.

 

-Brian

View solution in original post

0 Kudos
Explorer
Explorer
8,729 Views
Registered: ‎05-21-2009

Re: PowerPC 440 SDK: How to set MSR

Jump to solution

HI Brian.

 

Thanks for your reply. It worked like a charm. Could you please elaborate on why I shouldn't perform floating point calculations in an interrupt?

Message Edited by rikusleroux on 09-02-2009 12:10 PM
0 Kudos
Xilinx Employee
Xilinx Employee
8,720 Views
Registered: ‎04-23-2008

Re: PowerPC 440 SDK: How to set MSR

Jump to solution

If the interrupted context was itself performing floating point operations, "bad things will happen". Also, I can't guess what would happen if your software took a floating point exception (i.e. division by zero) in an interrupt context.

 

-Brian

0 Kudos
Explorer
Explorer
8,718 Views
Registered: ‎05-21-2009

Re: PowerPC 440 SDK: How to set MSR

Jump to solution
Ahh. I see. Is this due to the FPU present in my design? Is it still bad practice to do floating point calculations in an interrupt if I remove the floating point unit, thus emulating floating point capability?
0 Kudos
Xilinx Employee
Xilinx Employee
8,714 Views
Registered: ‎04-23-2008

Re: PowerPC 440 SDK: How to set MSR

Jump to solution

Yes, software emulation would be safer.  For performance reasons (this is run in an interrupt handler...) perhaps you should consider fixed point math instead, if that can be readily applied to your application.  That is to say, signed integers.  1000 = 1.0, 1250 = 1.25, etc...

 

-Brian

0 Kudos
Explorer
Explorer
8,712 Views
Registered: ‎05-21-2009

Re: PowerPC 440 SDK: How to set MSR

Jump to solution

Thanks for your reply Brian. Unfortunately I need floating point capability. It is for PID control, and the floating point values will give a better resolution. This is luckily not a serious issue. I'm going to rewrite my code to just set a flag when the interrupt occurs and to check the flag in my main code. If the flag is set, I will do the calculations I wanted to perform during the interrupt.

 

Thanks again.

0 Kudos
Visitor balajigm
Visitor
6,584 Views
Registered: ‎11-25-2011

Re: PowerPC 440 SDK: How to set MSR

Jump to solution

hi,  i am facing same problem..  i want to use floating point instructions in my ISR,  where i can't avoid using fixed point.

I am using ML410 board with ppc405, virtex4-fx-60 fpga.  when i use mrmsr instruction it hangs to data tlb miss intrpt.

please help me out what to do for ppc-405

0 Kudos
Explorer
Explorer
6,575 Views
Registered: ‎05-21-2009

Re: PowerPC 440 SDK: How to set MSR

Jump to solution

Hi balajigm,

 

Thanks for resurrecting my post. Was refreshing reading it again and relive the floating-point issues I had. Before I can attempt helping you,  maybe you should elaborate on your specific architecture. Do you have a floating-point unit (FPU) attached as a coprocessor to your PowerPC or are you emulating floating-point capability using the compiler?

 

Which ISE are you using and what exactly is happening in your design? I remember my problem was during the division of two floating-point numbers using the FPU.  When are you experiencing the problems?

0 Kudos