SPRADD8 November   2024 F29H850TU , F29H859TU-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction to Real-Time Control
  5. 2C29 CPU and Key Features
    1. 2.1 Parallel Architecture and Compiler Entitlement
  6. 3C29 Performance Benchmarks
    1. 3.1 Signal Chain Benchmark with ACI Motor Control
    2. 3.2 Real-time Control and DSP Performance
      1. 3.2.1 Examples and Factors Contributing to Results
        1. 3.2.1.1 Saturation (or Limiting) Example
        2. 3.2.1.2 Dead Zone Example
        3. 3.2.1.3 Space Vector Generation (SVGEN) Example
        4. 3.2.1.4 Software Pipelining
      2. 3.2.2 Customer Control and Math Benchmarks
    3. 3.3 General Purpose Processing (GPP) Performance
      1. 3.3.1 Examples and Factors Contributing to Results
        1. 3.3.1.1 Discontinuity Management
        2. 3.3.1.2 Switch() Example
    4. 3.4 Model-Based Design Benchmarks
    5. 3.5 Application Benchmarks
      1. 3.5.1 Single Phase 7kW OBC Description
      2. 3.5.2 Vienna Rectifier-Based Three Phase Power Factor Correction
      3. 3.5.3 Single-Phase Inverter
      4. 3.5.4 Machine Learning
    6. 3.6 Flash Memory Efficiency
    7. 3.7 Code-size Efficiency
  7. 4Summary
  8. 5References

Dead Zone Example

Dead zone code commonly occurs in real-time applications.

The code block below shows the the ternary operator '?' based approach to implementing dead zone code. The C29 (10 cycles, independent of input) outperforms the C28 (25-36 cycles, dependent on input) and Cortex-M7 (23-35 cycles, dependent on input). This efficiency is achieved through the delayed return instruction (RETD) and well-utilized delay slots containing compare (CMPF) and assignment (SELECT) instructions.

float deadzone(float in)
{
 float out; 
 float  out_pos = in - 1.0f;
 float  out_neg = in + 1.0f; 
 out = (in > 1.0f)?  out_pos : ((in > -1.0f)? 0.0f : out_neg); 
 return out; 
}
C29 Implementation
Function call:
CALL @deadzone 
|| LD.32 M0,@in1  
;---------CALLD occurs  
ST.32 @out1,M0  
 deadzone:
ONEF M1   
|| NEGONEF M2  
SADDF M3,M0,M2   
|| CMPF TDM0,M.GT,M0,M2  
|| SADDF M2,M0,M1  
|| RETD  
ZERO M4  
CMPF TDM1,M.GT,M0,M1  
|| SELECT TDM0,M0,M4,M2  
SELECT TDM1,M0,M3,M0  

C28 Implementation
Function call: MOVW  DP,#_in1 
MOV32 R0H,@_in1  
LCR   #_deadzone
MOVW  DP,#_out1   
MOV32 @_out1,R0H

_deadzone:
ADDB   SP,#2     
CMPF32 R0H,#16256
MOVST0 ZF, NF  
B      $C$L1,LEQ  
ADDF32 R0H,R0H,#49024  
B      $C$L3,UNC   
$C$L1:
CMPF32 R0H,#49024  
MOVST0 ZF, NF   
B      $C$L2,LEQ  
ZERO   R0H  
B      $C$L3,UNC   
$C$L2:
ADDF32 R0H,R0H,#16256   
$C$L3:
SUBB   SP,#2  
LRETR   

M7 Implementation
Function call:
VLDR  S0,[R6, #+144] 
BL    deadzone   
VSTR  S0,[R6, #+152] 
  
deadzone:
MOVS     R0,#+1   
MOVT     R0,#+16256   
VMOV     S2,R0   
VMOV.F32 S1,S0  
VCMP.F32 S1,S2  
FMSTAT  
VMOV.F32 S0,#1.0  
VADD.F32 S0,S1,S0  
BLT.N    deadzone_0   
VMOV.F32 S3,#-1.0  
VADD.F32 S0,S1,S3  
BX       LR   
deadzone_0:
MVN      R1,#+1082130432  
VMOV     S4,R1   
VCMP.F32 S1,S4  
FMSTAT  
ITT     GE   
MOVGE   R0,#+0   
VMOVGE  S0,R0   
BX      LR