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.

C6700 libraries trunc(), spint() functions

Other Parts Discussed in Thread: CCSTUDIO

I am working with the 6720 processor.  In the cgtools folder of the C6000 directory of CC3.3 I was trying to use the truncf() function seen in the mathf.h include file.  I am using the rts6700.lib.  Is this a valid function for this processor?  Am I using the correct library?  When I simulated this, it worked okay.  When I emulated it, it did not.

There is another function spint() which seems to work, but when simulated, it rounds up a note in the SPRU198I regarding the function states "Converts 32-bit float to 32-bit signed integer using the rounding mode set by the CSR register".  What bit controls the rounding mode in the CSR register, I have looked in the SPRU733A and find no reference to a rounding bit.

Thanks for any help on this matter.

  • Hi Dan,

    As C6720 has a C67x+ core, you could use rts67plus.lib - that will be more optimized for your core. rts6700.lib will work though.

    What version of Code Generation tools and CCS are you using? For me the function truncf is not at mathf.h, but in the truncf_i.h file.

    I will try to search a little more for the spint question.

  • Thank you, I will take advantage of the rts67plus.lib.

    Regarding versions:

    I am using CCS V3.3.81.6.  The C6x.h and mathf.h show V 6.0.8.  I do not have a truncf_i.h file in my C6000/cgtools directory.

     

  • I have looked a little further and found that I am using version 6.0.22 but it was installed in another directory.  However, this directory also does not have a truncf_i.h file.

    Also I have looked at the code composer update site and found CGtools updates only for C2000.  Is this correct?  When I purchased the CCS package it was the full version "TMDSCCSALL-1" with the one year bundled support??

  • The rounding mode for floating point instructions can be controlled with the RMODE bit in the FADCR (L unit instructions and a few S unit instructions), or FMCR (M unit instructions).  See section 2.8 in spru733a.

  • Thank you for the information, one question, programming in C, how do I know which unit (L1, L2, M1, M2) the compiler is going to assign to spint() routine or may it be best to temporarily set all Rmode bits to the operating mode needed?

  • The _spint() intrinsic maps to the hardware instruction SPINT.  See spru733a.  The SPINT instruction executes on one of the L units, so set the RMODE bit in FADCR.

  • Ok I see that.  I was looking in the SPRU198I where it talked about compiler intrinsics.  I did not realize it was also an actual assembler instruction.  Thank you.

  • The truncf function should still work.  If you can, send a repoducible testcase and description of the problem to customer support.

     

    I have also added the correct _spint() intrinsic description C6000 Programmer's Guide Errata page: C6000 Programmer's Guide Errata

  • Mariana:

    There is a question about whether I have the latest CGtools version for the C6000.  Could you tell me what the most current version is?

  • Hi Dan, for C6000, the latest CGT is 6.1.10.

  • Hi Mariana:

    I have been able to upgrade to 6.1.10.  I have tried to use the rts6000e.lib when linking I receive this error:

    fatal error: object files have incompatible byte orderings
       ("C:\\CCStudio_v3.3\\MyProjects\\DSP\\dsp\\rts6700e.lib<errno.obj>" = big
       endian, "C:/Program Files/Texas Instruments/C6000 Code Generation Tools
       6.1.10/lib/rts6700.lib<boot.obj>" = little endian)

    I understand this as I am using the little endian format.

    Looking in ccs there is a C672x cycle accurate simulator for little endian and there is a simulator for big endian simulator but it encompasses the whole C67xx.  This processor can run both modes?  I would need to convert all my linking statements and libraries to use this (no problem).  I am using a Flash PROM (not serial) for the boot, the one question I have is the SPRAA69C the bootloading process states (in the debugging of the bootloader):

    "Check endianness of data. The on-chip bootloader expects data to be received MSB first."

    Does this mean "little endian" and if so does that mean I am restricted to using little endian?

     

     

  • Hi dan,

    Even though the simulator has little and big endian options, the chip only supports little endian. 

    To use the little endian library, you include the one without the "e" at the end - so instead of rts6700e.lib you would use rts6700.lib. Remember, for C6727, you can use the rts67plus.lib.

  • In addition to Mariana's comments about the 'e' suffix you may also see a library with the _eh suffix which indicates the support of exception handling.