Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MIPS Assembly Expert Needed!!! Architecture Question!

Status
Not open for further replies.

asic_SoC_designer

Newbie level 1
Newbie level 1
Joined
Feb 16, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
14
Hi

I have a question about the assembly code generated by this small patch of C code that I wrote. The code patch is shown below, basically what I am doing is reading floating point values in from a hardware updated register and performing the arctan2f function on those values.

Code:
#include "stdlib.h"
#include "math.h"
#include <stdarg.h>
#include "GLOBAL.H"

//Volatile Variables accessing hardware registers!!!
#define   rs232_uart2_fp    (*((volatile   float *) 0x8C080000))    
#define   quik_silva_reg_fp (*((volatile   float *) 0x8C040000))

int main (void) 
{  

float temp;
float ax, ay;

quik_silva_reg = 0;

while  ( 1 ) {

    ax = rs232_uart2_fp;
    ay = rs232_uart2_fp;

    quik_silva_reg = 0;
    quik_silva_reg_fp = atan2f(ay, ax);

}
  return 0;

}

OK so the code is not working and I have no idea why. I took a look at the disassemble list and I found something which looks very strange to me. The compiler places the two floating point variables x and y in floating point registers $f12, and $f13 and then calls the atan2f function as shown below.

Code:
while  ( 1 ) {

    ax = rs232_uart2_fp;
 24c:   c62d0002    lwc1    $f13,0(s1)
Trig_Tests/atan2_test.cpp:28
    ay = rs232_uart2_fp;
 250:   c62c0002    lwc1    $f12,0(s1)
Trig_Tests/atan2_test.cpp:29
    quik_silva_reg = 0;
 254:   ae000000    sw  zero,0(s0)
Trig_Tests/atan2_test.cpp:30
    quik_silva_reg_fp = atan2f(ay, ax);
 258:   0c00009b    jal 26c <atan2f>
 25c:   00000000    nop
 260:   e6000000    swc1    $f0,0(s0)
 264:   08000093    j   24c <main+0x20>
 268:   00000000    nop

Now here is the weird part, when I look through the atan2f code I see ABSOLUTELY NO mention of floating point register $f13. Am I missing something here??? I do see a reference for a mfc1 for floating point register $f14 but no mention of register $f13 which is the register which holds the x operand for the atan2f(y,x) function. I can attached the entire dissemble list for you to have a look for yourself.

Here are my command line and options.

mips-sde-elf-gcc -Os -msingle-float -fsingle-precision-constant -g -mno-memcpy -mno-branch-likely -mno-check-zero-division -mabi=32 -mfp32 -mno-paired-single -mips32r2 -mno-fp-exceptions -mtune=r3k -T elf32btsmip.xc startup.o atan2_test.cpp -o uPC0_Spr6.elf -lc -lm

Thanks in advance for your help!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top