| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
Figure 2-0. Table 2-0. Listing 2-0. Listing 2-0. assembler ADSP-2
Top Searches for this datasheetASSEMBLER Figure 2-0. Table 2-0. Listing 2-0. Listing 2-0. assembler ADSP-21xxx family assembler that runs from operating system command line within VisualDSP environment. assembler processes your assembly source, data, header files, produces object file. Assembler operations depend types controls: assembler directives assembler switches. Assembler directives coded your assembly source file. directives define variables your program, setup some hardware features, identify your program's sections* placement within memory. assembler uses directives guidance translates your source into object code. Assembler switches selected operating system's command line Assemble VisualDSP environment's Options dialog. These switches control assembler processes your assembly source, data, header files. Using these switches, select features, such search paths, output file names, macro preprocessing, among others. This chapter covers assembler information that need know when developing assembling programs ADSP-21xxx family DSPs. This chapter contains following information assembler: assembler section .SECTION) declarations referred here corresponds linker input section. Assembler Manual ADSP-21xxx Family DSPs "Assembler Guide" page "Assembler Command Line Reference" page 2-15 "Assembler Syntax Reference" page 2-23 "Assembler Glossary" page 2-47 Assembler Manual ADSP-21xxx Family DSPs Assembler Assembler Guide guide section describes process developing programs ADSP-21xxx family DSPs assembly language. discussion covers structures conventions should follow when writing these programs. This section provides information that need know when assembling your programs from operating system's command line. Software developers using assembler should familiar with following operations: "Writing Assembly Programs" page "Preprocessing Program" page 2-11 "Reading Listing File" page 2-12 "Setting Assembler Options" page 2-14 information about architecture, including instruction that writing assembly programs, following publications: ADSP-2106x SHARC User's Manual ADSP-21065L SHARC User's Manual ADSP-21065L SHARC Technical Reference ADSP-21160 SHARC Hardware Reference ADSP-21160 SHARC Instruction Reference ADSP-21060/60L, ADSP-21061/61L, ADSP-21062/62L, ADSP-21065L, ADSP-21160 data sheets Assembler Manual ADSP-21xxx Family DSPs Assembler Guide Writing Assembly Programs Write your assembly language programs using VisualDSP editor editor that produces plain text files. word processor that embeds special control codes text. Append .ASM extension your source files identify them assembly files. Assemble your source files, either using assembler's command line within VisualDSP environment. assembler produces binary object files (.DOJ) optional listing file LST). object files Executable Linkable Format (ELF), industry standard format object files. These files serve input linker when link your executable program. addition, ADSP-21xxx assembler embed binary information Debugging Information Format (DWARF-2) that enables source level debugging. listing file text file that read information results assembly process. Look Figure page graphical overview assembly process. figure shows assembler processing assembly source file (.ASM). assembly source file contain preprocessor commands, such #include command that causes assembler process header Assembler Manual ADSP-21xxx Family DSPs Assembler files (.H). After processing, assembler generated types output files: object file (.DOJ) optional listing file (.LST). Data Initialization (.dat) Assembly Source (.asm) Header File (.h) Preprocessor Intermediate preprocessed (.is) Assembler Object File (.doj) Listing File (.lst) Figure 2-1. Assembler Input Output Files Program Content Statements within assembly source file assembly instructions, assembler directives, preprocessor commands. Instructions assemble executable code while directives commands modify assembly process. syntax these statement types follows: Assembly instructions Instructions follow syntax documented target DSP's user manuals. Begin your instruction with keyword with semicolon (;). identify instruction, place address label beginning instruction line preceding line. label with colon before beginning instruction. Assembler Manual ADSP-21xxx Family DSPs Assembler Guide then refer address location your program using label instead absolute address. Although there length restriction when defining labels, convenient limit them length screen line, typically eighty characters. Examples: outer: DM(I1,M1)=F8; start: r0=source; Assembler directives ADSP-21xxx directives begin with period with semicolon (;). period must first character line containing directive. Although assembler does treat directives lowercase uppercase characters differently, convenient type directives names uppercase distinguish them from other assembler statements. Examples: .PRECISION .ROUND_ZERO; complete description ADSP-21xxx directives set, "Assembler Directives" page 2-31. Preprocessor commands Preprocessor commands begin with pound sign with carriage return. pound sign must first character line containing command. command longer than line, backslash carriage return continue command next line. characters between backslash carriage return. Unlike other assembly statements, preprocessor commands case sensitive must lowercase. list these commands, "Preprocessing Program" page 2-11. Examples: Assembler Manual ADSP-21xxx Family DSPs Assembler #include "const.h" #define 3.14159 Figure page contains example assembly source file. Program Structure assembly source file must describe code data mapped into memory your target DSP. There types memory: data memory, which typically contains data memory mapped ports, program memory, which typically contains code. structure your code data into memory should follow from memory architecture target DSP. This mapping code data accomplished using .SECTION directive (formerly .SEGMENT .ENDSEG). .SECTION directive defines grouping instructions data that defined contiguous memory addresses DSP. Each .SECTION name corresponds input section names Linker Description File. Some suggested section names that could your assembly source appear Table 2-1. Using these predefined names your programs, makes easier take advantage default Linker Description File included your system. more information LDF, Linker Utilities Manual ADSP-21xxx Family DSPs. Table 2-1. Suggested Section Names .SECTION Names seg_pmco seg_dmda seg_pmda seg_init Usage Description section Program Memory that holds code. section Data Memory that holds data. section Program Memory that holds data. section Program Memory that holds system initialization data. Assembler Manual ADSP-21xxx Family DSPs Assembler Guide Table 2-1. Suggested Section Names (Cont'd) .SECTION Names seg_rth Usage Description Program Memory that holds system initialization code interrupt service routines. section Data Memory that holds runtime stack. Required runtime environment. Data Memory that holds runtime heap. Required runtime environment. seg_stak seg_rth also create sections program grouping elements meet hardware constraints. group some code that should reside off-chip memory, declare section that code place that section selected memory with linker. Figure page shows program divides into sections that match program data memory segmentation system. Assembler Manual ADSP-21xxx Family DSPs Assembler Preprocessor Commands Assembler Directives Data Section #include "const.h" #define 3.14159 .PRECISION=40; .ROUND_ZERO; .SECTION/DM seg_dmda; .VAR fxd[10] 1,2,3,4,5,6,7,8,9,0xA; .VAR flt[5] PI,PI/2,1.0,2.0,2.0/3.0; .VAR rad; {instructions} .SECTION/PM seg_port; .PORT clk_in; .PORT tick; {instructions} .SECTION/PM seg_pmco; {instructions} #ifdef some_variable {instructions} #endif {instructions} Port Section Code Section Preprocessor Commands Conditional Assembly Figure 2-2. Example Assembly Source File Looking Figure 2-2, notice that assembly source file often begins with more statements, such #include that includes other files your source code #define that defines macros. following .PRECISION .ROUND directives tell assembler store floating-point data with 40-bit precision round floating-point value closer zero value does 40-bit format. Assembler Manual ADSP-21xxx Family DSPs Assembler Guide program then divides into sections; each section begins with .SECTION directive ends with occurrence next .SECTION directive end-of-file. sample source file contains three sections: Data Section seg_dmda. Variables buffers declared initialized. Port Section seg_port. ports mapped program memory; each port unique name, identifying reading writing. Program Section seg_pmco. Primarily instructions, possibly other types statements, such those needed conditional assembly. Program Interfacing Requirements some point, want interface your assembly program with program. compiler supports methods mixing assembly language: embedding assembly code programs, linking together assembly routines. embed (inline) assembly code your program, asm() extension. link together programs that contain assembly routines, assembly interface macros. These macros facilitate assembly mixed routines. complete descriptions both methods appear Compiler Library Manual ADSP-21xxx Family DSPs. When write program that interfaces with assembly, must observe rules that compiler follows produces code DSP. These rules compiled code called compiler's runtime environment. Complying with runtime environment means following rules memory usage, register usage, commenting, variable names. information particular compiler's runtime environment, compiler's user manual. definition runtime environment compiler appears Compiler Library Manual 2-10 Assembler Manual ADSP-21xxx Family DSPs Assembler ADSP-21xxx Family DSPs. This manual also includes series examples that demonstrate assembly code. Preprocessing Program assembler includes preprocessor that allows C-style preprocessor commands your assembly source code. Table lists these commands provides brief description each. preprocessor automatically runs before assembler, unless assembler's (skip preprocessor) switch. Note that preprocessor automatically removes comments from listing file output. Preprocessor commands useful modifying assembly code. example, using #include command, fill memory, load configuration registers, parameters. #define command define constants eliminate frequently used instruction sequences. preprocessor replaces each occurrence macro reference with corresponding value series instructions. example, macro Figure page replaced with characters 3.14159 during preprocessing. complete information ADSP-21xxx family DSPs preprocessor command set, "Preprocessor Commands" page 3-9. Table 2-2. Preprocessor Commands Command #define #error #else #elif #if, #endif Description Defines macro constant. Reports error message. Adds alternative instruction(s) conditional block. Adds multiple conditional block(s). Begins terminates conditional block(s). Assembler Manual ADSP-21xxx Family DSPs 2-11 Assembler Guide Table 2-2. Preprocessor Commands (Cont'd) Command #ifdef #ifndef #include #line #undef #warning Description Tests macro defined. Tests macro defined. Includes source code from another file. Outputs specified line number. Removes macro definition. Reports warning message. Reading Listing File listing file (.LST) optional output text file that lists results assembly process. example listing file appears Listing 2-1. source file, DFT.ASM, that appears listing available ./21k/Examples/DFT directory. Listing files provide following information: Address Column contains offset from .SECTION's .SEGMENT's base address. Opcode Column contains hexadecimal opcode that assembler generates line assembly source. Line Column three contains line number assembly source file. Assembly Source Column four contains line assembly source from file. Note that comments appear listing file. Building your source file with preprocessor automatically removes comments. output 2-12 Assembler Manual ADSP-21xxx Family DSPs Assembler comments listing output, must skip preprocessing entirely using switch. Listing 2-1. Listing File Example Analog Devices EASM21k Assembler dft.lst Page Version Copyright 1999 Analog Devices, Inc. {Lines 0-373 omitted from this listing.} .SECTION/DM dm_data; 41800000000 .VAR input[64]= "test64.dat"; .VAR real[64]; .VAR imag[64]; {Lines 377-379 omitted from this listing.} .SECTION/PM pm_data; .VAR sine[64]= "sin64.dat"; 000000000000 {Lines 381-383 omitted from this listing.} .SECTION/PM pm_rsti; 000000000000 0f7100108421 117100000002 063e00000000 .SECTION/PM pm_code; 0f2100000001 0f2900000001 0f4000000000 0f3000000040 0f1100000080 0f3100000000 06be0400000a 0f1200000040 0f3200000000 NOP; USTAT2= 0x108421; DM(0x02)=USTAT2; JUMP start; start: M1=1; M9=1; B0=input; L0=@input; I1=imag; L1=0; CALL (DB); I2=real; L2=0; end: IDLE; Assembler Manual ADSP-21xxx Family DSPs 2-13 Assembler Guide 0f4800000000 0f3800000040 0f4900000000 0f1900000010 0f3900000040 0f1a00000000 0f3a00000000 0f0f00000000 0c004000001c 71af940a18f0 2040428a19f0 503f02130c05 0c003f000018 204042d8d9040 503f0259c811 013e0058d904 547e8488288d 047e88000000 527e84000000 0a3e00000000 dft: B8=sine; L8=@sine; B9=sine; I9=sine+64/4; L9=@sine; I10=0; L10=0; F15=0; LCNTR=64, outer UNTIL LCE; F8=PASS F15, M8=I10; F9=PASS F15,F0=DM(I0,M1),F5=PM(I9,M8); F12=F0*F5, F4=PM(I8,M8); LCNTR=64-1, inner UNTIL LCE; F13=F0*F4, F9=F9+F12; F8=F8-F13, DM(I2,M1)=F9; MODIFY(I10,M9); outer:DM(I1,M1)=F8; RTS; Setting Assembler Options When developing project, find useful modify assembler's default options settings. assembler from command line, must assembler's command line switches assembler options. more information switches, "Assembler Command Line Switches" page 2-16. assembler program within VisualDSP environment, VisualDSP User's Guide ADSP-21xxx Family DSPs complete information assembler option settings VisualDSP integrated development environment. 2-14 Assembler Manual ADSP-21xxx Family DSPs Assembler Assembler Command Line Reference ADSP-21xxx SHARC assembler processes data from assembly source (.ASM), data (.DAT), header (.H), preprocessed (.IS) files generates binary object files Executable Linkable Format (ELF), industry standard format binary object files. assembler's primary output file extension .DOJ. assembler's secondary outputs optional listing LST) file and, embedded object file, information binary Debugging Information Format (DWARF-2). linking together separately assembled object files, linker produces executable programs (.DXE). archive output assembly process into library file (.DLB), which then linked with other objects into executable. Because archive process performs partial link, placing frequently used objects library reduces time required subsequent links. more information archiver, Linker Utilities Manual ADSP-21xxx Family DSPs. developed software using previous releases development software, want port your debugged COFF libraries current release's format. more information supported file formats conversion utilities, Linker Utilities Manual ADSP-21xxx Family DSPs. This section provides reference information assembler's switches, directives, expressions, conventions. reference information available these topics follows: "Assembler Command Line Switches" page 2-16 This section describes ADSP-21xxx assembler's switches, which accessible from operating system's command line Assembler Manual ADSP-21xxx Family DSPs 2-15 Assembler Command Line Reference Assemble VisualDSP environment's Options dialog. "Assembler Expressions Operators" page 2-23 This section describes assembler's expression operators other conventions. "Assembler Keywords Symbols" page 2-26 This section describes assembler's predefined keywords rules user-defined symbols labels. "Assembler Directives" page 2-31 This section describes assembler's directives, including syntax typical usage examples. Assembler Command Line Switches assembler's command line switches control certain aspects assembly process. These aspects include library searching, listing, preprocessing, other assembler options. When build (compile, assemble, link) your projects, select these options operating system's command line. developing within VisualDSP environment, them Assemble Options dialog. This section describes command line switches ADSP-21xxx family DSPs. list switches appears Table page 2-19, description each switch appears Table page 2-20. 2-16 Assembler Manual ADSP-21xxx Family DSPs Assembler assembler from command line, type name assembly program followed arguments order: easm21k [-switch1] -switch2 sourceFile Where: easm21k Name ADSP-21xxx SHARC assembler pro- Names switches process. gram. -switch1,-switch2 assembler many optional switches. These select operations modes assembler preprocessor. Some assembler switches take sourceFile name required parameter. sourceFile Name source file assemble. file name include drive, path, file name, file extension. assembler uses each file's extension determine what operations perform. Table page 2-18 lists type files extensions that assembler expects files. assembler supports relative absolute path names. When provide input output file name parameter, following guidelines naming files: Enclose long file names within double quotation marks, "long name". Append appropriate file name extension each file. file Assembler Manual ADSP-21xxx Family DSPs 2-17 Assembler Command Line Reference assembler follows conventions file name extensions that appear Table 2-3. Table 2-3. File Name Extension Conventions Extension .asm .lst .doj File Description Assembly source file. Preprocessed assembly source file. Header file. Listing file. Assembled object file. Note that assembler treats files with unrecognized extensions assembly source files. assembler command line case-sensitive. following command line, example: easm21k myFile.lst -dfilter_taps=100 program.doj p0.asm runs assembler with: myFile.lst Directs assembler output listing file. Defines macro filter_taps equal 100. -dfilter_taps=100 Turns verbose information, echoing each file's name processed. program.doj p0.asm Selects name assembled object output. Identifies assembly source file assemble. 2-18 Assembler Manual ADSP-21xxx Family DSPs Assembler summary assembler's command line switches appears Table 2-4; descriptions each switch appear Table page 2-20. Table 2-4. Assembler Command Line Switches sourcefile -idirectory filename -verbose -Dmacro[=definition] -help filename -version Assembler Manual ADSP-21xxx Family DSPs 2-19 Assembler Command Line Reference Table 2-5. Assembler Command Line Switch Descriptions Switch sourcefile Description assembler handles files examining file name extension follows: Files with extension .ASM extension treated assembly source files assembled. Files named #include command with extension treated header files preprocessed. assembly source file named command line, assembler exits with error. -Dmacro[=def] (define macro) switch directs assembler define macro. include optional definition string, assembler defines macro string `1'. Some examples this switch follows: -Djunk -Dten=10 -Dname="Jake" defines junk defines defines name string "Jake" (generate debug information) switch directs assembler generate line number symbol information DWARF-2 format. This information allows debugging assembly source files. -help switch directs assembler output standard output list command line switches with syntax summary. (include path) switch directs assembler append specified directory(ies) search path included files. These files header files (.h) that include with #include command. assembler searches current directory first, then searches directory list directories separated order list defines order multiple searches. -help -idirectory 2-20 Assembler Manual ADSP-21xxx Family DSPs Assembler Table 2-5. Assembler Command Line Switch Descriptions (Cont'd) Switch filename Description (listing file) switch directs assembler produce specified listing file. This file shows relationship between your source code instruction opcodes that assembler produces. specify filename, assembler gives error message. more information, "Reading Listing File" page 2-12. (output) switch directs assembler specified filename output object file. this switch specify filename, assembler uses input file name output appends a.DOJ extension. also this switch specify filename preprocessed assembly file (.IS) that preprocessor outputs when switch used. (proceed with preprocessing) switch directs assembler preprocessor stop without assembling source into object file. default, preprocessor generates preprocessed assembly (.IS) file. This intermediate file deleted assembler runs without error. When assembly stops after preprocessing with switch, file only output. (remove preprocessor information) switch directs assembler remove lines that contain preprocessor output information from listing file. (skip preprocessing) switch directs assembler assemble source into object file without running preprocessor. default, preprocessor generates preprocessed assembly (.IS) file. This intermediate file deleted assembler runs without error. When assembly skips preprocessing with switch, file output. -verbose switch directs assembler output standard output version assembler name each file processed. filename -verbose Assembler Manual ADSP-21xxx Family DSPs 2-21 Assembler Command Line Reference Table 2-5. Assembler Command Line Switch Descriptions (Cont'd) Switch -version filename Description -version switch directs assembler display version information preprocessor program. omit filename, assembler displays revision information gives error message. (skip warning messages) switch directs assembler skip warning information generated during assembly. These messages displayed output listing file. Assembler Dialog Options Within VisualDSP environment, assembler's options Assemble environment's Options dialog. Note that each assembler's command line option corresponds field check Options dialog. more information VisualDSP graphical user interface, VisualDSP User's Guide ADSP-21xxx Family DSPs. 2-22 Assembler Manual ADSP-21xxx Family DSPs Assembler Assembler Syntax Reference When developing your source code programs assembly language, need include preprocessor commands assembler directives them control preprocessor assembler process your program code. need know assembler rules conventions syntax, adhere them. Following these rules, define symbols (identifiers), expressions, different numeric comment formats. Software developers writing assembly programs should familiar with following topics: "Assembler Expressions Operators" page 2-23 "Assembler Keywords Symbols" page 2-26 "Numeric Bases" page 2-30 "Assembler Directives" page 2-31 Assembler Expressions Operators assembler evaluate simple expressions source code. expression acceptable wherever numeric value expected assembly instruction preprocessor command's syntax. assembler supports types expressions: Constant expressions Constant expressions contain arithmetic logical operation more constants, such 2.9e-5 1.29, (128 0x55 0x0f Assembler Manual ADSP-21xxx Family DSPs 2-23 Assembler Syntax Reference Address expressions Address expressions contain symbol integer constant, expression that evaluates integer value runtime, such data data_buffer strtup taps symbols this type expressions either data variables, data buffers, program labels, they represent address values. Adding subtracting integer from symbol specifies offset from address symbol represents. Table lists ADSP-21xxx family DSPs assembler's numeric bitwise operators used constant address expressions. These operators listed order they processed when assembler evaluates expression. Table 2-6. Operator Precedence Chart Operator (expression) LENGTH(buffer) @buffer PAGE(variable) Description Expressions parenthesis evaluates first. Length buffer words. Legacy operator. Length buffer words. Replaced LENGTH() operator. Boot page associated with variable. Ones complement. Unary minus. Multiply. Divide. Modulus. Addition. Subtraction. 2-24 Assembler Manual ADSP-21xxx Family DSPs Assembler Table 2-6. Operator Precedence Chart (Cont'd) Operator Description Shift left. Shift right. Less than. Less than equal. Greater than. Greater than equal. Equal. equal. Bitwise AND. Bitwise exclusive Bitwise inclusive Logical AND. Logical ADSP-21xxx family DSPs assembler's list keywords includes LENGTH PAGE operators. addition arithmetic bitwise operators, assembler currently supports special "length legacy operator. When apply this operator symbol that identifies data buffer, assembler returns length buffer words. This operator used with external symbols; only apply @buffer buffer that define same file @buffer expression. Assembler Manual ADSP-21xxx Family DSPs 2-25 Assembler Syntax Reference example, following code determines base address length circular buffer real_data. buffer's length value contained determines when addressing wraps around buffer. .SECTION/DM seg_dmda; .VAR real_data[n]; .SECTION/PM seg_pmco; B5=real_data; {data segment} {n=number input samples} {code segment} {buffer base address} loads automatically} L5=@real_data; {buffer's length} M6=1; {post-modify LCNTR=@real_data, loop UNTIL LCE; {loop counter=buffer's length} F0=DM(I5,M6); {get next sample} loop: LENGTH() operator preferred operator, although ADSP-21xxx assembler accepts source code written with legacy operator. Assembler Keywords Symbols assembler supports predefined keywords, including register names, bitfield names, assembly instructions, assembler directives. Listing page 2-28 lists assembler keywords. When developing your assembly programs, extend this keywords with symbols that declare section names, variable constant names, address labels. When defining symbols your assembly source code, follow these conventions: Define symbols that unique within file they declared. symbol more than file, .GLOBAL directive export symbol from file defined then .EXTERN directive import symbol into other files. 2-26 Assembler Manual ADSP-21xxx Family DSPs Assembler begin symbols with digit. define symbols, alphabetic characters (A-Z digits (0-9), special characters (dollar sign underscore). a-z), Symbols case-sensitive, input_addr INPUT_ADDR define unique variables. reserved keyword define symbol. ADSP-21xxx family DSPs assembler's reserved keywords listed Listing 2-2. Because linker uses section segment) name symbols placing code memory, make sure your section name symbols conflict with linker's keywords Linker Description File (.LDF). more details, Linker Utilities Manual ADSP-21xxx Family DSPs. colon terminate address label symbols. Address label symbols appear beginning instruction line stand alone preceding line. following lines code demonstrate some symbol usage: .VAR xoperand; .VAR input_array[10]; sub_routine_1: .SECTION/PM seg_pmco; {xoperand data variable} {input_array data buffer} {sub_routine_1 label} {seg_pmco section name} Assembler Manual ADSP-21xxx Family DSPs 2-27 Assembler Syntax Reference Listing 2-2. Assembler Keywords ADDRESS ALIGN ASHIFT ASTAT BCLR BITREV BSET BTGL BTST CACHE CALL CJUMP EXP2 EXTERN FADDR FDEP FEXT FILE FLAGO_IN FLAG1_IN FLAG2_IN FLAG3_IN FLOAT FLUSH FMERG FOREVER FPACK FRACTIONAL FUNPACK GCC_COMPILED LADDR LCNTR LEFTMARGIN LEFTO LEFTZ LENGTH LINE LOAD LOG2 LOGB LOOP LSHIFT PCSTK PCSTKP PMADR PMBANK1 PMDAE PMDAS MPWAIT PORT POVLO POVL1 PRECISION PREVIOUS PSA1E PSA1S PSA2E PSA2S PSA3E PSA3S PSA4E PSA4S PUSH SUFR SUIR TCOUNT TPERIOD TRUE TRUNC TYPE UNPACK UNTIL USFR USIR USTAT1 USTAT2 UUFR UUIR WITH 2-28 Assembler Manual ADSP-21xxx Family DSPs Assembler CLIP COMP COPYSIGN CURLCNTR DADDR DMA1E DMAIS DMA2E DMA2S DMADR DMBANK1 DMBANK2 DMBANK3 DMWAIT DOVL ELSE EMUCLK EMUCLK2 EMUIDLE EMUN ENDEF ENDSEG GLOBAL IDLEI15 IDLE16 IMASK IMASKP IRPTL JUMP MANT MODE1 MODE2 MODIFY MROB MROF MR1B MR1F MR2B MR2F NEWPAGE NOFO NOFZ NOPSPECIAL PASS PACK PAGE PAGELENGTH PAGEWIDTH READ RECIPS RFRAME ROUND_MINUS ROUND_NEAREST ROUND_PLUS ROUND_ZERO RSQRTS SCALB SECTION SEGMENT SIZE SSFR SSIR STEP STKY keywords this listing appear uppercase, these keywords case insensitive assembler's syntax. example, assembler accepts both "DM" "dm". assembler symbols that define your code case sensitive. example, "taps" "TAPS" independent variables. Assembler Manual ADSP-21xxx Family DSPs 2-29 Assembler Syntax Reference Numeric Bases assembler supports binary, octal, decimal, hexadecimal number formats within expressions assembly instructions. Table lists describes conventions notation assembler uses distinguish between these numeric bases formats. Table 2-7. Numeric Bases Convention Description special assembler symbol; value value program counter. prefix indicates binary base number. Bnumber bnumber Onumber onumber number Dnumber dnumber 0xnumber Hnumber hnumber prefix indicates octal base number. "D", "d", prefix indicates decimal base number. "0x", "H", prefix indicates hexadecimal base number. Note that operand expression floating-point value, assembler stores value expression floating-point format. 2-30 Assembler Manual ADSP-21xxx Family DSPs Assembler Comments Conventions assembler supports four formats inserting comments assembly source code. Table lists describes these formats. Table 2-8. Comment Conventions Convention !comment comment comment //comment Description begins each single-line comment. pair braces enclose multiple-line comment. string encloses multiple-line comment. pair slashes "//" denote each single-line comment. Note that building your program with preprocessor option removes comments from listing file. Assembler Directives Directives assembly source file control assembly process. Unlike instructions, directives produce opcodes during assembly. following general syntax assembler directives: .directive [qualifiers arguments]; assembler directives start with period with semicolon (;). Some directives take qualifiers arguments. directive's qualifiers immediately follow directive separated slashes (/); arguments follow qualifiers. Comments follow directive's terminating semicolon. Assembler directives either uppercase lowercase. However, convenient directives uppercase distinguish them from other symbols your source code. Assembler Manual ADSP-21xxx Family DSPs 2-31 Assembler Syntax Reference ADSP-21xxx assembler supports directives listed Table 2-9. Descriptions each directive appear following sections. Table 2-9. ADSP-21xxx DSPs Assembler Directives Directive .SECTION .SEGMENT/.ENDSEG .ALIGN .PREVIOUS .PORT .VAR .GLOBAL .EXTERN .TYPE .PRECISION .ROUND_NEAREST .ROUND_MINUS .ROUND_PLUS .ROUND_ZERO .NEWPAGE .PAGELENGTH .PAGEWIDTH .LEFTMARGIN Description Marks beginning section contiguous memory addresses. Legacy directives; replaced .SECTION directive. Specifies byte alignment requirement. Reverts previously described .SECTION. Declares memory mapped port Defines initializes data objects. Changes data object's scope from local global. Allows references global symbols. Changes default data symbol type. Defines number significant bits floating-point constant. Specifies Round-to-Nearest mode. Specifies Round-to-Negative Infinity mode. Specifies Round-to-Positive Infinity mode. Specifies Round-to-Zero mode. Inserts page break listing page. Defines length listing page. Defines width listing page. Defines width left margin listing page. 2-32 Assembler Manual ADSP-21xxx Family DSPs Assembler .SECTION, Declare Program Segment .SECTION directive marks beginning section, contiguous locations program memory data memory. statements between .SECTION following .SECTION end-of-file specify contents section. This directive uses following syntax: .SECTION/sectionQualifiers sectionName [sectionType]; Where: sectionQualifiers keywords describing memory type: (program memory), (data memory), (random access memory), (read only memory). sectionQualifiers must match memory type section same name used Linker Description File place section. more information, Linker Utilities Manual ADSP-21xxx Family DSPs. section name symbol, sectionName, must contain eight fewer characters. Table page shows some typical section names. assembler's section name must match corresponding input section name that Linker Description File uses placing section. sectionType optional. Valid sectionTypes described ELF.h header file, which available from third party companies. more information file format, Linker Utilities Manual ADSP-21xxx Family DSPs. Examples: .SECTION/RAM/PM seg_pmco; .SECTION/DM seg_dmda; more information Linker Description File, Linker Utilities Manual ADSP-21xxx Family DSPs. Assembler Manual ADSP-21xxx Family DSPs 2-33 Assembler Syntax Reference .SEGMENT .ENDSEG, Legacy Directives Previous releases ADSP-210xx development software used .SEGMENT .ENDSEG directives define beginning section contiguous memory addresses. Although these directives replaced with .SECTION directive, source code written with .SEGMENT/.ENDSEG legacy directives accepted ADSP-21xxx family assembler. .ALIGN, Specify Address Alignment .ALIGN directive forces address alignment instructions data items within .SECTION they used. .ALIGN directive uses syntax: .ALIGN expression; Where: expression evaluates integer specify byte alignment requirement. value expression must power When allocating data items instructions, assembler adjusts their sequential memory addresses that they evenly divided value expression, aligned. expression signifies address alignment requirements. absence .ALIGN directive, address default alignment Examples: .ALIGN .ALIGN alignment requirement} alignment requirement} .SECTION/DM dm_data; .ALIGN .VAR data.dat; data items sequential locations with address values that evenly divided 2-34 Assembler Manual ADSP-21xxx Family DSPs Assembler .PREVIOUS, Revert Previously Defined Section .PREVIOUS directive instructs assembler current section contiguous memory locations program data memory section that described directly before current one. This directive uses following syntax: .PREVIOUS; Example: .SECTION/PM/RAM sec_one; {instructions}; .SECTION/DM/RAM sec_two; {instructions}; .PREVIOUS; directs assembler revert back sec_one same effect .SECTION/PM/RAM sec_one; {instructions}; .SECTION/DM/RAM sec_two; {instructions}; .SECTION sec_one; .VAR, Declare Data Variable Buffer .VAR directive declares optionally initializes variables data buffers. variable uses single memory location data buffer uses array memory locations. Because assembler associates .VAR directive with memory section where .VAR appears, .VAR directive only valid appears within section. single .VAR directive declare number variables buffers, separated commas, Assembler Manual ADSP-21xxx Family DSPs 2-35 Assembler Syntax Reference line. Declare variables buffers before referring them code. .VAR directive uses following syntax: .VAR buffferName [length]= "fileName"; .VAR varName1 [,varName2,.]; .VAR bufferName1[length] [,bufferName2[length],.]; .VAR varName1,varName2,. initExpression1, initExpression2,.; .VAR initExpression1[, initExpression2,.]; Where: brackets this syntax that enclose optional [length] required part syntax. more information, .VAR directive examples below. user-defined varName bufferName parameters names variables buffers. fileName parameter indicates that elements buffer their initial values from fileName data file (.DAT). ellipsis represents comma delimited list parameters. [length] parameter defines length words associated buffer. specify length, assembler creates one-word variable. initExpression parameter sets initial values variables buffer elements. size variable's initialization value size buffer's largest initialization value defines word size variable buffer. available word sizes 32-, 40-, 48-bits. These word sizes equate respectively 10-, 12-, 14-digit hexadecimal constant strings. 2-36 Assembler Manual ADSP-21xxx Family DSPs Assembler following lines code demonstrate some .VAR directives: .VAR Ins, Outs, Remains; declare three uninitialized variables .VAR samples[100]= "inits.dat"; declare 100-location buffer initialize with contents inits.dat file .VAR taps 100; declare variable initialize variable .VAR twiddles[10] "phase.dat"; //declare 10-location buffer load buffer //with contents phase.dat file Whether .VAR directive lists initial values reads them from file, make sure that number initial values does exceed number variables buffer locations that declare. Initializing from files useful loading buffers with data, such filter coefficients phase rotation factors that generated other programs. assembler determines values stored memory when reads data files. Assembler Manual ADSP-21xxx Family DSPs 2-37 Assembler Syntax Reference .GLOBAL, Make Variable Buffer Globally Available .GLOBAL directive changes scope symbol from local global making symbol available import object files that linked with current one. default, symbol only valid file which declared. Local variables different files have same name assembler considers them independent entities. comparison, symbol that global scope recognizable other files always refers same address value. After changing symbol's scope with .GLOBAL directive, make available export. Once symbol made global, other files refer declaring symbol .EXTERN. .GLOBAL directive uses following syntax: .GLOBAL symbolName1[, symbolName2,.]; Where: symbolName name global symbol. single .GLOBAL directive define scope number symbols, separated commas, line. Examples: .VAR coeffs[10]; .VAR taps 100; .GLOBAL coeffs, taps; declares buffer declares variable makes buffer variable visible other files more information .EXTERN directive, page 2-39. 2-38 Assembler Manual ADSP-21xxx Family DSPs Assembler .EXTERN, Refer Globally Available Variable Buffer .EXTERN directive imports symbols that have been declared .GLOBAL other files. more information .GLOBAL directive, page 2-38. .EXTERN directive uses following syntax: .EXTERN symbolName1[, symbolName2, Where: symbolName name global symbol import. single .EXTERN directive define scope number symbols, separated commas, line. Example: .EXTERN coeffs; This code example declares external symbol reference global variable .GLOBAL directive section example.*/ .TYPE, Change Default Symbol Type .TYPE directive enables compiler change default symbol type identifier. This directive appear compiler generated assembly code. This directive uses following syntax: .TYPE symbolName, symbolType; Assembler Manual ADSP-21xxx Family DSPs 2-39 Assembler Syntax Reference Where: symbolName identifier, which symbol type want change. symbolType symbol type. symbol type symbol type; valid symbol types listed ELF.h header file. Example: .SECTION/PM program; _main: .TYPE _main, STT_OBJECT; //By default, label section STT_FUNC type. //The label changed symbol type STT_FUNC. .PORT, Declare Memory Mapped Port .PORT legacy directive assigns port name symbol port. Port name symbols global symbols. This port name corresponds port that define Linker Description File. .PORT directive uses following syntax: .PORT port_name; Where: port_name port name symbol that globally available. Examples: .PORT //declares port .PORT //declares port declare port using ADSP-21xxx assembler syntax, .VAR directive declare port-identifying symbol Linker Description File create corresponding section. linker resolves port 2-40 Assembler Manual ADSP-21xxx Family DSPs Assembler variables LDF. more information LDF, Linker Utilities Manual ADSP-21xxx Family DSPs. .PRECISION, Select Floating-Point Precision .PRECISION directive controls assembler interprets literal floating-point numeric data. This directive determines only assembler handles floating-point values constant declarations variable initializations. configure floating-point precision target system setting control registers with application software instruction specific processor. following options: .PRECISION .PRECISION Where: precision determines number significant bits floating-point data. equal sign following .PRECISION keyword optional. Examples: .PRECISION=32; Selects standard IEEE 32-bit single-precision format; this default setting /*Selects standard IEEE 40-bit format with extended mantissa .PRECISION Note that .PRECISION only applies floating-point data. precision fixed-point data determined number digits specified. Assembler Manual ADSP-21xxx Family DSPs 2-41 Assembler Syntax Reference .ROUND Directives, Select Floating-Point Rounding .ROUND directives control assembler interprets literal floating-point numeric data after .PRECISION defined. These directives determine only assembler handles floating-point values constant declarations variable initializations. configure floating-point rounding modes system setting control registers with application software instruction specific target processor. .ROUND directives following syntax: .ROUND_mode; Where: mode string determines rounding scheme used when value does destination format. following IEEE standard modes: .ROUND_NEAREST; .ROUND_PLUS; .ROUND_MINUS; .ROUND_ZERO; following examples numbers with four decimal places reduced three decimal places rounded according rounding mode: .ROUND_NEAREST; Selects Round-to-Nearest scheme; this default setting absence another .ROUND_ directive. added digit that follows third decimal digit least significant (LSB). result truncated after third decimal digit LSB. 1.2581 8.5996 -5.3298 -6.4974 rounds rounds rounds rounds 1.258 8.600 -5.329 -6.496 2-42 Assembler Manual ADSP-21xxx Family DSPs Assembler .ROUND_ZERO; Selects Round-to-Zero. closer zero value taken. number truncated after third decimal digit least significant bit. 1.2581 8.5996 -5.3298 -6.4974 rounds rounds rounds rounds 1.258 8.599 -5.329 -6.497 .ROUND_PLUS; Selects Round-to-Positive Infinity.The number always rounds next larger. positive numbers, added third decimal digit least significant bit. Then result truncated after LSB. negative numbers, mantissa truncated after third decimal digit LSB. 1.2581 8.5996 -5.3298 -6.4974 rounds rounds rounds rounds 1.259 8.600 -5.329 -6.497 .ROUND_MINUS; Selects Round-to-Negative Infinity.The value always rounds next smaller. negative numbers, subtracted from third decimal digit least significant bit. Then result truncated after LSB. positive numbers, mantissa truncated after third decimal digit LSB. 1.2581 8.5996 -5.3298 -6.4974 rounds rounds rounds rounds 1.258 8.599 -5.330 -6.498 .PRECISION directive determines number bits truncated match number significant bits. Assembler Manual ADSP-21xxx Family DSPs 2-43 Assembler Syntax Reference .NEWPAGE, Insert Page Break Listing File .NEWPAGE directive inserts page break printed listing file (.LST) when switch. assembler inserts page break location .NEWPAGE directive. .NEWPAGE directive uses following syntax: .NEWPAGE; Example: .NEWPAGE; {inserts page eject into listing file} This directive appear anywhere your source code file. absence .NEWPAGE, page ejected after listing lines. .PAGELENGTH, Page Length Listing File .PAGELENGTH directive sets page length optional listing file (.LST) that assembler produces when switch. controls number text lines page printed output. absence .PAGELENGTH directive, listing file prints lines page. .PAGELENGTH directive uses following syntax: .PAGELENGTH expression; Where: expression evaluates integer range from change default number lines page entire output listing file, place .PAGELENGTH directive beginning your assembly source file. Example: .PAGELENGTH {after printing characters, start row} 2-44 page length only once source file. assembler encounters multiple occurrences .PAGELENGTH directive, ignores expressions except last. Assembler Manual ADSP-21xxx Family DSPs Assembler .PAGEWIDTH, Page Width Listing File .PAGEWIDTH directive sets page width optional listing file (.LST) that assembler produces when switch. controls maximum number characters printed output file. absence .PAGEWIDTH directive, line begins after most characters printed preceding line. .PAGEWIDTH directive uses following syntax: .PAGEWIDTH expression; Where: expression evaluates integer range from change default number characters line entire output listing file, place .PAGEWIDTH directive beginning your assembly source file. Example: .PAGEWIDTH {start after most charac-} {ters printed line} page length only once source file. assembler encounters multiple occurrences .PAGEWIDTH directive, ignores expressions except last. .LEFTMARGIN, Margin Width Listing File .LEFTMARGIN directive sets margin width listing page. controls number empty spaces left margin optional listing file (.LST) that assembler produces when switch. absence .LEFTMARGIN directive, printer advances empty Assembler Manual ADSP-21xxx Family DSPs 2-45 Assembler Syntax Reference spaces left side. .LEFTMARGIN directive uses following syntax: .LEFTMARGIN expression; Where: expression evaluates integer range from marks left bound row. value expression cannot exceed maximum number columns printed page. change default margin width entire output listing file, place .LEFTMARGIN directive beginning your assembly source file. Example: .LEFTMARGIN spaces left left margin, listing line begins column page length only once source file. assembler encounters multiple occurrences .LEFTMARGIN directive, ignores expressions except last. 2-46 Assembler Manual ADSP-21xxx Family DSPs Assembler Assembler Glossary Assembler directives tell assembler process your source code some features. Directives structure your program into logical section(s) that mirror memory layout your target system. Instruction assembly instructions that work specific family. assembler supports ADSP-21x6x instruction set, including ADSP-21160 extensions. information ADSP-21xxx family instruction set, following publications: ADSP-2106x SHARC User's Manual ADSP-21065L SHARC User's Manual ADSP-21065L SHARC Technical Reference ADSP-21160 SHARC Hardware Reference ADSP-21160 SHARC Instruction Reference ADSP-21060/60L, ADSP-21061/61L, ADSP-21062/62L, ADSP-21065L, ADSP-21160 data sheets Linker Description File controls linker processes assembler's output object files into executable programs. more information, Linker Utilities Manual ADSP-21xxx Family DSPs. Preprocessor commands directs preprocessor include files, perform macro substitutions, control conditional assembly. more information, "Preprocessor Commands" page 3-9. Assembler Manual ADSP-21xxx Family DSPs 2-47 Assembler Glossary 2-48 Assembler Manual ADSP-21xxx Family DSPs Other recent searchesSC26C92 - SC26C92 SC26C92 Datasheet PZT772 - PZT772 PZT772 Datasheet LIN-2840XX - LIN-2840XX LIN-2840XX Datasheet LIN-2841XX - LIN-2841XX LIN-2841XX Datasheet Family - Family Family Datasheet EVM1DS - EVM1DS EVM1DS Datasheet EVM1ES - EVM1ES EVM1ES Datasheet EVM1US - EVM1US EVM1US Datasheet DSE-931-042 - DSE-931-042 DSE-931-042 Datasheet DS1620 - DS1620 DS1620 Datasheet
Privacy Policy | Disclaimer |