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.

N2HET instruction structs (std_nhet.h)

Other Parts Discussed in Thread: HALCOGEN, TMS570LS0432

Hi

I've generated code for IAR tool chain and TMS570LS0432 FreeRTOS using HalCoGen 04.05.00 and found that the N2Het instruction structs found in "std_nhet.h" needs some major overhaul. Some fields are not in the right order (Big/Little endian problem), some words don't even have 32bits. Structs like these could easily be tested and yet they are wrong. 

Best Regards

Henrik Liljedahl

  • Henrik,

    Thanks for raising the concern - we'll look into it.  Would you pls. send one example of where you are seeing the wrong order?

    Thanks and Best Regards,

    Anthony

  • Here is an example where both number of bits and order are wrong:

    typedef struct CNT_format
    {
    uint32 : 9 ;
    uint32 brk : 1 ;
    uint32 next_program_address : 9 ;
    uint32 op_code : 4 ;
    uint32 angle_cnt : 1 ;
    uint32 t_register_select : 1 ;
    uint32 ab_register_select : 1 ;
    uint32 : 4 ;
    uint32 interrupt_enable : 1 ;


    uint32 : 3 ;
    uint32 request : 2 ;
    uint32 auto_read_clear : 1 ;
    uint32 : 1 ;
    uint32 max : 25 ;


    uint32 data : 25 ;
    uint32 : 7 ;

    } CNT_FIELDS ;

    Compare this to the ADM32 struct and you'll get the picture.


    Best regards
    Henrik Liljedahl
  • Thank you Henrik,

    I can see where the program field has a few mistakes:

    (I am striking out mistakes and marking corrections in green)

    uint32 : 9 ;

    uint32                      : 6 ;

    uint32 reqnum               : 3 ;

    uint32 brk : 1 ;

    uint32 next_program_address : 9 ;

    uint32 op_code : 4 ;

    uint32 angle_cnt : 1 ;

    uint32 t_register_select : 1 ;

    uint32 ab_register_select : 1 ;

    uint32 cmp_select : 1 ;

    uint32 : 4 ;

    uint32 interrupt_enable : 1 ;

    But I think I'm not seeing where there is an endian problem.  

    Also see ADM32 is missing the ext_reg field.   This was added going from NHET to N2HET so it may be why it's missing.  I'll need to check on this.


    In any case thanks for pointing out the missing bits in CNT - that's something we can confirm and get a ticket in queue for.


    Would be good to know where the bit reversal is though..  

    Thanks and Best Regards,

    Anthony

  • I believe the suggestion you made is wrong.

    In the ADM32 struct hr_data :7 comes before data:25. In the CNT struct they are swapped. The same for the program and control words, they are also swapped.

    The first bit field is bit number 0 in the program word , so:

    typedef struct CNT_format
    {
    uint32 interrupt_enable : 1 ;
    uint32 : 4 ;
    uint32 ab_register_select : 1 ;
    ...
    ...

    Some structs are correct same some are not, so you really need a test here, you can not rely on me pointing out every wrong. You really need to perform tests on ALL structs. I was trying to use them and none of the structs I wanted to use was correct.

    Make tests by filling in the struct and check if it generates the correct program, control and data word for all instruction structs.


    Best Regards

    Henrik Liljedahl.
  • Henrik,

    I did a manual review of the header and issues i found below were logged in ticket # SDOCM00119321 against HalCoGen.

    Instruction     LE  BE      Issue

    -----------     --  --      ----------------------------------------

    ACMP            N   Y       ext_reg bit is missing from control word

    ECMP            N   N       no issue

    SCMP            N   N       no issue

    MCMP            Y   Y       ext_reg bit is missing from control word

    MOV64           Y   Y       ext_reg bit is missing from control word

    DADM64          Y   Y       ext_reg bit is missing from control word

    RADM64          Y   Y       ext_reg bit is missing from control word

    MOV32           Y   Y       ext_reg bit is missing from control word

    ADM32           Y   Y       ext_reg bit is missing from control word

    ADCNST          N   Y       control bit missing in control word

    ADD             N   N       no issue

    ADC             N   N       no issue

    SUB             N   N       no issue

    SBB             N   N       no issue

    AND             N   N       no issue

    OR              N   N       no issue

    XOR             N   N       no issue

    CNT             Y   Y       missing compselect field of control word

    APCNT           N   N       no issue

    PCNT            Y   Y       missing compselect field of control word

    SCNT            Y   Y       bit 0 is unnamed, but must be written as '1'

    ACNT            N   N       no issue

    ECNT            Y   Y       ext_reg bit is missing from control word

    RCNT            Y   Y       step width field is missing from control word

    DJNZ            N   N       no issue

    DJZ             N   N       no issue

    PWCNT           N   N       no issue

    WCAP            Y   Y       ext_reg bit is missing from control word

    WCAPE           Y   Y       ext_reg bit is missing from control word

    BR              N   Y       big endian is missing #if HET_V2 extended branch condition

    SHFT            Y   Y       ext_reg bit is missing from control word

     

    EDIT:  BTW - I did not find any issues with the hr_data field coming before the data field; in the little endian part of the file.   In the big endian part of the file, it should be hr_data coming before data.   I checked against HalCoGen 4.05.01.

  • Hi

    Where is the little endian part of this file? The file generated by halcogen only has bigendian defined betwheen:

    #if ((__little_endian__ == 0) || (__LITTLE_ENDIAN__ == 0) || defined(_TMS470_BIG) || defined(__big_endian__))

    ...

    #endif

    I didn't understand the LE BE Yes/No in the list. If i pick the first ACMP command in the list, I can see that not only the dataword is in the wrong order. Please confirm you have that covered as well.

    Best Regards

    Henrik

  • Henrik,

    There is a #ELSE in the middle of the file, and each of the struct definitions appears once for big and once for little endian.

    -Anthony

  • Sorry, my mistake. I was looking at a modifed file, causing me the confusion.
  • Actually - you got me looking again and I've got the big and little endian columns reversed in the CQ report and in the list above. So thank you for bringing this point up - I need to update the CQ.

    Best Regards,
    Anthony