#7 Global variable map and the mem map binary file don't match

closed
8
2009-01-23
2009-01-22
Fuat Keceli
No

I compile the attached file using the following command:

xmtcc tmp.c tmp.xbo -o tmp

Then I simulate the output using the simulator:

xmtsim tmp.sim -binload tmp.b

The result is:

0.25865460194563994 0.0
0.9412789924919132 0.0
522536032
End of simulation.

I would expect it to be (see tmp.txt):

0.25865460194563994 0.749192324790300
0.9412789924919132 0.7741546757487
2

When I look at the global variable map at the beginning of the tmp.sim file, I
see some inconsistent addresses. The global address map is:

.xmtGlob tmp2 264 24
.xmtGlob tmp1 240 16
.xmtGlob tmp2_dim0_size 288 4
.xmtGlob tmp1_dim1_size 260 4
.xmtGlob tmp1_dim0_size 256 4

When I look at the hexdump of tmp.b I get the following:
0000000 0001 201d ee00 001d 0000 201c 0008 0c00
0000010 0000 fc00 6625 2520 0a66 0000 6425 000a
0000020 ffe0 27bd 0018 afbf 0000 3c1c 00f0 379c
0000030 0000 3c1c 00f4 379c 0000 3c1c 00f8 379c
0000040 0000 3c1c 00fc 379c 0000 3c04 0014 3484
0000050 003a 0c00 0000 3c1c 0100 379c 0000 3c1c
0000060 0104 379c 0000 3c1c 0108 379c 0000 3c1c
0000070 010c 379c 0000 3c04 0014 3484 003a 0c00
0000080 0000 3c05 0100 34a5 0000 8ca5 0000 3c04
0000090 001c 3484 003a 0c00 1020 0000 0018 8fbf
00000a0 0020 27bd 0008 03e0 0008 03e0 0000 0000
00000b0 0000 0000 0000 0000 0000 0000 0000 0000
00000c0 0000 0000 0000 0000 0000 0000 0000 0000
00000d0 0000 0000 0000 0000 0000 0000 0000 0000
00000e0 0000 0000 0000 0000 0000 0000 0000 0000
00000f0 4040 0814 8dcc 3fd0 6f00 2eac f962 3fe7
0000100 4460 1f25 1ef5 3fee 5e40 06cc c5e0 3fe8
0000110 *0002 0000* 0002 0000 0000 0000 0000 0000
0000120 0000 0000 0000 0000 0000 0000 0000 0000
0000130 0000 0000 0000 0000 0000 0000 0000 0000
0000140 0000 0000 0000 0000 0006 0000
000014c

The value between the stars is what I am trying to read. Assuming double values
are 32-b, the address of this value should be 272. However the global var. map
says it is 256. As a matter of fact, if we look at address 256 the value is
1f25 4460 (in human readable, big endian form) which is 522536032 - the value
printed out by the simulator.

XMTCC version: xmtcc Revision: 6311
SVN Revision of MemoryTools trunk: 7498

Discussion

  • Fuat Keceli

    Fuat Keceli - 2009-01-22
     
  • George Caragea

    George Caragea - 2009-01-23

    fixed bug in MemoryTools - memMapCreate
    The size of any double variable was incorrectly computed when writing the header of the xbo file

    However, simulator is still not printing the correct values. There might be something wrong with the simulator printf - will look into that next.

     
  • George Caragea

    George Caragea - 2009-01-23

    ok, it looks like the simulator works ok - with one restriction though.

    Since a %f involves reading two registers, you can only pass AT MOST one %f as argument to printf (this is the same as the limitation to three %d to printf - only three registers available).

    I changed the tmp.c program to print:

    printf("%f ",tmp1[0][0]);
    printf("%f\n" , tmp1[0][1]);
    printf("%f ", tmp1[1][0]);
    printf("%f\n", tmp1[1][1]);

    and it works as expected.

    I am closing this bug - make sure you update MemoryTools and use memMapCreate version 0.81.3 or higher.

     
  • George Caragea

    George Caragea - 2009-01-23
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks