Home
VisualDSP++ 2.0 Assembler & Preprocessor Manual for
Contents
1. e Append the appropriate file name extension to each file T he assembler uses each file s extension to determine what operations to perform T able 2 2 on page 2 19 lists the valid file extensions that the assembler accepts T he assembler handles file name extensions as follows e Files with an asm or no extension are treated as assembly source files to be assembled e Files with an H extension named in an include command are treated as header files to be preprocessed Files with a bAT extension named with an 1 switch are treated as data initialization files to be searched e Filename typed in lower or uppercase defines the same file 2 18 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler T able 2 2 summarizes file extension conventions that the assembler follows Table 2 2 File Name Extension Conventions Extension File Description asm Assembly source file N ote that the assembler treats all files with unrecognized extensions as assembly source files with an asm extension is Preprocessed assembly source file A H eader file doj Assembled object filein ELF D WARF 2 format dat D ata initialization file T he assembler command line switches are case sensitive T he following command line for example easmts TS001 1 plList 1st Dmax 100 v o bin pl doj pl asm runs the assembler with TS001 Assembles instructions uniq
2. 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler e Assembler directives Directives begin with a period and end with a semicolon The period must be the first character on the line containing your direc tive The assembler does not differentiate between directives in low ercase and uppercase N ote that this manual prints directives in uppercase to distinguish them from other assembly statements Example SECTION datal VAR sqrt_coeff 2 0x00000001 0x00000002 For complete description of the directive set for the AD SP T Sxxx assembler see Assembler Directives on page 2 38 e Preprocessor commands Preprocessor commands begin with a pound sign and end with a carriage return T he pound sign must be the first character on the line containing the command If the command is longer than one line use a backslash and a carriage return to continue the com mand on the next line D o not put any characters between the back slash and the carriage return Unlike assembly directives preprocessor commands are case sensitive and must be lowercase For alist of the preprocessor commands see Preprocessor C om mands on page 3 16 Example include string h define MAX 100 Figure 2 2 on page 2 9 contains a sample assembly source file VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 7 Assembler Guide Program Structure An assembly source f
3. You extend this set of keywords with symbols that declare sections vari ables constants and address labels W hen defining symbols in assembly source code follow these conventions D efine symbols that are unique within the file in which they are declared If you use a symbol in more than one file use the GLoBAL directive to export the symbol from the file in which it is defined Then use the EXTERN directive to import the symbol into other files Begin symbols with alphabetic characters Symbols can use the alphabetic characters a z and a z digits 0 9 and special characters and _ dollar sign and underscore Symbols are case sensitive SO input_addr and INPUT_ADDR define unique variables as the first character of a symbol is considered reserved by the assembler Do not use a reserved keyword to define a symbol T he AD SP T Sxxx assembler s reserved keywords are shown in Listing 2 2 M atch source and LDF sections symbols Ensure that secTIONS name symbols do not conflict with the linker s keywords in the Linker Description File LoF The linker uses sections name symbolsto place codeand datain D SP memory For more details see the VisualD SP 2 0 Linker amp Utilities M an ual for TigerSH ARC DSPs Ensurethat secTions namesymbolsdo not begin with the reja string reserved by the assembler to form relocatable sections U sea colon to terminate address label symb
4. 2 0 Linker and Utilities M anual for TigerSH ARC D SPs Preprocessor commands directs the preprocessor to include files per form macro substitutions and control conditional assembly For more information see Preprocessor Commands on page 3 16 2 70 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs
5. a sym bol specifies an offset from the address the symbol represents Assembler Operators T able 2 4 lists the assembler s numeric and bitwise operators used in con stant expressions and address expressions T hese operators are listed in the order they are processed while the assembler evaluates your expressions N ote that assembler limits operators in address expressions to addition and subtraction Table 2 4 O perator Precedence Char t O perator Usage D escription expression expression in parenthesis evaluates first Ones complement Unary minus M ultiply Divide M odulus Addition Subtraction 2 32 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs Assembler Table 2 4 O perator Precedence C hart C ont d O perator Usage D escription lt lt Shift left gt gt Shift right lt Less than lt Less than or equal gt Greater than gt Greater than or equal Equal N ot equal amp Bitwise AND Bitwise inclusive O R 5 Bitwise exclusive OR amp amp Logical AND Logical OR T he assembler also supports special address of length of and page of operators VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 33 Assembler Syntax Reference T able 2 5 lists and describes these operators used in constant and a
6. at this code sample notice that an assembly source often contains preprocessor commands such as include for inclusions of other files in your source code ifdef for conditional assembly or define for macro definitions The assembler directives such as vAR appear within a section to declare and initialize variables Listing 2 1shows a sample user defined Linker Description File Looking at the LDF s secTions command notice that the input sections names match the memory sections names used in the following assembly sample program The LDF s sections command defines the secTron place ments in the AD SP T Sxxx system s physical memory as defined by the linker s Memory Command Listing 2 1 LDF Code Example ARCHITECTURE ADSP TSO01 SEARCH_DIR m Libraries COMMAND_L OBJECTS libsim dlb ADI_DSP TS 1lib from the command line are included in NE_OBJECTS TS_hdr doj Internal n MEMORY MOCode MlData MlHeap M1Stack M2Data M2Stack COMMAND_LINE_OBJECTS TS_exit doj libcpp dlb emory blocks are 0x10000 64k TYPECRAM TYPECRAM TYPECRAM TYPECRAM TYPE RAM TYPE RAM NANNNnNnnn 0x00000000 0x00080000 0x0008C000 0x0008C800 0x00100000 0x0010C000 END 0x0000FFFF END 0x0008BFFF END 0x0008C7FF END 0x0008FFFF END 0x0010BFFF END 0x0010FFFF libc dlb WIDT WIDT WIDT WIDT WIDT W
7. e Assembler Command Line Reference on page 2 16 e Assembler Syntax Reference on page 2 27 e Assembler Glossary on page 2 70 2 2 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler Assembler Guide T he guide section describes the process of developing new programs in the AD SP T Sxxx D SPs assembly language T his section provides infor mation that you need to know when assembling your programs from the operating system s command line Software developers using the assembler should be familiar with the fol lowing operations e Writing Assembly Programs on page 2 3 e Preprocessing a Program on page 2 13 e Reading a Listing File on page 2 14 e Setting Assembler O ptions on page 2 15 For information about the D SP architecture including the D SP instruc tion set that you use when writing assembly programs see the hardware and instruction set manuals Writing Assembly Programs W rite your assembly language programs using the V isualD SP editor or any editor that produces text files Do not use a word processor that embeds special control codes in the text Append an Asm extension to source file names to identify them as assembly source files Assemble your source files either using the assembler s command line or from the VisualD SP environment In the default mode of operation the assembler processes an input file through the listed
8. initial values from the f77eName data file DAT If the initial ization fileisin the current project directory only the filename need be given inside brackets O therwise you specify the directory and the name of the initialization file with the 1 switch The ellipsis represents a comma delimited list of parameters The optional 7ength parameter defines the length of the associ ated buffer in words The number of initialization elements defines the 7ength of an implicit size buffer The initExpressions parameters set initial values for variables and buffer elements VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 67 Assembler Syntax Reference The following lines of code demonstrate some var directives VAR samples 10 11 12 13 14 declare and initialize an implicit length buffer VAR Ins Outs Remains declare three uninitialized variables VAR samples 100 inits dat declare a 100 location buffer and initialize it with the contents of the inits dat file VAR taps 100 declare a variable and initialize the variable to 100 VAR twiddles 10 phase dat declare a 10 location buffer and load the buffer with the contents of the phase dat file Initializing from files is useful for loading buffers with data such as filter coefficients or FFT phase rotation factors that are generated by other pro grams T he assembler determines
9. line Example EXTERN coeffs This code declares coeffs as external meaning that it was declared as GLOBAL in another file and it is referenced in this file 2 46 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler FILE Override the Name of an Object File The FILE directive overrides the name of an object file specified with the o filename command line switch T his directive may appear in the C compiler generated assembly source file s The FILE directive is used to ensure that the debugger has the correct file name for a symbol table T his directive is added in connection with overlay linking to enable over riding of the filename given on the command line T his directive uses the following syntax FILE filename ext where e filename isthe name the assembler applies to the object file T he argument is enclosed in double quotes Example SEILE Veet ve the argument may be a c file SECTION datal VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 47 Assembler Syntax Reference GLOBAL Make a Symbol Globally Available The GLOBAL directive changes the scope of a symbol from local to global making the symbol available for reference in object files that are linked with the current one By default a symbol is valid only in the file in which it is declared Local symbols in different files can have the
10. page break in a listing NOLIST see page 2 50 Stops listing of source lines NOLIST_DATFILE see page 2 51 Stops listing of data initialization files NOLIST_WRAPDATA see page 2 54 Stops wrapping opcodes that don t fit listing col umn VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 39 Assembler Syntax Reference Table 2 8 Assembler Directives Cont d Directive Description PAGELENGTH see page 2 56 Defines the length of a listing PAGEWIDTH see page 2 57 D efines the width of a listing PRECISION see page 2 58 Selects a floating point precision PREVIOUS see page 2 59 Reverts to a previously described SECTION ROUND see page 2 60 Selects floating point rounding SECTION see page 2 62 M arks the beginning of a section SIZE see page 2 64 Calculates the size of a function TYPE see page 2 65 Changes the default data type of a symbol U sed by C compiler VAR see page 2 66 Defines and initializes data objects 2 40 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler ALIGN Specify an Address Alignment The ALIGN directive forces the address alignment of a data item within the SeEcTION it is used When aligning instructions the ALIGN_CODE directive to be used instead For information about ALIGN_CODE see page 2 44 The ALIGN directive uses the following syntax ALIGN ex
11. place that section in the selected memory with the linker Figure 2 2 on page 2 9 shows how a program divides into sec 2 8 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler tions to be placed in the unified memory of the TigerSH ARC processor by the linker Data Section SECTION datal Assembler gt VAR bufferl 0x100 data_buf dat Directive Data Section p SECTION data2 VAR buffer2 Code Section SECTION progra Assembler start een ifndef XRO_SET_T0_2 Commands for XRO Ox00000001 Conditional p endif Assembly ifdef XRO_SET_TO_2 XRO 0x00000002 dtendif Assembly Instructions gt Jl bufferl JL1 0 J2 1 LCO 0x100 this_loop Jdl J2 XRO IF NLCOE JUMP this_loop Figure 2 2 Example Assembly Source File T he sample assembly program splits into sections each section begins with a SectTion directive and ends with the occurrence of the next SECTION directive or end of file The source program contains two data and one program sections as follows VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs 2 9 Assembler Gui de e Data Sections datal and data2 variables and buffers are declared and can be initialized e Program Section program instructions including statements for conditional assembly are coded in program sections Looking
12. same name and the assembler con siders them to be independent entities Global symbols are recognizable in other files and refer to the same address and value You change the default scope of a symbol with the eLoBaL directive O nce the symbol is declared global other files may refer to it with EXTERN For more information on the EXTERN directive see page 2 46 The GLOBAL directive uses the following syntax GLOBAL symbolNamel symbo Name2 where e symbolName isthe name of a global symbol A single GLOBAL direc tive may define the global scope of any number of symbols sepa rated by commas on one line Example VAR coeffs 10 declares a buffer VAR taps 100 declares a variable GLOBAL coeffs taps makes the buffer and the variable visible in other files 2 48 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler LEFTMARGIN Set the Margin Width of a Listing File The LEFTMARGIN directive sets the margin width of a listing page It spec ifies the number of empty spaces at the left margin of the listing file which the assembler produces when you use the 1 switch In the absence of the LEFTMARGIN directive the default is zero 0 no spaces in the left margin T he assembler checks the LEFTMARGIN and PAGEWIDTH values against one another If the specified values do not allow enough room for a properly formatted listing page the assembler will issue a warn
13. see LIST_DEFTAB Set the D efault Tab Width for Listings on page 2 52 Both the default tab width and the local tab width can be changed any number of times via the LIST_DEFTAB and LIST_LOCTAB directives The default tab width is inherited by nested source files but the local tab width only affects the current source file The LIST_LOCTAB directive uses the following syntax LIST_LOCTAB expression where expression evaluates to an integer greater than or equal to 0 A value of 0 sets the local tab width to the current setting of the default tab width In the absence of a LIST_LOCTAB directive the local tab width defaults to the current setting for the default tab width Example See the L1ST_DEFTAB example on page 2 52 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 53 Assembler Syntax Reference LIST WRAPDATA NOLIST WRAPDATA The LIST_WRAPDATA NOLIST_WRAPDATA directives control the listing of opcodes that are too big to fit in the opcode column T hese directives are off by default T his directive pair actually applies to any opcode that won t fit but in practice such a value will almost always be data alignment directives can also result in large opcodes e f LIST_WRAPDATA is in effect the opcode value is wrapped so that it fits in the opcode column resulting in multiple listing lines e If NOLIST_WRAPDATA isin effect the printout has only as much as fits i
14. 2 ASSEMBLER Overview The easmTS exe assembler runs from an operating system command line or from the VisualD SP environment T he assembler processes assembly source data header files and produces an object file Assembler opera tions depend on two types of controls assembler directives and assembler switches Assembler directives are coded in your assembly source file T he directives let you define and initialize variables set up hardware features and iden tify program s sections for placement within DSP memory The assembler uses directives for guidance as it translates a source program into object code Assembler switches are specified on the operating system s command line or in the Assemble tab of the VisualD SP environment s Project Options dialog box T hese switches allow you to control the assembly pro cess of source data and header files You also use these switches to select assembler s features such as search paths output file names and macro preprocessing among others This chapter provides information that you need to know when develop ing and assembling programs for the TigerSH ARC DSPs The assembler section or SECTION declaration referred to here corresponds to a linker input sec tion VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs 2 1 Overview T he chapter contains the following information about the assembler e Assembler Guide on page 2 3
15. AB SE SECTION SFO SF SNGL SIZE SUM TMAX TYPEVAR VM VMAX XOR ZF JK Register Group J0 through J31 0 through K31 JBO JB1 JB2 JB3 BO KB1 B2 KB3 JLOJLI JL2 JL3 LOKL1 L2 KL3 RF Register Group FRO through FR31 R3 0 MR3 2 MR1 0 2 28 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler RO through R31 XSTAT YSTAT XYSTAT Accelerator Register Group ROTR1 TR2 TR3 TR4 TR5 TR6 TR7 TR8 TRI HROTHRI1 EP Register Group BMAX BMAXC FLGPIN FLGPINCL FLGPINST SDRCON SYSCON SYSCONCL SYSCONST SYSCTL SYSTAT SYSTATCL Misc Register Group AUTODMAO AUTODMA1 DBGE DC4 DC5 DC6 DC7 DC8 DCI DC10 DC11 DC12 DC13 DCDO DCD1 DCD2 DCD3 DCNT DCNTCL DCNTST DCSO DCS1 DCS2 DCS3 DSTAT DSTATC LATH LATL MASKH MASKL IVBUSLK VDBG VHW VDMAO VDMA1 IVDMA2 VDMA3 VDMA4 VDMA5 VDMA6 IVDMA7 VDMA8 VDMA9 VDMA10 VDMA11 IVDMA12 VDMA13 VIRQO VIRQ1 VIRQ2 IVIRQ3 VLINKO VLINK1 VLINK2 VLINK3 IVSW VT IMEROHP VTIMEROLP VTIMERLHP VTIMERLLP LBUFRXO LBUFRX1 LBUFRX2 LBUFRX3 LBUFTXO LBUFTX1 LBUFTX2 LBUFTX3 LCO LC LCTLO ECTE LCTL2 LCTL3 LSTATO LSTAT1I LSTAT2 LSTAT3 LSTATCO LSTATC1 LSTATC2 LSTATC3 RETI RETIB RETS RT PMASKL PMASKH SFREG SQCTL SQCTLST SQCTLCL SQSTAT TIMEROL TIMERIL TIMEROH TIMERIH TMRINOL TMRINOH TMRINIL TMRINIH VIRPT VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 29 Assembler Syntax Reference
16. GN CODE l no alignment requirement SECTION program ALIGN_CODE 8 Stil LN1 J8 j31 0x40 aligned code section on the word boundary at the location with an address boundary that is divisible by 8 2 44 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs ALIGN_CODE 32 J8 j31 0x4000 r3 100 ALIGN_CODE 16 r3 100 ALIGN_CODE 8 cjmp ABS J8 j31 0x40 J8 j31 0x40 r3 100 Assembler aligned code section on the word boundary at the location with an address boundary that is divisible by 32 aligned code section on the word boundary at the location with an address boundary that is divisible by 16 aligned code section on the word boundary at the location with an address boundary that is divisible by 8 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 45 Assembler Syntax Reference EXTERN Refer to a Globally Available Symbol The ExTERN directive allows a code module to reference global data struc tures symbols etc that are declared as GLOBAL in other files For information on the eLoBaL directive see page 2 48 The EXTERN directive uses the following syntax EXTERN symbol NamelL symbolName2 where e symbolName isthenameof asymbol defined as global in another file A single ExTERN directive can reference any number of separated by commas symbols on one
17. H ARC DSPs Assembler Setting Assembler Options W hen developing aD SP project you may find it useful to modify the assembler s default options settings T he way you set the assembler s options depends on the environment used to run the D SP development software e From the operating system command line you use the assembler s command line switches For more information on these switches see the Assembler Command Line Interface on page 2 17 e Within the VisualD SP environment you set the assembler s options in the VisualD SP Integrated D evelopment and D ebug ging Environment ID DE For more information on these option settings see the VisualD SP 2 0 U se s Guide for TigaSH ARC DSPs VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 15 Assembler Command Line Reference Assembler Command Line Reference The TigerSH ARC DSP assembler processes data from assembly source ASM data DAT header and preprocessed 1S files to generate object files in Executable and Linkable Format ELF an industry stan dard format for binary object files The assembler s primary output file has a D0J extension T he assembler s secondary outputs are optional listing files and information in binary D ebugging Information Format DW ARF 2 embedded in the object file By linking together separately assembled object files the linker produces executable programs DxE You can arc
18. IDT H 32 H 32 H 32 H 32 H 32 H 32 2 10 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler SDRAM TYPECRAM START 0x04000000 END OxO7FFFFFF WIDTH 32 MSO TYPECRAM START 0x08000000 END OXOBFFFFFF WIDTH 32 MS1 TYPECRAM START Ox0CO00000 END OXOFFFFFFF WIDTH 32 HOST TYPECRAM START O0x10000000 END OXFFFFFFFF WIDTH 32 PROCESSOR pO OUTPUT COMMAND_LINE_OUTPUT_FILE SECTIONS code FILL Oxb3c00000 INPUT_SECTION_ALIGN 4 INPUT_SECTIONS O0BJECTS program gt MOCode datal INPUT_SECTIONS 0OBJECTS datal gt M1Data data2 INPUT_SECTIONS OBJECTS data2 gt M2Data Provide support for initialization including C static initialization This section builds a table of initialization function pointers These functions are called in order before the main routine is entered The order is determined by the linker section in which the function pointer has been defined the C library uses ctorO through ctor3 and the compiler uses ctor for C static initializers The C library uses several sections to satisfy ordering requirements among initializers ctor INPUT_SECTIONS OBJECTS ctord INPUT_SECTIONS OBJECTS ctor1 INPUT_SECTIONS OBJECTS ctor2 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs2 11 Asse
19. ION applies only to floating point data Precision of fixed point data is determined by the number of digits speci fied 2 58 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler PREVIO US Revert to the Previously Defined Section The pRevious directive instructs the assembler to set the current section in processor s memory to the section that has been described directly before the current one T his directive uses the following syntax PREVIOUS Example SECTION sec_one data amp instructions SECTION sec_two data PREVIOUS data amp instructions directs the assembler to revert back to sec_one and has the same effect as SECTION sec_one data amp instructions SECTION sec_two data SECTION sec_one data amp instructions VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 59 Assembler Syntax Reference ROUND Select Floating Point Rounding The ROUND_ directive controls how the assembler interprets literal float ing point numeric data after precisron is defined The PRECISION directive determines the number of bits to be truncated to match the number of significant bits The ROUND_ directive determines how the assembler handles float ing point values in constant declarations and variable initializations You configure floating point rounding modes of the D SP system by
20. SP H ardware Reference M anual Numeric Formats T he assembler supports binary decimal and hexadecimal numeric for mats bases within expressions and assembly instructions Table 2 6 describes the conventions of notation the assembler uses to dis tinguish between numeric formats Table 2 6 Numeric Formats Convention Description Oxnumber A 0x prefix indicates a hexadecimal number Bitnumber A Bi or bit prefix indicates a binary number b number number No prefix indicates a decimal number numberr An r suffix indicates a fractional number N ote that if any operand in an expression is a floating point value the assembler stores the value of the expression in floating point format Fractional Type Support Fractional fract constants are specially marked floating point constants to be represented in fixed point A fract constant uses the floating point representation with a trailing r where r stands for fract The legal VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 35 Assembler Syntax Reference rangeis 1 0 1 0 Fracts are represented as signed values which means the values must be greater than or equal 1 and less than 1 Example VAR myFracts 4 0 5r 0 5e 4r 0 25e 3r 0 875r constants are examples of legal fracts VAR OutOfRangeFract 1 5r Error E37 Fract constant 1 5r is out of range Fract
21. bler Input amp Output Files VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs2 5 Assembler Guide Program Content Statements within an assembly source file are comprised of assembly instructions assembler directives and preprocessor commands Instruc tions assemble to executable code while directives and commands modify the assembly process T he syntax of these statement types are as follows e Assembly instructions Instructions follow the D SP s instruction set syntax documented in the D SP s user manuals Each instruction begins with a keyword and ends it with a semicolon You may put up to four instruc tions on aline instructions on the same line must be delimited by a single semicolon Multiple instruction lines end with a double semicolon For program reference purposes such aS a CALL you can place an address label at the beginning of an instruction line or on the pre ceding line End the label with a colon before beginning the instruction You can then refer to this memory location in your pro gram using the label instead of an absolute address Although there isno length restriction when defining labels it isconvenient to limit them to the length of a screen line typically eighty characters Labels are sensitive to case So the assembler treats outer and Outer as unique labels Example outer r0 r1 r2 start if naeq jump error 2 6 VisualD SP
22. cks the LEFTMARGIN and PAGEWIDTH values against one another If the specified values do not allow enough room for a properly formatted listing page the assembler will issue a warning and adjust the directive that was specified last to allow along enough line Example PAGEWIDTH 36 starts a new line after 36 characters are printed on one line You can set the page width only once per source file If the assembler encounters multiple occurrences of the PAGEWIDTH directive it ignores all of them except the last VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 57 Assembler Syntax Reference PRECISION Select Hoating Point Precision The PRECISION directive controls how the assembler interprets float ing point numeric values in constant declarations and variable initializations N ote that you configure the floating point precision of the target D SP system by setting up control registers with instructions that specific to the processor core U se one of the following options PRECISION 32 PRECISION 40 where e Theprecision of 32 or 40 specifies the number of significant bits for floating point data The equal sign following the PRECISION keyword is optional Example PRECISION 32 Selects standard IEEE 32 bit Single precision format this is the default setting PRECISION 40 Selects standard IEEE 40 bit format with extended mantissa PRECIS
23. constants must be greater than or equal to 1 and less than 1 AY 1 15 Fracts TigerSH ARC supported fracts use 1 15 format meaning a sign bit and 15 bits of fraction This is 1 to 1 2 15 For example 1 15 maps the constant 0 5r to 2 14 T he conversion formula used for TigerSH ARC DSP to convert from the floating point to fixed point uses a scale factor of 15 fractValue short doubleValue 1 lt lt 15 Example VAR myFract 5r Fract output for 0 5r is 0x4000 sign bit 15 bits 0100 0000 0000 0000 4 0 0 0 0x4000 5r VAR myFract 1 0r Fract output for 1 0r is 0x8000 sign bit 15 bits 1000 0000 0000 0000 ie 8 0 0 0 0x8000 1 0r 1 0r Special Case 1 0r is out of the range fract Specify ox7FFF for the closest approximation of 1 0r within the 1 15 representation 2 36 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler Fractional Arithmetic T he assembler supports arithmetic operations on fractional constants As implemented constant fract expressions are consistent with what is pro vided for other numeric types in the assembler D oing fract constant arithmetic is sometimes necessary when one receives constants and wants to derive others from them T he internal intermediate representation for expression evaluation isa double floating point value Fract range checking is deferred until the expression is evaluated
24. ddress expressions Table 2 5 Special Assembler O perators O perator Usage D escription ADDRESS symbol Least significant 16 address bits of symbol symbol LENGTH symbol Address pointer to symbol Length of symbo 1 in words T he address of and length of operators can be used with external sym bols apply these special operators to symbols that are defined in other sections aS GLOBAL symbols T he following example demonstrates how the assembler operators are used to load JL3 length and J3 index registers when setting up circular buffers SECTION datal VAR real_data n SECTION program data segment n number of input samples code segment Load the base address of the circular buffer JB3 real_data Load the index J3 real_data Load the circular buffer length JL3 LENGTH real_data Set loop counter 0 with buffer length LCO JL3 start XRO CB J3 1 read data from circular buffer if NLCOE jump start 2 34 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs Assembler This code fragment initializes B3 and JL3 to the base address and length respectively of the circular buffer real_data The buffer length value contained in JL3 determines when addressing wraps around the top of the buffer For further information on circular buffers refer to your D
25. define some_val 0 875r SECTION datal VAR localOne some_val 0 005r Result 88r is within the legal range VAR xyz 1 5r 9r Result 6r is within the legal range VAR abc 1 5r Error 1 5r out of range Mixed Type Arithmetic T he assembler implementation currently supports arithmetic between fracts but not fracts and integers VAR myFract 1 0 5r Error E8 Assembler Error Illegal mixing of types in expression VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 37 Assembler Syntax Reference Comment Conventions T he assembler supports C and C style formats for inserting comments into assembly sources N ote that the assembler does not allow nested comments T able 2 7 lists and describes the easmts Comment conventions Table 2 7 Comment Conventions Convention Description comment A string encloses a multiple line comment comment A pair of slashes begin asingle line comment Assembler Directives Directives in an assembly source file control the assembly process Unlike instructions directives do not produce opcodes during assembly U se the following general syntax for the assembler directives directive qualifiers arguments Each assembler directive starts with a period and ends with a semico lon Some directives take qualifiers and arguments A directive s qualifier immediately f
26. e assembler generates relocatable sections for the linker to fill in the addresses of symbols at link time The TigerSH ARC assembler implicitly pre fix the name of the section with the rela string to form a relocatable section For example for the sections named rela seg_data and rela seg_code the relocation section are rela rela seg_data and rela rela seg_code respectively To avoid such an ambiguity ensure that your sections names do not begin with rela e The sectionType isan optional ELF symbol typestt_ Valid sec tionTypes are described in the ELF h header file which is available from the third parties 2 62 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler Example Declared below data and program sections correspond to the default LDF s input sections SECTION datal memory section to store data SECTION program memory section to store code VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 63 Assembler Syntax Reference SIZE Calculate the Size of a Function The size directive directs the assembler to mark the boundaries of a function thus allowing for size calculation The s1ze directive may appear in the compiler generated assembly source code as the statement following the last instruction of a function T his directive uses the following syntax SIZE functionSymbol functionLabel where e fu
27. e uses a single memory location and a data buffer uses an array of memory locations W hen declaring or initializing variables be aware of the following e A vAR directive is valid only if it appears within a section The assembler associates the variable with the memory type of the sec tion in which the vAr appears e A single vAr directive can declare any number of variables or buff ers separated by commas on oneline e Referring to variables and buffers in code before declaring them leads to syntax errors e Thenumber of initial values may not exceed the number of variables or buffer locations that you declare e The var directive may declare an implicit size buffer The number of initialization elements defines the 7ength of the implicit size buffer 2 66 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler The var directive takes one of the following forms VAR VAR VAR VAR VAR VAR VAR where varNamell varName2 varNamel initExpressionl varName2 jinitExpression bufferNamel initExpressionl initExpression bufferNamel fileName bufferNameL length fileName bufferNamell length Ll bufferName2 length bufferNamel length initExpressionl initExpression T heuser defined varName and bufferName symbolsidentify variables and buffers The fileName parameter indicates that the elements of a buffer get their
28. eprocessed assembly file using the name of the source program and attaching an 1s extension to it When assembling with the pp switch the 1s file is the final result of the assembly sp The sp skip preprocessing switch directs the assembler to assemble the source file into an object file without running the preprocessor W hen the assembly skips preprocessing entirely the sp switch no preprocessed assembly file 1S is created v erbose The v or verbose verbose switch directs the assembler to display both version and command line information for each phase of assembly version The version display version switch directs the assembler to display ver sion information for the assembler and preprocessor programs W The w disable all warnings switch directs the assembler not to display warning messages generated during the assembly 2 26 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler Assembler Syntax Reference W hen you develop a source program in assembly language you include preprocessor commands and assembler directives to control the program s processing and assembly You must follow the assembler rules and conven tions of syntax to define symbols identifiers expressions and use different numeric and comment formats Software developers who write assembly programs should be familiar with the following topics e Assembler Keywords amp Symbo
29. er cycle Quad word accesses may be used to supply four aligned words to one compute block or two aligned words to each compute block T he assem bler does not quad align code or data sections automatically To align a section you have to use the ALrGn directive for assembly programs The INPUT_SECTION_ALIGN Operator uses the following syntax INPUT_SECTION_ALIGN address_boundary_expession INPUT_SECTIONS filename input section name address_boundary_expession aligns the input section to the next word boundary T he expression must be a power of 2 Legal values for this expression depend on the word size of the segment that receive the output section being aligned T he following example shows how to align input sections using the Linker Description File SECTIONS code INPUT_SECTION_ALIGN 4 INPUT_SECTIONS a doj program PUT_SECTIONS b doj program INPUT_SECTIONS c doj program INPUT_SECTION_ALIGN 1 end of alignment directive for input sections 2 42 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler The following sections will not be aligned INPUT_SECTIONS d doj program INPUT_SECTIONS e doj program gt M2Code H ere the input sections specified after INPUT_SECTION_ALIGN 4 but before the INPUT_SECTION_ALIGN 1 instructions are aligned H owever the input sections from d doj and e doj are not a
30. h set Switches control certain aspects of the assembly process including library searching listing and preprocessing Because the assembler automatically runs the preprocessor as your program is assembled unless you use the sp switch the assembler s command line can receive input for the preproces sor program and direct its operation For more information on the preprocessor see Preprocessor on page 3 1 Torun the assembler from the command line type the name of the assem bler program followed by arguments in any order easmts switchl switch2 sourceFile where e easmts Nameof theTigerSH ARC assembler program e switchl switch2 Switches to process T he assembler offers many optional switches that select operations and modes for the assembler and preprocessor Some assembler switches take a file name as a required parameter VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 17 Assembler Command Line Reference sourcefile N ame of the source file to assemble T he assembler outputs a error message when run without argu ments T he assembler supports relative and absolute path names W hen you spec ify an input or output file name as a parameter use the following guidelines for naming files e Includethedriveletter and path string if thefileisnot in thecurrent directory e Enclose long file names in double quotation marks for example long file name
31. he LIST_DEFTAB and LIST_LOCTAB directives The default tab width is inherited by nested source files but the local tab width only affects the current source file The LIST_DEFTAB directive uses the following syntax LIST_DEFTAB expression where e expression evaluates to an integer greater than or equal to 0 A value of 0 sets the default tab width to the default tab width In the absence of a LIST_DEFTAB directive the default tab width defaults to 4 Example Tabs here are expanded to the default of 4 columns LIST_DEFTAB 8 Tabs here are expanded to 8 columns LIST_LOCTAB 2 Tabs here are expanded to 2 columns But tabs in include_1 h will be expanded to 8 columns include include_1 h LIST_DEFTAB 4 Tabs here are still expanded to 2 columns But tabs in include_2 h will be expanded to 4 columns d include include_2 h 2 52 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs Assembler LIST LOC TAB Set the Local Tab Width for Listings T ab characters in source files are expanded to blanks in listing files under the control of two internal assembler parameters that set the tab expansion width T he default tab width is normally in control but it can be overrid den if the local tab width is explicitly set with a directive The LIST_LOcTAB directive sets the local tab width and the LIST_DEFTAB directive sets the default tab width
32. hive the output of an assembly process into a library file DLB which can then be linked with other objects into an executable Because the archive process performs a partial link placing frequently used objects in a library reduces the time required for subsequent links For more information on the archiver see the VisualD SP 2 0 Linke amp Utilities M anual for TigerSH ARC DSPs T his section provides reference information on the assembler s switches directives expressions and conventions T he reference information avail able on these topics is as follows e Assembler Command Line Interface on page 2 17 T his section describes the assembler s switches which are accessible from the operating system s command line or from the VisualD SP environment e Assembler Keywords amp Symbols on page 2 27 T his section describes the assembler s predefined keywords and pro vides rules for user defined symbols 2 16 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler e Assembler Expressions on page 2 31 T his section describes the assembler s numeric and relational oper ators and other conventions of syntax e Assembler Directives on page 2 38 T his section describes the assembler s directives including syntax and usage examples Assembler Command Line Interface This section describes the easmts assembler command line interface and option switc
33. how the values are stored in memory when it reads the data files VAR and ASCII String Initialization Support T he assembler supports ASCII string initialization T his allows the full use of the ASCII character set including digits and special characters String initialization takes one of the following forms VAR symbolStringLlength initString 0 VAR symbolStringL initString 0 N ote that the number of initialization characters defines 7ength of a string implicit size initialization 2 68 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler Example var xL13 Hello world 0 var x Hello world 0 T he assembler also accepts ASCII characters within comments VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 69 Assembler Glossary Assembler Glossary Assembler directives tell the assembler how to process your source code and set up some DSP features Directives let you structure your pro gram into a logical section s that mirror the memory layout of your target D SP system Instruction set is the set of assembly instructions that work on a spe cific D SP family The easmts assembler supports the AD SP T Sxxx D SP instruction set Linker Description File controls how the linker processes the assem bler s output object files into executable programs For more information see the VisualD SP
34. ile must describe how code and data are mapped into the memory on your target DSP The TigerSH ARC architecture has uni fied memory map in which the partition between program memory and data memory is user determined T he way you structure your code and datainto memory should agree with the corresponding Linker D escription File required for every D SP project In the assembly language source the mapping of code and data is accom plished using the SECTION directive The section directive defines groupings of instructions and data that are set as contiguous memory addresses in the DSP Each secTION name corresponds to an input sec tion name in the Linker Description File LDF Some suggested section names that you could use in your assembly source appear in Table 2 1 U sing these predefined names in your sources makes it easier to take advantage of the default Linker Description File included in your D SP system For more information on the LDF seethe Linke amp Utilities M an ual for T igerSH ARC Family DSPs Table 2 1 Suggested Input Section N ames SECTION Name Description datal A section that holds data in M emory Block M 1 data2 A section that holds data in M emory Block M 2 program A section that holds code in Memory Block M 0 You can create sections in a program by grouping elements to meet hard ware constraints To group code that reside in off chip memory declare a section for that code and
35. ing and adjust the directive that was specified last to allow along enough line The LEFTMARGIN directive uses the following syntax LEFTMARGIN expression where expression evaluates to an integer from 0 to 100 To changethe default setting for the entire listing placethe LEFTMARGIN directive at the beginning of your assembly source file Example LEFTMARGIN 9 the listing line begins at column 10 You can set the margin width only once per source file If the assembler encounters multiple occurrences of the LEFTMARGIN directive it ignores all of them except the last VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 49 Assembler Syntax Reference UST NO LST Listing Source Lines and Opcodes The LIST NOLIST directives on by default turn the listing of source lines and opcodes on and off If NOLIST isin effect no linesin the current source or any nested source will be listed until a L1sT directive is encountered in the same source at the same nesting level The noList directive operates on the next source line so that the line containing NoLIstT will appear in the listing and thus account for the missing lines The LIST NOLIST directives use the following syntax JUIST NOLIST T hese directives can appear multiple times anywhere in a source file and their effect depends on their location in the source file 2 50 VisualD SP 2 0 Assembler amp Prep
36. l for TigaSH ARC Family D SPs which also includes a series of examples to demonstrate how to mix C C and assembly code Preprocessing a Program T he assembler includes a preprocessor that allows you to use C style pre processor commands in your assembly source files T he preprocessor automatically runs before the assembler unless you use the assembler s sp skip preprocessor switch T able 3 3 on page 3 16 lists preprocessor com mands and provides a brief description of each command Preprocessor commands are useful for modifying assembly code For example you can use the include command to fill memory load config uration registers and set up DSP parameters You can use the define command to define constants and aliases for frequently used instruction sequences T he preprocessor replaces each occurrence of the macro refer ence with a corresponding value or series of instructions For example the macro max in the example on page 2 7 is replaced with the number 100 during preprocessing N ote that the preprocessor also automatically removes dl comments from assembler generated optional listing files For more information on the preprocessor command set see Preproces sor Commands on page 3 16 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 13 Assembler Guide Reading a Listing File A listing file is an optional output text file that lists the results of the assembly process Y
37. ligned asthe INPUT_SECTION_ALIGN 1 instruction indicates the end of the alignment directive T he INPUT_SECTION_ALIGN Operator is valid only within the scope of an output section the Linker Description File T his command gives you the flexibility to align the input sections as needed VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs 2 43 Assembler Syntax Reference ALIGN_CO The ALIG DE Specify an Address Alignment directive forces the address alignment of an instruction or data item within the secTron it is used It is similar to the ALIGN direc tive but w hereas ALIGN causes the code to be padded with 0 s ALIGN_CODE pads with nop s The ALIGN_CODE directive is used when aligning in The ALIG structions _CODE directive uses the following syntax ALIGN_CODE expression where exp ression evaluates to an integer The expression specifies the byte alignment requirement its value must be a power of 2 When alig ning adataitem or instruction the assembler adjusts the address of the current location counter to the next address so it can be evenly divi ded by the value of expression or aligned T he expression set to 0 or 1 signifies no address alignment requirement In the absence of the ALIGN_CODE or ALIGN directive the default address alignment is set to 1 Example ALIGN_CODE 0 no alignment requirement ALI
38. ls on page 2 27 e Assembler Expressions on page 2 31 e Assembler Operators on page 2 32 e Numeric Formats on page 2 35 e Comment Conventions on page 2 38 e Assembler Directives on page 2 38 Assembler Keywords amp Symbols T he assembler supports a set of predefined keywords that includes register and bitfield names assembly instructions and assembler directives Listing 2 2 lists the assembler keywords Although the keywords in this listing appear in uppercase the keywords are case insensitive in the assem bler s syntax For example the assembler does not differentiate between if and IF VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 27 Assembler Syntax Reference Listing 2 2 AD SP T Sxxx Assembler K eywords Predefined Macros ADE DATE FILE LINE STDC __ TIME__ Keywords ABS ACS ALIGN AND ASHIFT ASHIFTR BCLR BFOINC BFOTMP BITEST BITFIFO BKFPT BR BSET BIBINV BTGL BY CALL C CB CUMP CUMP_CALL CLIP CODE_ALIGN COMP COMPACT COPYSIGN DAB DEC DESPREAD DO ELSE EMUTRAP EXP EXPAND EXTD EXTERN FCOMP FEXT FDEP FILE FIX FLOAT FTESTO FTEST1 GLOBAL GETBITS IDLE IF INC JC JUMP C LDO LD1 LEFTMARGIN LOGB LP LSHIFT LSHIFTR ANT AS AXMERGE IN EWPAGE OT OP P ONES OR PAGELENGTH PAGEWIDTH PASS PERMUTE PRECISION PREVIOUS PUTBITS RESET RDS ROT ROTL ROTR ROUND RECIPS RSQRTS SCALB SD
39. mbler Guide INPUT_SECTIONS OBJECTS ctor3 INPUT_SECTIONS O0BJECTS ctor gt M1Data Table containing heap segment descriptors heaptab INPUT_SECTIONS OBJECTS heaptab gt M1Data Allocate stacks for the application Note that stacks grow downward and must be quad word aligned This means that the location just after the highest word of the stack is quad word aligned evenly divisible by 4 There are two labels for each stack _base is the location just ABOVE the top of the stack and _limit is the lowest word that is part of the stack Each stack occupies all of its own memory block jstackseg ldf_jstack_limit ldf_jstack_base MEMORY_SIZEOF M1Stack gt M1IStack kstackseg ldf_kstack_limit ldf_kstack_base MEMORY_SIZEOF M2Stack gt M2Stack The default heap occupies its own memory block defheapseg ldf_defheap_base ldf_defheap_size MEMORY_SIZEOF M1lHeap gt M1lHeap 2 12 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs Assembler Program Interfacing Requirements At some point you may want to interface your assembly program with aC or C program For information on a particular compiler s run time environment see the compiler s user manual T he definition of the run time environment for the TigerSH ARC C C compiler is provided in the C C Compile amp Library M anua
40. n the opcode column N ested source files inherit the current setting of this directive pair but a change to the setting madein a nested source file will not affect the parent source file The LIST_WRAPDATA NOLIST_WRAPDATA directives use the following syntax LIST_WRAPDATA NOLIST_WRAPDATA T hese directives can appear multiple times anywhere in a source file and their effect depends on their location in the source file 2 54 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler NEWPAGE Insert a Page Break in a Listing File The NEWPAGE directive inserts a page break in the printed listing file which the assembler produces when you use the 1 switch T he assembler inserts a page break at the location of the newpace directive The NEWPAGE directive uses the following syntax NEWPAGE T his directive may appear anywhere in your source file In the absence of the NEWPAGE directive a page is ejected after listing 66 lines VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs2 55 Assembler Syntax Reference PAGELENGTH Set the Page Length of a Listing File The PAGELENGTH directive controls the page length of the listing file which the assembler produces when you use the 1 switch The PAGELENGTH directive uses the following syntax PAGELENGTH expression where e expression evaluates to an integer from 0 to 66 Default is 0 It specifies
41. ncies and assembles Mo filename Specifies 7 7 ename for the make dependencies output file Mt filename M akes dependencies for the specified source file 0 filename Outputs named object file PP Runs preprocessor only 2 20 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler Table 2 3 easmts Command Line Switches Cont d Switch Name Usage D escription Sp Assembles without preprocessing v erbose Displays information on each assembly phase version D isplays version information for assembler and pre processor programs W Removes all assembler generated warnings A brief description of each option includes information about case sensi tivity equivalent switches switches overridden contradicted by the one described and naming and spacing constraints on parameters T S001 The ts001 AD SP T S001 code switch directs the assembler to process instructions unique to AD SP T S001 processors T S101 The rs101 AD SP T S101 code switch directs the assembler to process instructions unique to AD SP T S101 processors D dmacro def The D or a define macro switch directs the assembler to define a macro If you omit the optional definition string aef the assembler defines the macro as value 1 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs2 21 Assembler Comma
42. nctionSymbol isthe function identifier e functionLabel is the assembler generated label N ote that func tionLabel s preceding character is allowed in this syntax only T he assembler creates two relocations for each size directive for the beginning and closing labels T he linker resolves the s1ze directive at link time this provides correct size calculations of assembly functions that may change their size at link time Example start NOP NOP NOP SIZE start start 2 64 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler TYPE Change Default Symbol Type The type directive enables the compiler to change the default symbol type of an object T his directive may appear in the compiler generated assembly source file s T his directive uses the following syntax TYPE symbolName symbolType where e symbolName isthe name of the object which symbol type the com piler has changed e symbolType Sthe ELF symbol type stt_ The valid ELF symbol types are listed in the ELF h header file By default a label in a code section has the stt_Func symbol type and a label in a data section has the sTT_oBJECT symbol type VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs 2 65 Assembler Syntax Reference VAR Declare a Data Vanable or Buffer The var directive declares and optionally initializes variables and data buffers A variabl
43. nd Line Reference Some examples of this switch are as follows Dinput Dsamples 10 Dpoint Start defines input as 1 defines samples as 10 defines point as the string Start note single quotes for the string as the assembler preferred style T he g generate debug information switch directs the assembler to gen erate line number and symbol information in DW ARF 2 binary format allowing you to debug the assembly source files h elp The n or he1p switch directs the assembler to output to standard out a list of command line switches with a syntax summary I i directory The i directory Or 1 directory include directory switch directs the assembler to append the specified directory or a list of directories sepa rated by semicolons to the search path for included files T hese files are header files h included with the include command e data initialization files dat specified with the vAr directive 2 22 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler T he assembler passes this information to the preprocessor the preproces sor searches for included files in the following order current project dpj directory e TS include subdirectory of the VisualD SP installation direc tory e specified directory alist of directories The order of thelist defines the order of multiple searches Current directory i
44. ollows the directive and is separated by a slash arguments follow qualifiers Comments may follow the directive s termi nating semicolon Assembler directives can be uppercase or lowercase 2 38 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler T he AD SP T Sxxx assembler supports directives shown in T able 2 8 A description of each directive appears in the following sections Table 2 8 Assembler Directives Directive Description ALIGN see page 2 41 Specifies a word alignment requirement for data FILE ALIGN_CODE see page 2 44 EXTERN see page 2 46 Allows reference a global symbol see page 2 47 Specifies a word alignment requirement for code Overrides filename given on the command line Used by C C compiler GLOBAL see page 2 47 LEFTMARGIN see page 2 49 D efines the width of the left margin of a listing Changes a symbol s scope from local to global r NN 4 see page 2 50 Starts listing of source lines r NN T_DATFILE see page 2 51 Starts listing of data initialization files LIST_DEFTAB see page 2 52 Sets the default tab width for listings LIST_LOCTAB see page 2 53 Sets the local tab width for listings r iS T_WRAPDATA see page 2 54 Starts wrapping opcodes that don t fit listing col umn EWPAGE see page 2 55 Inserts a
45. ols 2 30 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler Address label symbols may appear at the beginning of an instruction line or stand alone on the preceding line T he following disassociated lines of code demonstrate some symbol usage VAR xoperand xoperand is a data variable VAR input_array 10 input_array is a data buffer sub_routine_l sub _routine_l is a label SECTION kernel kernel is a user defined section corresponds to the LDF input section Assembler Expressions T he assembler can evaluate simple expressions in source code T he assem bler supports two types of expressions e Constant expressions A constant expression is acceptable wherever a numeric value is expected in an assembly instruction or in a preprocessor command Constant expressions contain an arithmetic or logical operation on two or more numeric constants 2 9e 5 1 29 128 48 3 0x55 amp 0x0f l 6r 8r For information about fraction type support refer to N umeric For mats on page 2 35 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 31 Assembler Syntax Reference e Address expressions Address expressions contain a symbol or and integer constant data data_buffer 15 strtup 2 Symbols in this type of expression are data variables data buffers and program labels Adding or subtracting an integer from
46. ou should always specify the full name of the listing file Listing files provide the following information Address Thefirst column contains the offset from the secTIon s base address e Opcode The second column contains the hexadecimal opcode that the assembler generates for the line of assembly source e Line Thethird column contains the line number in the assembly source file e Assembly Source The fourth column contains the assembly source line from the file Assembler listings are based on the original source files not the prepro cessed source file Each line of the original source files including comments will appear in the assembly source column of the listing file T here are listing directives to control which source files and source file lines will be included in the listing see Assembler D irectives on page 2 38 For included files the source line numbers have two parts separated by a The first part indicates the include nesting level while the second part is the line number For example the line number 2 15 indicates line 15 in an include file nested two levels deep Line numbers for the top level source file do not indicate the nesting level When the listing enters or leaves a nested source file the listing will contain an extra line which gives the name of the source file that is being entered or returned to 2 14 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerS
47. pression where e expression evaluates to an integer The expression specifies the word alignment requirement its value must be a power of 2 When aligning adataitem or instruction the assembler adjusts the address of the current location counter to the next address so it can be evenly divided by the value of expression or aligned T he expression set to 0 or 1 signifies no address alignment requirement In the absence of the ALran directive the default address align ment is set to 1 i e single word alignment Example ALIGN 1 no alignment requirement SECTION datal ALIGN 2 VAR single aligns the data item on the word boundary at the location with the address value that can be evenly divided by 2 ALIGN 4 VAR samples1 100 datal dat aligns the first data item on the double word boundary at the location with the address value that can be evenly divided by 4 advances other data items consequently VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 41 Assembler Syntax Reference INPUT SECTION ALIGN Specify an Input Section Alignment in LD F The INPUT_SECTION_ALIGN 4 number instruction is used by the linker in the Linker Description File to align the input sections instructions or data specified within an output section The TigerSH ARC processors can execute up to four instructions per cycle from asingle memory block due to the 128 bit wide access p
48. rce file a header file included with the include preprocessor command or a data file When the o filename option is used with the assembler outputs the make dependencies list to the named file MM The mm generate make rule and assemble assembler switch directs the preprocessor to output arule which is suitable for the make utility describing the dependencies of the source file After preprocessing the assembly of the source into an object file proceeds normally T he output an assembly make dependencies list is written to stdout in the standard command line format source_file doj dependency_file ext where dependency_file ext May bean assembly source file a header file included with the include preprocessor command or a data file For example the source vectAdd asm includes the MakeDepend h and inits dat files When assembling with easmts MM vectAdd asm the assembler appends the pou extension to the source file name for the list of dependencies vectAdd doj MakeDepend h vectAdd doj inits dat When the o filename option is used with mm the assembler outputs the make dependencies list to stdout 2 24 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler Mo filename The mo output make rule assembler switch specifies the name of the make dependencies file which the assembler generates when you use the M or mM Switch If the named file is not in the c
49. rocessor M anual for TigerSH ARC DSPs Assembler UIST_DATFILE NOLIST DATFILE Listing Data Initialization Files The LIST_DATFILE NOLIST_DATFILE directives off by default turn the listing of data initialization files on or off N ested source files inherit the current setting of this directive pair but a change to the setting madeina nested source file will not affect the parent source file The LIST_DATFILE NOLIST_DATFILE directives use the following syntax LIST_DATFILE NOLIST_DATFILE T hese directives can appear multiple times anywhere in a source file and their effect depends on their location in the source file T hey are used in assembly source files and not in data initialization files VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 51 Assembler Syntax Reference LIST_ DEFTAB Set the Default Tab Width for Listings T ab characters in source files are expanded to blanks in listing files under the control two internal assembler parameters that set the tab expansion width T he default tab width is normally in control but it can be overrid den if the local tab width is explicitly set with a directive The LIST_DEFTAB directive sets the default tab width and the LIST_LOCTAB directive sets the local tab width see LIST_LO CTAB Set the Local T ab Width for Listings on page 2 53 Both the default tab width and the local tab width can be changed any number of times viat
50. s your dpj project directory not the directory of the assembler program U sage of full pathnames for the 1 switch on the command line omitting the disk par tition is recommended For example easmts I bin inlclude bufferl dat filename The 1 listing switch directs the assembler to generate the named listing file Each listing file shows the relationship between your source code and instruction opcodes that the assembler produces If you omit the fi7e name the assembler outputs an error message For moreinformation about listing files see Reading a Listing File on page 2 14 li filename The 1i listing switch directs the assembler to generate the named list ing file with include files used in the source printed in the listing file For more information about listing files see Reading a Listing File on page 2 14 M The m generate make rule only assembler switch directs the preproces sor to output a rule which is suitable for the make utility describing the dependencies of the source file After preprocessing the assembler stops VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 23 Assembler Command Line Reference without assembling the source into an object file The output an assembly make dependencies list is written to stdout in the standard com mand line format source_file dependency_file ext where dependency_file ext May bean assembly sou
51. setting up control registers with the instructions specific to the target processor T he ROUND_ directive uses the following syntax ROUND_mode where e Themode string specifies the rounding scheme used to fit a value in the destination format Use one of the following IEEE standard modes ROUND_NEAREST ROUND_PLUS ROUND_MINUS ROUND_ZERO In the following examples the numbers with four decimal places are reduced to three decimal places and are rounded accordingly the rounding mode ROUND_NEAREST Selects Round to Nearest scheme this is the default setting A 5 is added to the digit that follows the third decimal digit the least significant bit LSB The result is truncated after the third decimal digit LSB 1 2581 rounds to 1 258 8 5996 rounds to 8 600 2 60 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler 5 3298 rounds to 5 329 6 4974 rounds to 6 496 ROUND_ZERO Selects Round to Zero The closer to zero value is taken The number is truncated after the third decimal digit LSB 1 2581 rounds to 1 258 8 5996 rounds to 8 599 5 3298 rounds to 5 329 6 4974 rounds to 6 497 ROUND_PLUS Selects Round to Positive Infinity The number rounds to the next larger For positive numbers a 1 is added to the third decimal digit the least significant bit Then the result is truncated after the LSB For negative numbers the manti
52. ssa is truncated after the third decimal digit LSB 2581 rounds to 1 259 8 5996 rounds to 8 600 5 3298 rounds to 5 329 6 4974 rounds to 6 497 ROUND_MINUS Selects Round to Negative Infinity The value rounds to the next smaller For negative numbers a 1 is subtracted from the third decimal digit the least significant bit Then the result is truncated after the LSB For positive numbers the mantissa is truncated after the third decimal digit LSB 1 2581 rounds to 1 258 8 5996 rounds to 8 599 5 3298 rounds to 5 330 6 4974 rounds to 6 498 VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 61 Assembler Syntax Reference SECTION Declare a Memory Section The sectron directive marks the beginning of a logical section mirroring an array of contiguous locations in unified memory of TigerSH ARC sys tem Statements between section and the following section directive or the end of file comprise the contents of the section T his directive uses the following syntax SECTION sectionName sectionType where e Thesection namesymbol sectionName isnot limited in length and is case sensitive Section names must match the corresponding input section names used by the Linker D escription Fileto placethe section You can use the default LD F included in the Ts 1af sub directory of the VisualD SP installation directory or you can write your own LDF T h
53. stages to producea binary object file 000 and an optional listing file O bject files serve as input to the linker when you link your executable pro gram T hese files are in Executable and Linkable Format ELF an industry standard format for object files In addition the assembler can VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC D SPs 2 3 Assembler Guide embed binary information in D ebugging Information Format DWARF 2 for source level debugging Listing files are text files that you can read for information on the results of the assembly process Figure 2 1 on page 2 5 shows a graphical overview of the assembly pro cess T he figure shows the preprocessor processing the assembly source ASM and initialization data pAT files The assembly source file often contains preprocessor commands such as inciude that cause the pre processor to include header files H into your source program The preprocessor s only output an intermediate source file 1s is the assem bler s primary input 2 4 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler A binary object d0u file and an optional listing file are final results of the successful assembly Data initialization file DAT Intermediate preprocessed file 1S Object file Listing file DOJ Assembly source file ASM Header file H Figure 2 1 Assem
54. the number of text lines per printed page In its absence the default setting is 0 which means the listing does not have any page breaks To format the entire listing place the PAGELENGTH directive at the begin ning of your assembly source file If a page length value greater than 0 is too small to allow a properly formatted listing page the assembler will issue a warning and use its internal minimum page length approximately 10 lines Example PAGELENGTH 50 starts a new page after printing 50 lines You can set the page length only once per source file If the assembler encounters multiple occurrences of the PAGELENGTH directive it ignores all of them except the last 2 56 VisualD SP 2 0 Assembler amp Preprocessor M anual for TigerSH ARC DSPs Assembler PAGEWIDTH Set the Page Width of a Listing File The PAGEWIDTH directive sets the page width of the listing file which the assembler produces when you use the 1 switch The PAGEWIDTH directive uses the following syntax PAGEWIDTH expression where e expression evaluates to an integer from 0 to 72 Default is 0 T he zero default page width means that source lines will not be wrapped no matter how long they are A page width greater than 0 means that source file lines that are too long to fit in the assembly source column of the listing will be wrapped into two or more listing lines There is no max imum allowed page width T he assembler che
55. ue to the AD SP T S001 D SPs 1 plList Directs the assembler to output the listing file Dmax 100 Defines the macro max as equal to 100 y Displays verbose information on each phase of the assembly 0 bin pl doj Specifies the name and directory for the assembled object output pl asm Names the assembly source to assemble VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC D SPs2 19 Assembler Command Line Reference Assembler Command Line Options T his section describes the easmts Command line options switches in ASCII collation order A summary of the assembler switches appears in T able 2 3 a brief description of each switch starts on page 2 21 Table 2 3 easmts Command Line Switches Switch Name Usage D escription TSOO1 Assembles instructions unique to AD SP T S001 pro cessors TS101 Assembles instructions unique to AD SP T S101 pro D dmacrol definition cessors Defines macro g h elp G enerates debug information DWARF 2 format Outputs a list of assembler switches I i directory filename Produces a listing file named lt filename gt N ested Searches di rectory for included files source files are not included in the listing li filename Produces a listing file named lt filename gt N ested source files are included in the listing M akes dependencies only does not assemble MM M akes depende
56. urrent directory you must provide the pathname in the double quotation marks The Mo Filename option takes precedence over the o filename Option Mt filename The mt output make rule for the named source assembler switch speci fies the name of the source file for which the assembler generates the make rule when you use the m or mm switch If the named file is not in the cur rent directory you must provide the pathname in the double quotation marks 0 filename The o override switch directs the assembler to use the specified fi7e name argument for the object file If you omit the switch or its argument the assembler uses the input file name for the output and appends a Dou extension You also can use this switch to specify filename for the preprocessed assembly file 1s the only file that the preprocessor outputs when the pp switch is selected Some examples of this switch are as follows easmts pp o testl is test asm specify filename for the preprocessed file easmts o C bin prog3 doj prog3 asm specify directory for the object file VisualD SP 2 0 Assembler amp Preprocessor M anual for T igerSH ARC DSPs2 25 Assembler Command Line Reference The pp proceed with preprocessing only switch directs the assembler to run the preprocessor but stop without assembling the source into an object file By default the preprocessor generates an intermediate pr
Download Pdf Manuals
Related Search
Related Contents
Triarch 25602 User's Manual MODE D`EMPLOI POUR RECRUTER VOTRE PERLE RARE Sun Microsystems SG-XPCIE2FCGBE-E-Z User's Manual Baculovirus Expression System with Gateway® Technology Harbor Freight Tools 12V Product manual 平成25年10月号[ PDF: 3.1MB] Serif WebPlus X4 Omega DMD-476 User's Manual Tiger Products Co., Ltd Head Start Computer NONE User's Manual Copyright © All rights reserved.
Failed to retrieve file