This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IQMath compare fails after IQMultiply

Other Parts Discussed in Thread: TMS320F2808

We use the following environment:

OS: Windows XP (newest service packs)
CCS: V3.3.82.13
Code Generation Tools: V5.2.5
Target DSP: TMS320F2808

Problem:
After a IQMultiply the result is compared if result is smaller than the smallest possible value (MIN_IQ_POS). If true the result should be set to MIN_IQ_POS. This operation fails. Altough the result after IQMultiply is 0 the compare thinks it is not.

The settings for compiler are:
-g -k -o2 -eaasmc -fr"$(Proj_dir)\Release" -fs"$(Proj_dir)\Release" -i"$(Proj_dir)\Includes\" -i"$(Proj_dir)" -d"LARGE_MODEL" -ml -v28 --flash_prefetch_warn

The settings for the linker are:
-c -ecode_start -m".\Release\Test.map" -o".\Release\Test.out" -stack0x400 -w -x -i"$(Proj_dir)\Includes\" -l"rts2800_ml.lib" -l"REmath.lib" --xml_link_info="test.xml"

GLOBAL_Q is set to 24.

The screenshot below shows all the registers.

The problem is that the flags "N" and "Z" are affected by the whole "ACC:P" Register and not only by "ACC". "ACC" actually holds the result (0) and "P" holds the residual value. If the optimizer is switched off the operation succeeds.

I'm quite shure this is a compiler bug. Is there any workaround? Are other operations affected?

Thanks for the support. 

  • This may well be a compiler bug.  Please preprocess your code as described here http://tiexpressdsp.com/index.php/Preprocess_Complex_Source_Code_for_Bug_Submissions and post it.  Remember, you don't need to post all your code, just the one source file which compiles down to the incorrect assembly shown in your screen shot.

    Thanks and regards,

    -George

     

  • Attached is the required pp-file. I have transfered the source into an other project so that more or less only this problem is included.
    For this project the compiler options are:
    -g -k -o2 -eaasmc -fr"$(Proj_dir)\Debug" -fs"$(Proj_dir)\Debug" -i"$(Proj_dir)" -d"_DEBUG" -d"LARGE_MODEL" -ml -v28 --flash_prefetch_warn

    The linker options are:
    -c -ecode_start -m".\Debug\Test Firmware.map" -o".\Debug\Test Firmware.out" -stack0x400 -w -x -i"$(Proj_dir)" -l"rts2800_ml.lib"

    Environment is:
    OS: Windows XP (newest service packs)
    CCS: V3.3.82.13
    Code Generation Tools: V5.2.5
    Target DSP: TMS320F2808

    The assembler translation of the problem is as follows:
    _main:
     .dwcfi cfa_offset, -2
     .dwcfi save_reg_to_mem, 26, 0
     .dwcfi save_reg_to_reg, 78, 26
    ;* AL    assigned to $O$C1
     .dwpsn file "Test Firmware.c",line 268,column 3,is_stmt
            MOVB      ACC,#1
            MOVW      DP,#_b
            MOVL      @_b,ACC               ; |268|
     .dwpsn file "Test Firmware.c",line 269,column 3,is_stmt
            MOVL      XAR4,#671             ; |269|
            MOVL      @_c,XAR4              ; |269|
     .dwpsn file "Test Firmware.c",line 271,column 3,is_stmt
            MOVL      XT,ACC                ; |271|
            IMPYL     P,XT,XAR4             ; |271|
            QMPYL     ACC,XT,XAR4           ; |271|
            LSL64     ACC:P,#8              ; |271|
            MOVL      @_a,ACC               ; |271|
     .dwpsn file "Test Firmware.c",line 272,column 3,is_stmt
            B         $C$L1,GT              ; |272|
            ; branchcc occurs ; |272|
     .dwpsn file "Test Firmware.c",line 273,column 5,is_stmt
            MOVB      ACC,#1
            MOVL      @_a,ACC               ; |273|
    $C$L1:   
     .dwpsn file "Test Firmware.c",line 276,column 3,is_stmt
    ...


    Please change file policy in this forum so that *.pp files can be attached directly. Thanks.

    Best regards,

    Patrick

    Test Firmware.zip
  • I can reproduce this bug.  I submitted record ID SDSCM00035932 in the SDOWP system.  Feel free to track it with the SDOWP link below in my sig.

    Thanks and regards,

    -George

     

  • Either record ID (SDSCM00035932) is wrong or the URL link in the incident report SDSCM00035932 is wrong.

    I don't know what the severity "Minor" means but I would classify the problem as quite critical.

    Best regards,

    Patrick

  • Sorry.  My bad.  It should be changed to "Major" soon, if it isn't already.

    -George