NI MATRIXxTMAutoCodeTM ReferenceAutoCode ReferenceApril 2007370768C-01
ContentsAutoCode Reference x ni.comStates ...
© National Instruments Corporation 4-1 AutoCode Reference4Generating Code for Real-Time Operating SystemsThis chapter describes the RTOS configuration
Chapter 4 Generating Code for Real-Time Operating SystemsAutoCode Reference 4-2 ni.comConfiguration ItemsThe following is a list of configuration attr
Chapter 4 Generating Code for Real-Time Operating Systems© National Instruments Corporation 4-3 AutoCode ReferenceTable Naming ConventionTables are gi
Chapter 4 Generating Code for Real-Time Operating SystemsAutoCode Reference 4-4 ni.comExample 4-1 Processors Table Examplertos.processors = 2Sc
Chapter 4 Generating Code for Real-Time Operating Systems© National Instruments Corporation 4-5 AutoCode ReferenceExample 4-3 Subsystem Table Exampler
Chapter 4 Generating Code for Real-Time Operating SystemsAutoCode Reference 4-6 ni.comExample 4-4 Interrupt Table Examplertos.intrsupblk =Interrupt |
Chapter 4 Generating Code for Real-Time Operating Systems© National Instruments Corporation 4-7 AutoCode ReferenceStartup Procedure SuperBlock TableTa
Chapter 4 Generating Code for Real-Time Operating SystemsAutoCode Reference 4-8 ni.comExample 4-7 Processor IP Table Examplertos.IPprsrmap =Processor
Chapter 4 Generating Code for Real-Time Operating Systems© National Instruments Corporation 4-9 AutoCode Referenceconfiguration file is updated. Also,
© National Instruments Corporation 5-1 AutoCode Reference5Generated Code ArchitectureThis chapter supplies more details about the content and framewor
Contents© National Instruments Corporation xi AutoCode ReferenceDefinitions and Conventions ...
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-2 ni.comSignal NamingA signal in the diagram is represented as a variable in the generated c
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-3 AutoCode ReferenceGlobal StorageIn a strict modular programming paradigm,
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-4 ni.com• Write-To Variable Block (ALL Addressing mode)—These blocks execute after all other
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-5 AutoCode ReferenceSubsystemsThis section describes the design and operatio
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-6 ni.comTop-Level SuperBlockThe term Top-Level SuperBlock is often used. This term describes
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-7 AutoCode ReferenceFigure 5-1 illustrates the interface layers. The layers
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-8 ni.comDiscrete Subsystem Interface LayerThis layer comes in two variations to allow for bo
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-9 AutoCode ReferenceThis sample and hold mechanism guarantees deterministic
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-10 ni.comProcedure DataProcedure SuperBlocks have inputs, outputs and states independent of
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-11 AutoCode Referencesystem, because ordering of the outputs in a single-rat
ContentsAutoCode Reference xii ni.comChapter 7Code OptimizationRead from Variable Blocks ...
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-12 ni.comUnrolled InterfaceThere is another form of the procedural interface, the unrolled i
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-13 AutoCode ReferenceNote If you specify a specific partition with the %var
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-14 ni.comEXEC_ERROR: return;}/******* Subsystem 1 *******/void subsys_1(U, Y) struct _Sys
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-15 AutoCode Reference foo_2_u.foo_1 = U->t_l_1; foo(&foo_2_
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-16 ni.commixed data-typed variables reflecting each procedure output signal and type.The sta
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-17 AutoCode ReferenceThe parameter arrays RP (real parameters) and IP (integ
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-18 ni.comExtended Procedure Information StructureThe -epi option specifies that additional e
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-19 AutoCode ReferenceNotice the relative numbering within a task/procedure t
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-20 ni.comhowever, is to create additional space when declaring a variable of the info struct
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-21 AutoCode ReferenceAsynchronous ProceduresAsynchronous Procedures are proc
Contents© National Instruments Corporation xiii AutoCode ReferenceVariable Block Aliasing...
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-22 ni.comChanging %var Values During StartupA special feature of the Startup allows the valu
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-23 AutoCode ReferenceThe BlockScript block allows you to specify conditions
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-24 ni.comIn Example 5-5, alpha, beta, and gamma are the variables to be used as representati
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-25 AutoCode ReferenceInit, Output, and State PhasesA subsystem has phases be
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-26 ni.comDefault PhaseIf you do not specify a phase and/or all code is not contained within
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-27 AutoCode ReferenceLocal Variables and PhasesA local variable cannot be us
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-28 ni.com new_total = y;endif;Example 5-8 Generated Code from Example 5-7void subsys_1(U, Y
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-29 AutoCode ReferenceContinuous SemanticsThe state data within a continuous
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-30 ni.comIn Example 5-9, a hard-subscript, i, is used to access both inputs and outputs. The
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-31 AutoCode ReferenceExample 5-11 Local Variables Used to Allow Loops in Sca
© National Instruments Corporation 1-1 AutoCode Reference1IntroductionThis manual provides reference material for using AutoCode to write production q
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-32 ni.com• FOR Loop—Can generate either a rolled or unrolled loop depending upon the range o
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-33 AutoCode ReferenceParametersParameters represent data that can be used to
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-34 ni.comExample 5-14 BlockScript Block Example with Updating of a ParameterInputs: u;Output
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-35 AutoCode Reference else { total = U->bsb_1; } Y->bsb_22_1 = t
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-36 ni.com for i = 1:y.size do y(i) = 0.0; endif;endif;Example 5-17 Generated Code for B
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-37 AutoCode ReferenceUserCode BlockThe purpose of the UserCode Block (UCB) i
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-38 ni.comParameterized UCB CalloutA UCB can be defined with %var parameterized data for the
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-39 AutoCode ReferenceSoftware ConstructsThese blocks provide the software co
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-40 ni.comBREAK BlockThe WHILE construct indefinitely iterates unless a BREAK Block is execut
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-41 AutoCode ReferenceThe Read from Variable Block optimization also is suppo
Chapter 1 IntroductionAutoCode Reference 1-2 ni.com• Chapter 8, AutoCode Sim Cdelay Scheduler, discusses the Sim Cdelay low-latency scheduler.• Chapte
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-42 ni.comrepresentative of a sequence of equations. These equations are sensitive (that is,
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-43 AutoCode Reference• Algebraic loops are not supported.• AutoCode only per
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-44 ni.comDistributed Memory ArchitectureAutoCode also supports a multiprocessor architecture
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-45 AutoCode Reference3. Copy a block of local data into shared data:UPDATE_M
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-46 ni.com• SLONG stands for signed long. •ULONG stands for unsigned long. The naming convent
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-47 AutoCode ReferenceUPDATE_MBUFF_WITH_MBUFUSHORT(x, y, convert_macro_name)U
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-48 ni.comExample 5-21 shows template code to generate the required structure and pointer. Al
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-49 AutoCode Reference/**** declare pointer to shared variables ****/volatile
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-50 ni.comShared Memory Callout OptionAutoCode supports a shared memory callout for all acces
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-51 AutoCode Reference proc2_4_2 = Read_Shared_Varblk_Float(&isi_varblk
Chapter 1 Introduction© National Instruments Corporation 1-3 AutoCode ReferenceStructure and Content of the Generated CodeThis reference includes deta
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-52 ni.comThe formal argument represents the global reference number for which the variable b
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-53 AutoCode ReferenceThe formal argument represents the global reference num
Chapter 5 Generated Code ArchitectureAutoCode Reference 5-54 ni.comThe first formal argument represents which processor the access is taking place on.
Chapter 5 Generated Code Architecture© National Instruments Corporation 5-55 AutoCode ReferenceThe following code uses the Enter_Shared_Varblk... synt
© National Instruments Corporation 6-1 AutoCode Reference6Vectorized Code GenerationThis chapter discusses various ways to generate vectorized code. T
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-2 ni.comScalar Gain Block ExampleExample 6-1 shows the scalar code generated for a gain block
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-3 AutoCode ReferencewhereY(i) is the ith outputU(i) is the ith inputGainParam
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-4 ni.com if (SUBSYS_PREINIT[1]) { iinfo[0] = 0; iinfo[1] = 1; iin
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-5 AutoCode Referenceaddition to issues with the standard block library, all g
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-6 ni.comFigure 6-1. Poorly Connected Gain BlockExample 6-3 Generated Code for Poorly Connect
Chapter 1 IntroductionAutoCode Reference 1-4 ni.comRelated PublicationsNational Instruments provides a complete library of publications to support its
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-7 AutoCode Reference /* ---------------------------- Gain Block */
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-8 ni.comVector Labels and NamesThe SuperBlock Editor lets you give a name to a range of signa
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-9 AutoCode ReferenceFigure 6-2. Example Model DiagramExample 6-4 Maximal Vec
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-10 ni.com static struct _Subsys_1_states *X; static struct _Subsys_1_states *XD;
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-11 AutoCode Reference } SUBSYS_PREINIT[1] = FALSE; re
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-12 ni.comExample 6-5 Mixed Vectorized Code Generation (for Figure 6-2)/******* System Ext I/O
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-13 AutoCode Reference RT_FLOAT Brake; RT_FLOAT Gear; RT_FLOAT
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-14 ni.com k = k + 1; } } k = 1; for (i=1; i<=5; i++) {
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-15 AutoCode ReferenceNote The examples within this section assume maximal vec
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-16 ni.com 1.2, 2.3, 3.4, 4.5, 5.6,
© National Instruments Corporation 2-1 AutoCode Reference2C Language ReferenceThis chapter discusses files used to interface AutoCode and the generate
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-17 AutoCode ReferenceThe interesting part is that of the last gain block (gai
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-18 ni.comFigure 6-4. Example of a Split VectorExample 6-7 Generated Code for Split Vector (f
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-19 AutoCode ReferenceThe two producer gain blocks (top, bottom) vectorize as
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-20 ni.comExample 6-8 Generated Code (for Figure 6-5) /***** Output Update. *****/ /
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-21 AutoCode ReferenceYou should notice two things in the code shown in Exampl
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-22 ni.comFigure 6-6. Copy-Back ExampleExample 6-9 Generated Code (for Figure 6-6)void subsys
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-23 AutoCode ReferenceEliminating Copy-BackThere are many design ways to elimi
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-24 ni.comFigure 6-7. Vectorized Procedure InterfaceExample 6-10 Generated Code (for Figure 6
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-25 AutoCode Reference top[-1+i] = R_P[-1+i]*U->gain_1[-1+i];
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-26 ni.com INIT := TRUE; X := ptr_of(ss_1_states(0)’address); XD := pt
Chapter 2 C Language ReferenceAutoCode Reference 2-2 ni.comStand-Alone LibraryThis section describes the system-specific and target-specific stand-alo
Chapter 6 Vectorized Code Generation© National Instruments Corporation 6-27 AutoCode Reference------ Swap state pointers. ------ XTMP := X;
Chapter 6 Vectorized Code GenerationAutoCode Reference 6-28 ni.comMatrix OutputsWhen you provide matricized output labeling for a block, AutoCode gene
© National Instruments Corporation 7-1 AutoCode Reference7Code OptimizationThis chapter explains the details of generating production quality code for
Chapter 7 Code OptimizationAutoCode Reference 7-2 ni.com static RT_INTEGER iinfo[4]; /***** Local Block Outputs. *****/ RT_FLOAT new_11_1; R
Chapter 7 Code Optimization© National Instruments Corporation 7-3 AutoCode ReferenceExample 7-2 Code Generated with Variable Block Optimization Turned
Chapter 7 Code OptimizationAutoCode Reference 7-4 ni.com iinfo[1] = 0; } return; EXEC_ERROR: ERROR_FLAG[1] = iinfo[0]; iinfo[0]=0;}}AutoCode pe
Chapter 7 Code Optimization© National Instruments Corporation 7-5 AutoCode ReferenceWrite to the same variable block. Due to the cyclic nature of loop
Chapter 7 Code OptimizationAutoCode Reference 7-6 ni.com static const RT_FLOAT _R_P[8] = {-1.0, 1.0, 1.5, 2.0, -1.0, 1.0, 1.25,1.4}; /***
Chapter 7 Code Optimization© National Instruments Corporation 7-7 AutoCode Referencethe buffer _R_P and the initialization code are optimized away. In
Chapter 7 Code OptimizationAutoCode Reference 7-8 ni.comMerging INIT SectionsMost of the dynamic blocks have explicit initialization, output update an
SupportWorldwide Technical Support and Product Informationni.comNational Instruments Corporate Headquarters11500 North Mopac Expressway Austin, Texas
Chapter 2 C Language Reference© National Instruments Corporation 2-3 AutoCode Reference• The principal file is sa_utils.c, the stand-alone utilities f
Chapter 7 Code Optimization© National Instruments Corporation 7-9 AutoCode Reference /* ---------------------------- Time Delay */ /* {proc..22}
Chapter 7 Code OptimizationAutoCode Reference 7-10 ni.com X->proc_22_S1 = 0.0; X->proc_24_S1 = 0.0; XD->proc_22_S1 = 0.0; XD-
Chapter 7 Code Optimization© National Instruments Corporation 7-11 AutoCode ReferenceIn Example 7-5, both time delay blocks have separate INIT section
Chapter 7 Code OptimizationAutoCode Reference 7-12 ni.comExample 7-7 shows code generated without the reuse option, and Example 7-8 shows code generat
Chapter 7 Code Optimization© National Instruments Corporation 7-13 AutoCode Reference}Y->model_5_1 = X->model_5_S1;/* --------------------------
Chapter 7 Code OptimizationAutoCode Reference 7-14 ni.comAll of the blocks can accept constants as inputs. If any input is available during code gener
Chapter 7 Code Optimization© National Instruments Corporation 7-15 AutoCode Reference/* {const..4} */Y->const_4_1 = 2.0*const_2_1;...Example 7-10
Chapter 7 Code OptimizationAutoCode Reference 7-16 ni.cominput of the gain block and the expression 2.0 * const_2 is evaluated to 4 as the value of co
Chapter 7 Code Optimization© National Instruments Corporation 7-17 AutoCode Referenceconstant block is optimized away, including the output variable.
Chapter 7 Code OptimizationAutoCode Reference 7-18 ni.comIf you have decided on the MatrixRightDivide block, the tips for optimizing the inputs are mu
Chapter 2 C Language ReferenceAutoCode Reference 2-4 ni.comData TypesSeveral of the target-specific utilities are involved with data types (in the sa_
Chapter 7 Code Optimization© National Instruments Corporation 7-19 AutoCode Reference SummaryAll of the optimizations discussed so far can be used at
© National Instruments Corporation 8-1 AutoCode Reference8AutoCode Sim Cdelay SchedulerThis chapter discusses the Sim Cdelay low-latency scheduler.Int
Chapter 8 AutoCode Sim Cdelay SchedulerAutoCode Reference 8-2 ni.comreal-time hardware. It assumes the reader is familiar with the concepts of AutoCod
Chapter 8 AutoCode Sim Cdelay Scheduler© National Instruments Corporation 8-3 AutoCode ReferenceStandard AutoCode SchedulerTo illustrate the behavior
Chapter 8 AutoCode Sim Cdelay SchedulerAutoCode Reference 8-4 ni.comFigure 8-1. Model with Enabled and Triggered TasksUnder the default AutoCode sche
Chapter 8 AutoCode Sim Cdelay Scheduler© National Instruments Corporation 8-5 AutoCode ReferenceScheduler Pipeline section that these latencies are ca
Chapter 8 AutoCode Sim Cdelay SchedulerAutoCode Reference 8-6 ni.comtriggers/enables have gone high are queued for execution. Then, in stage D, ATR ta
Chapter 8 AutoCode Sim Cdelay Scheduler© National Instruments Corporation 8-7 AutoCode Referencequeue tasks stage for that scheduler invocation has al
Chapter 8 AutoCode Sim Cdelay SchedulerAutoCode Reference 8-8 ni.comNow the inherent problem in the standard scheduler is clear. From launch to output
Chapter 8 AutoCode Sim Cdelay Scheduler© National Instruments Corporation 8-9 AutoCode ReferenceSim Cdelay SchedulerAs stated at the outset, the goal
Chapter 2 C Language Reference© National Instruments Corporation 2-5 AutoCode Referenceto. For example, RT_INTEGER can be redefined as long int if ari
Chapter 8 AutoCode Sim Cdelay SchedulerAutoCode Reference 8-10 ni.comtriggers arriving too quickly can prevent a task from ever posting any output.You
Chapter 8 AutoCode Sim Cdelay Scheduler© National Instruments Corporation 8-11 AutoCode ReferenceFigure 8-6. New STD for ATR Triggered TasksFigure 8-
Chapter 8 AutoCode Sim Cdelay SchedulerAutoCode Reference 8-12 ni.comThese transition diagrams, together with the diagrams in Chapter 4, Managing and
Chapter 8 AutoCode Sim Cdelay Scheduler© National Instruments Corporation 8-13 AutoCode ReferenceDataStore Priority ProblemAs mentioned, you must find
Chapter 8 AutoCode Sim Cdelay SchedulerAutoCode Reference 8-14 ni.comfor tsk <- low_prio_tsk..high_prio_tsk do { /* loop from low to high
Chapter 8 AutoCode Sim Cdelay Scheduler© National Instruments Corporation 8-15 AutoCode ReferenceFigure 8-8. Latencies Present in the AutoCode Schedu
Chapter 8 AutoCode Sim Cdelay SchedulerAutoCode Reference 8-16 ni.comAt the template level, the default Sim with Cdelay ATR triggered task behavior of
Chapter 8 AutoCode Sim Cdelay Scheduler© National Instruments Corporation 8-17 AutoCode Referencethat repeated until no new tasks where queued for exe
© National Instruments Corporation 9-1 AutoCode Reference9Global Scope Signals and Parameterless ProceduresThis chapter discusses global scope signals
Chapter 9 Global Scope Signals and Parameterless ProceduresAutoCode Reference 9-2 ni.comThese new features address the following two uses:• Data Monit
Chapter 2 C Language ReferenceAutoCode Reference 2-6 ni.comThe sa_utils.c file contains comments about each of the routines as they are used for compa
Chapter 9 Global Scope Signals and Parameterless Procedures© National Instruments Corporation 9-3 AutoCode Referencememory address, and that string is
Chapter 9 Global Scope Signals and Parameterless ProceduresAutoCode Reference 9-4 ni.comLimitationsThis section identifies some of the limitations of
Chapter 9 Global Scope Signals and Parameterless Procedures© National Instruments Corporation 9-5 AutoCode ReferenceParameterless ProcedureA parameter
Chapter 9 Global Scope Signals and Parameterless ProceduresAutoCode Reference 9-6 ni.comNote NI suggests that you adopt a naming convention for all of
Chapter 9 Global Scope Signals and Parameterless Procedures© National Instruments Corporation 9-7 AutoCode ReferenceCondition Block Code GenerationThe
Chapter 9 Global Scope Signals and Parameterless ProceduresAutoCode Reference 9-8 ni.comNote You must write template code to customize the declaration
Chapter 9 Global Scope Signals and Parameterless Procedures© National Instruments Corporation 9-9 AutoCode ReferenceConnection to External OutputIf a
Chapter 9 Global Scope Signals and Parameterless ProceduresAutoCode Reference 9-10 ni.comAnalyzer and AutoCode WarningsThe Analyzer reports questionab
© National Instruments Corporation A-1 AutoCode ReferenceATechnical Support and Professional ServicesVisit the following sections of the National Inst
© National Instruments Corporation I-1 AutoCode ReferenceIndexAadd and subtract macros, 2-40argumentsUCB-Ada fixed calling, 3-12UCB-C fixed calling, 2
Chapter 2 C Language Reference© National Instruments Corporation 2-7 AutoCode ReferenceTwo error functions are provided, fatalerr( ) and error( ). The
IndexAutoCode Reference I-2 ni.comcompile_ada_sa.sh compilation script, 3-11compile_c_sa.sh compilation script, 2-11compiling, 2-1condition block. See
Index© National Instruments Corporation I-3 AutoCode Reference_.a extension (Ada), 3-3compile_ada_sa.sh, 3-11compile_c_sa.sh, 2-11sa_defn.a, 3-4sa_def
IndexAutoCode Reference I-4 ni.combitwise functions, 3-26comparing to sim results, 3-35compilation example, 3-21compiler problems, 3-35conversion func
Index© National Instruments Corporation I-5 AutoCode ReferenceOlvarblk option, 7-4Onorestart option, 7-5propagating constants (Opc option), 7-13removi
IndexAutoCode Reference I-6 ni.comdistributed memory architecture, 5-44mapping command options, 5-45shared memoryarchitecture, 5-43callouts, 5-44optim
Index© National Instruments Corporation I-7 AutoCode ReferenceLlocal variable blocks, 5-40, 5-41local variables, 5-27Mmacro interface, 2-27files neede
IndexAutoCode Reference I-8 ni.comRR_P, 5-9UCB fixed call argument, Ada, 3-12rapid prototyping, 1-2real-time codegenerating, 3-16real-time file, 3-16r
Index© National Instruments Corporation I-9 AutoCode Referencesa_fxdiv_long.c file, 2-32, 2-34sa_fxdiv_short.c file, 2-34sa_fxlimit.h file, 2-32, 2-33
IndexAutoCode Reference I-10 ni.comshared memorycallouts, 5-50fixed-point calloutsAda, 5-47C, 5-46shared variable block support, 5-47simulation, stand
Index© National Instruments Corporation I-11 AutoCode Referencetemplate code for variable block structures, 5-48timing overflow, 2-8training and certi
Chapter 2 C Language ReferenceAutoCode Reference 2-8 ni.comthe comments there and adjust the limits accordingly, then recompile and relink the sa_util
IndexAutoCode Reference I-12 ni.comXX (UCB fixed call argument)Ada, 3-12C, 2-13XD (UCB fixed call argument)Ada, 3-12C, 2-13XINPUT array, 2-10Xmath {ma
Chapter 2 C Language Reference© National Instruments Corporation 2-9 AutoCode ReferenceImplementation_Initialize( ) Functionvoid Implementation_Initia
Chapter 2 C Language ReferenceAutoCode Reference 2-10 ni.comExternal_Input ( ) FunctionRT_INTEGER External_Input(void) External_Input( ) is for use in
Chapter 2 C Language Reference© National Instruments Corporation 2-11 AutoCode ReferenceLinking Handwritten UCBs with AutoCode ApplicationsTo write co
Chapter 2 C Language ReferenceAutoCode Reference 2-12 ni.comFigure 2-1. Example UserCode Function File (sa_user.c)The $ucb directive is recognized an
Important InformationWarrantyThe media on which you receive National Instruments software are warranted not to fail to execute programming instructio
Chapter 2 C Language Reference© National Instruments Corporation 2-13 AutoCode ReferenceImplementing Handwritten UCBsArguments are passed for each cal
Chapter 2 C Language ReferenceAutoCode Reference 2-14 ni.comThe operations within UCBs are controlled by the argument INFO, a pointer to a structure o
Chapter 2 C Language Reference© National Instruments Corporation 2-15 AutoCode ReferenceFigure 2-2. Linking Handwritten UCBs with AutoCode Applicatio
Chapter 2 C Language ReferenceAutoCode Reference 2-16 ni.comLinking Handwritten UCBs (for AutoCode) with SystemBuildAfter you have written a UCB to cr
Chapter 2 C Language Reference© National Instruments Corporation 2-17 AutoCode ReferenceFigure 2-3. Linking Handwritten UCBs with the SystemBuild Sim
Chapter 2 C Language ReferenceAutoCode Reference 2-18 ni.comapplications, make sure you adapt the same algorithm in the body of a function using the A
Chapter 2 C Language Reference© National Instruments Corporation 2-19 AutoCode ReferenceAs previously stated, the inputs and outputs of the UCB will h
Chapter 2 C Language ReferenceAutoCode Reference 2-20 ni.comLinking a Variable Interface UCB with the SimulatorUnlike the fixed interface which provid
Chapter 2 C Language Reference© National Instruments Corporation 2-21 AutoCode Referenceproc_ucb_hook. Refer to the Template Programming Language User
Chapter 2 C Language ReferenceAutoCode Reference 2-22 ni.comLinking Procedures with Real-Time Applications or SimulatorGenerate reusable procedures fr
ConventionsThe following conventions are used in this manual:<> Angle brackets that contain numbers separated by an ellipsis represent a range o
Chapter 2 C Language Reference© National Instruments Corporation 2-23 AutoCode Reference3. Create an object of type _procedure name_s where the states
Chapter 2 C Language ReferenceAutoCode Reference 2-24 ni.compoint to the appropriate global variables. A pointer to this object will be passed as argu
Chapter 2 C Language Reference© National Instruments Corporation 2-25 AutoCode Referenceproperly. Refer to the SystemBuild User Guide for an explanati
Chapter 2 C Language ReferenceAutoCode Reference 2-26 ni.comdata-typed variables reflecting each subsystem input signal and type. The outputs to the s
Chapter 2 C Language Reference© National Instruments Corporation 2-27 AutoCode Referencenumber—for each integer item and the sign are managed by the c
Chapter 2 C Language ReferenceAutoCode Reference 2-28 ni.comlanguage and replace the supplied macros (or functions) with your (assembly) functions so
Chapter 2 C Language Reference© National Instruments Corporation 2-29 AutoCode ReferenceA typical fixed-point type looks like the following:RT_USHORT0
Chapter 2 C Language ReferenceAutoCode Reference 2-30 ni.com RT_SSHORT05 SS5; RT_SSHORT SS0; RT_SSHORT05 SS5_1;};struct _Sys_ExtIn { RT_USHORT13 US13;
Chapter 2 C Language Reference© National Instruments Corporation 2-31 AutoCode ReferenceThe UTs appear as typedef statements in the generated C code.
Chapter 2 C Language ReferenceAutoCode Reference 2-32 ni.comMacro InterfaceThe macro interface files are:sa_types.h Updated to include fixed-point typ
© National Instruments Corporation v AutoCode ReferenceContentsChapter 1IntroductionManual Organization ...
Chapter 2 C Language Reference© National Instruments Corporation 2-33 AutoCode Referencesa_fx_externs.c Contains definitions for extern variables such
Chapter 2 C Language ReferenceAutoCode Reference 2-34 ni.comsa_fxsub_byte.c Contains fixed-point subtraction functions for byte data type.sa_fxsub_sho
Chapter 2 C Language Reference© National Instruments Corporation 2-35 AutoCode ReferenceFixed-Point Conversion and Arithmetic MacrosAlthough this sect
Chapter 2 C Language ReferenceAutoCode Reference 2-36 ni.comFigures 2-6 through 2-8 show how the conversion macros are named. Notice that macro names
Chapter 2 C Language Reference© National Instruments Corporation 2-37 AutoCode ReferenceFigure 2-7. AutoCode/C Conversion Macros for Fixed-to-Integer
Chapter 2 C Language ReferenceAutoCode Reference 2-38 ni.comArithmetic MacrosThe arithmetic macros perform addition, subtraction, multiplication, and
Chapter 2 C Language Reference© National Instruments Corporation 2-39 AutoCode ReferenceTable 2-7 shows permissible operand and result sizes for the a
Chapter 2 C Language ReferenceAutoCode Reference 2-40 ni.comImplementation of the Addition and Subtraction MacrosAutoCode has two implementations of t
Chapter 2 C Language Reference© National Instruments Corporation 2-41 AutoCode ReferenceAlign the radix positions of n1 and n2 to the radix position o
Chapter 2 C Language ReferenceAutoCode Reference 2-42 ni.com0^1111111 (n2' = (127,r7), decimal value = .9921875)___________0^0000000 (n3 = (0,r7)
ContentsAutoCode Reference vi ni.comLinking Procedures with Real-Time Applications or Simulator ... 2-22Invoking Generated Procedures
Chapter 2 C Language Reference© National Instruments Corporation 2-43 AutoCode Referencethe maximum possible value representable in 32 bits—is returne
Chapter 2 C Language ReferenceAutoCode Reference 2-44 ni.comin terms of speed, but is needed to compute an accurate result. By changing this behavior,
Chapter 2 C Language Reference© National Instruments Corporation 2-45 AutoCode ReferenceFor example, the macro to check an 8-bit unsigned number and a
© National Instruments Corporation 3-1 AutoCode Reference3Ada Language ReferenceThis chapter discusses files used to interface AutoCode and the genera
Chapter 3 Ada Language ReferenceAutoCode Reference 3-2 ni.com Supplied Templatesada_rt.tpl TemplateThe ada_rt.tpl template is the default when generat
Chapter 3 Ada Language Reference© National Instruments Corporation 3-3 AutoCode ReferenceStand-Alone LibraryThis section describes the system-specific
Chapter 3 Ada Language ReferenceAutoCode Reference 3-4 ni.com• The principal file is sa_utils.a (or sa_utils.ada), the stand-alone utilities file. Whe
Chapter 3 Ada Language Reference© National Instruments Corporation 3-5 AutoCode Referencefloating-point MATH_LIB. The sa_time.a/.ada file provides the
Chapter 3 Ada Language ReferenceAutoCode Reference 3-6 ni.comTarget-Specific UtilitiesThe target-specific utilities in the sa_utils.a or sa_utils.ada
Chapter 3 Ada Language Reference© National Instruments Corporation 3-7 AutoCode ReferenceThe sa_utils.a or sa_utils.ada file contains comments about e
Contents© National Instruments Corporation vii AutoCode ReferenceExternal_Input ( ) Procedure...
Chapter 3 Ada Language ReferenceAutoCode Reference 3-8 ni.comRefer to the Chapter 14, UserCode Blocks, of the SystemBuild User Guide or the source lis
Chapter 3 Ada Language Reference© National Instruments Corporation 3-9 AutoCode ReferenceBy default, several error conditions are trapped in the proce
Chapter 3 Ada Language ReferenceAutoCode Reference 3-10 ni.comThese messages indicate that the sizes of the time vector and input array have exceeded
Chapter 3 Ada Language Reference© National Instruments Corporation 3-11 AutoCode ReferenceExternal_Input( ) is much the same; it returns an input vect
Chapter 3 Ada Language ReferenceAutoCode Reference 3-12 ni.comCalling UCBsEvery one of the following arguments will be passed for each call to the UCB
Chapter 3 Ada Language Reference© National Instruments Corporation 3-13 AutoCode ReferenceThe operations within UCBs are controlled by the INFO argume
Chapter 3 Ada Language ReferenceAutoCode Reference 3-14 ni.comProcedure SuperBlocksThis section describes how to generate and link Procedure SuperBloc
Chapter 3 Ada Language Reference© National Instruments Corporation 3-15 AutoCode Reference------------------------------------------------------------
Chapter 3 Ada Language ReferenceAutoCode Reference 3-16 ni.comAda Fixed-Point ArithmeticThis section describes the implementation of fixed-point arith
Chapter 3 Ada Language Reference© National Instruments Corporation 3-17 AutoCode ReferenceFixed-Point Data TypesFixed-point type declarations exist in
ContentsAutoCode Reference viii ni.comChapter 4Generating Code for Real-Time Operating SystemsReal-Time Operating System Configuration File...
Chapter 3 Ada Language ReferenceAutoCode Reference 3-18 ni.comPackage DependenciesThe fixed-point AutoCode/Ada architecture forces a dependency among
Chapter 3 Ada Language Reference© National Instruments Corporation 3-19 AutoCode ReferenceGenerated Code with Fixed-Point VariablesFixed-point arithme
Chapter 3 Ada Language ReferenceAutoCode Reference 3-20 ni.comSystem-Level Parameters to Generate User TypesTable 3-6 describes new system-level param
Chapter 3 Ada Language Reference© National Instruments Corporation 3-21 AutoCode Referencefrequently overflowing, a different data type should be sele
Chapter 3 Ada Language ReferenceAutoCode Reference 3-22 ni.com1. Build a model—Use the SuperBlock Editor to construct a model that uses fixed-point ty
Chapter 3 Ada Language Reference© National Instruments Corporation 3-23 AutoCode Reference4. Compile the generated files—Two source files are generate
Chapter 3 Ada Language ReferenceAutoCode Reference 3-24 ni.comTable 3-9. Generic Function SummaryFunction Name PurposeFIXED_ADDAddition of two fixed-
Chapter 3 Ada Language Reference© National Instruments Corporation 3-25 AutoCode ReferenceLONGINTCASTFixed-point value to RT_LONG_INTEGER conversion.L
Chapter 3 Ada Language ReferenceAutoCode Reference 3-26 ni.comBit-Wise FunctionsA restricted set of bit-wise operations have been defined for certain
Chapter 3 Ada Language Reference© National Instruments Corporation 3-27 AutoCode ReferenceConversion Function InstantiationsThe RT_FIXED_OPERATORS pac
Contents© National Instruments Corporation ix AutoCode ReferenceSystem External Interface Layer ...
Chapter 3 Ada Language ReferenceAutoCode Reference 3-28 ni.comSample PackageExample 3-3 shows a generated RT_FIXED_OPERATORS package.Example 3-3 Gener
Chapter 3 Ada Language Reference© National Instruments Corporation 3-29 AutoCode Referencefunction “>=” is new SA_FIXED_GENERICS.GREATEREQUAL(SA_FI
Chapter 3 Ada Language ReferenceAutoCode Reference 3-30 ni.comThe selection of the intermediate type is performed by the code generator. The selection
Chapter 3 Ada Language Reference© National Instruments Corporation 3-31 AutoCode ReferenceMultiplication and Division FunctionsThe predefined multipli
Chapter 3 Ada Language ReferenceAutoCode Reference 3-32 ni.comno chance of overflow. To support these issues there are three types of conversion funct
Chapter 3 Ada Language Reference© National Instruments Corporation 3-33 AutoCode ReferenceFor these types of conversions, the language-defined convers
Chapter 3 Ada Language ReferenceAutoCode Reference 3-34 ni.comThe data in the sp_fxp parameters represent the operators and conversion used in the cur
Chapter 3 Ada Language Reference© National Instruments Corporation 3-35 AutoCode ReferenceKnown Ada Compiler ProblemsThe architecture of AutoCode/Ada
Chapter 3 Ada Language ReferenceAutoCode Reference 3-36 ni.com• Floating-Point Textual Representation—The values generated from a stand-alone simulati
Chapter 3 Ada Language Reference© National Instruments Corporation 3-37 AutoCode ReferenceExample 3-6 Example Code Causing Ambiguous Selection of Over
Komentarze do niniejszej Instrukcji