Home

Senior Assembler & Simulator user manual

image

Contents

1. srsim r p pm size 0 dm0_size 1 dm1_size program where srsim is the name of the Senior simulator program and program is the filename of the program to simulate the file produced as output from the Senior assembler All other arguments are optional and work as follows Option Description Maximum value Default value Sr run program directly when loaded p set size for program memory 65536 65536 0 set size for data memory 0 65536 65536 1 set size for data memory 1 65536 65536 For instance running the command gt srsim p 4096 testl hex Senior simulator Allocated 4096 words for program memory Allocated 65536 words for data memory 0 Allocated 65536 words for data memory 1 Read 924 words to program memory sim gt will set program memory size to 4096 load the program test1 hex to program memory and wait for command input at the sim gt prompt OBSERVE all sizes for program memory and data memories must be large enough to hold its designated content or there will be a memory access violation When using the option r simulation may be aborted by pressing CTRL c which will also exit the simulator 13 2 2 SIMULATOR COMMANDS CHAPTER 2 SENIOR SIMULATOR 2 2 Simulator commands The simulator has a few in house commands explained below for use when simulating It is always possible to repeat the last command by pressing CTRL d 2 2 1 h print help Print a list of available commands It shou
2. so for this to work the source code file has to be in the same directory as from where simulator is started After each and one of the general and special registers there may be one of the characters r or w printed in either lowercase or uppercase A lowercase r or w signifies this register is scheduled for a reading or writing respectively at a later cycle An uppercase R or W signifies this register is to be read or written respectively at the current cycle 2 2 3 list program List the source code program around the current program counter address Some ad dresses before and some after the current program counter will be printed The current source code line to be executed is notified with an arrow gt It should look something like this sim gt 1 set r5 2 lsr r1 r8 12 lsr r2 r8 10 lsr r3 r8 9 lsr r4 r8 6 lsr r6 r8 4 set r8 1 gt and r1 15 and r2 3 and r3 1 and r4 3 and r6 3 sto ar2 r1 bitrate cmp 3 r4 mode_single_channel move eq r5 r8 Channels 1 or 2 sim gt The simulator is not aware of the source code file location so for this to work the source code file has to be in the same directory as from where the simulator is started 15 2 2 SIMULATOR COMMANDS 2 2 4 r run a number of cycles CHAPTER 2 SENIOR SIMULATOR Run a specified number of cycles This command takes one argument an integer number specifying how many cycles to run After running the specified number of cycles the p co
3. by default 2 2 9 q quit Quit and exit the simulator 17
4. e707 4c40 8163 66d0 ed38 70e3 471d b8e3 73b6 877b 36ba 2b1f 7162 CHAPTER 2 SENIOR SIMULATOR 2 2 SIMULATOR COMMANDS 8290 62f2 2528 dad8 9d0e 809e 8f1d c3a9 Oc8c 8298 5134 7a7d 7a7d 5134 Oc8c c3a9 8f1d 809e 82a0 9d0e dad8 2528 62f2 7f62 70e3 3c57 f374 82a8 aecc 8583 877b be32 12c8 5ed7 7fd9 66d0 82b0 1f1a c946 8c4a 83d6 b3c0 0648 55f6 7e9d 82b8 6dca 2b1f d4e1 9236 8163 aa0a f9b8 4c40 82c0 7c2a 73b6 36ba e0e6 9930 8027 a129 ed38 82c8 41ce 7885 89be cf04 30fc 7642 7642 30fc 82d0 cf04 89be 89be cf04 30fc 7642 7642 30fc sim gt 2 2 6 dl dump data memory 1 Dump print 128 address contents starting from a specified address from data memory 1 This command works in the same way as the command do but from data memory 1 See above 2 2 7 g run until CTRL C pressed Run continously until CTRL c is pressed Having run the command and then pressed CTRL c it should look something like this sim gt g Running break with CTRL C Execution aborted at PC 626 CYCLE 3892040 sim gt 2 2 8 e toggle event Toggle event messaging on or off Some events during simulation like saturation from calculations or delay slot jump activation may be notified by event messaging It can be useful when stepping through a program but may be annoying when running at full speed Toggling event messaging should look something like this sim gt e Event is on sim gt e Event is off sim gt Event Messaging is off
5. SOURCE FILE STRUCTURE ram0 The ram0 directive is one of four memory space directives It sets an internal memory space pointer to direct the following code generation to the first part of data memory 0 This directive is typically used together with the skip directive see below to reserve larger sets of RAM memory For instance the following code ram0 array4 skip 128 would reserve 128 data words in data memory 0 for access with the label array4 The directive is valid until another memory space directive occurs rom0 The rom0 directive is one of four memory space directives It sets an internal memory space pointer to direct the following code generation to the second part of data memory 0 This directive is typically used for ROM table content It is stored in the hex output file together with the rest of the generated program content and loaded into the simulator at start Used together with the dw df or dfu directives it is possible to generate ROM table data for instance like this rom0 dw 0 1 1 1 1 1 2 3 4 5 6 7 8 9 10 dfu 1 33333333333 1 60000000000 1 14285714286 1 77777777777 df 0 06250000000 0 03125000000 0 01562500000 0 00781250000 The directive is valid until another memory space directive occurs raml The rami directive is one of four memory space directives It sets an internal memory space pointer to direct the following code generation to data memory 1 This directive is
6. Senior Assembler Simulator user manual September 4 2008 Contents 1 Senior assembler 5 11 Command line Ybarra Eat dia nd 5 1 2 Assembler source file structure 6 121 Reserved Words sk lt RE sl Made Sak Shae Fars 7 1 2 2 Mnemonics 2 20s 3 ake p bay dal mou lb he es ELDR 7 12 38 Identifiers a sake le Ende 4 as un late 7 ADA LADES ida dus BE A Bache ht lA 7 125 COMMENTS aa os 8 Se D se Sit ie M dun QUE 8 126 Numbers ss ae gs Sale G Aha Oe ae dl anse 8 L2T Directives sanse ST sans Ted Fru dte e Se SELDE 8 ES Special TO pont aioe E see Ne Sakens 11 2 Senior simulator 13 2 1 Command line syntax 13 2 2 Simulator commands 14 220 h print help de is She dpt ns el 14 2 22 D print TECISTETS fa ror Seed sation home SR SR 14 2 2 3 list program 2 gt basar SEG ES ale ee EVA nb tn 15 2 2 4 r run a number of cycles 16 2 2 5 d0 dump data memory 0 16 2 2 6 dl dump data memory 1 17 22 7 g run until CTRL C pressed 17 2 28 se t gglesevent lid A aker te A et kue Gs 17 22 90 SEE r Ge Ene PT SYSE SE A eo 17 Contents Contents 1 Senior assembler The Senior assembler is an assembler for the Senior DSP assembly language The as sembler uses three passes In the first pass all source code e
7. eral digits followed by a decimal point followed by one or several digits Negative floating point numbers may be entered with a leading minus sign For instance these are floating point numbers 3 14159265359 0 33333333333 1 2 7 Directives The assembler makes use of cpp C pre processor before processing the assembly source code Hence cpp must be available in the search path when running the assembler Cpp makes it possible to use some of its pre processor directives in the assembly code include The include directive is a cpp directive It includes another source file exactly as it is in the place of the include directive This way it is possible to divide a project into several assembly source files and include them wherever needed The include directive takes a file name within quotation marks as its only argument like this include init asm define The define directive defines identifiers for constants Look at the section Identifiers above for the definition of identifiers A constant identifier may be defined like this define porti 0x0011 code The code directive is one of four memory space directives It sets an internal memory space pointer to direct the following code generation to the program memory space This program memory space is used for actual program content that is instructions The directive is valid until another memory space directive occurs CHAPTER 1 SENIOR ASSEMBLER 1 2 ASSEMBLER
8. exadecimal values one value per line It may look something like this 0087 7a71 bb27 005e 308d 006d 0022 Using the instruction out 0011 r21 will write data from the general register r21 to the file I0S0011 The format of the file I0S0011 is the same as for the file I0S0010 above Using the instruction out 0012 r0 will stop the simulation and exit the simulator This is useful when using external scripts and makefiles for running several simulations sequentially without human intervention The contents of the source register r0 will be ignored Using the instruction out 0013 r0 will stop the simulation and return to the simulator prompt thus remaining in the simulator environment This is useful when there is a need to inspect processor status registers flags stack memories etc at a certain point in the program after running at full speed Think of it as a break point The contents of the source register r0 will be ignored 12 2 Senior simulator The Senior simulator is a simulator for the Senior DSP Although the Senior DSP has a pipelined architecture the simulator operates from a programmers point of view so that each instruction is seemingly executed immediately though all cycle events are kept track of and executed accordingly In other words the Senior simulator is not a fully true pipeline cycle simulator 2 1 Command line syntax The simulator command line uses the following syntax
9. he address register ar3 scale The scale directive affects the way floating point numbers are stored The directive takes one positive floating point number as its only argument The directive will set a range for floating point numbers to be stored For instance the following scale 2 0 would set the range 2 0 2 0 for signed floating point numbers and the range 0 2 0 for unsigned floating point numbers The directive is valid until another scale directive is set Any floating point number outside the range will be saturated to within the range with a given warning The default scale directive value is 1 0 dw The dw directive will store a 16 bit integer number at the memory space pointer in the current memory space The directive takes a comma separated list of signed or unsigned constants as its argument It is only useful in the rom0 memory space It may be used for instance like this rom0 dw 7 3 data3 3F12 data3 is a previously defined constant 10 CHAPTER 1 SENIOR ASSEMBLER 1 3 SPECIAL 1 0 PORTS df The df directive will store a signed floating point number at the memory space pointer in the current memory space The directive takes a comma separated list of signed floating point constants as its argument It is only useful in the rom0 memory space Each value will be divided by the scale factor set by the scale directive and then converted to a binary representation with a sign bit and 15 fract
10. inning of a line The various parts of the source code structure is explained in the following sections 1 2 1 Reserved words Reserved words are words that can not be used for anything else but their designated purpose These are typically all the mnemonics instructions and such names of regis ters accumulators scale factors etc in short everything that is declared in the assembler by default For instance the word call for the instruction call is reserved and can not be used as an identifier or a label but for instance the words _call or cal14 are not reserved and can be used freely 1 2 2 Mnemonics Mnemonics are typically the instruction words and its various options and operators An assembler source line with an instruction always start with the instruction itself followed by its arguments if any The exact syntax for all instructions and its options the instruction set is described in a separate document All mnemonics must be written in the source code using lowercase lettering 1 2 3 Identifiers In the assembler source file context identifiers are names that refer to something typi cally defined by the programmer A label a constant or the definition of a register The assembler lines alias sp ar3 define porti 0x0011 would define the identifiers sp and port1 for reference to the address register ar3 and the constant 0x0011 respectively for later use in the code Identifiers must use the syntax a zA Z_ a
11. ional bits This 16 bit value is finally stored in memory If the value does not fit this representation it will be saturated It may be used for instance like this rom0 scale 2 0 df 0 0 0 5 1 0 1 0 2 0 2 0 which will be equivalent with the following code rom0 dw 0000 2000 C000 4000 8000 7FFF Note that the sixth value 2 0 has been saturated dfu The dfu directive is similar to the df directive The difference is that dfu uses an unsigned representation with 16 fractional bits It may be used for instance like this romO scale 2 0 dfu 0 0 0 5 1 0 1 5 2 0 which will be equivalent with the following code rom0 dw 0000 4000 8000 C000 FFFF Note that the fifth value 2 0 has been saturated 1 3 Special I O ports There are four I O ports that have special meaning for the assembler and simulator They are the following Address I O Description 0010 in Read data from the external file I0S0010 0011 out Write data to the external file I0S0011 0012 out Stop simulation and exit simulator 0013 out Stop simulation same as pressing CTRL c 11 1 3 SPECIAL 1 0 PORTS CHAPTER 1 SENIOR ASSEMBLER These I O ports are either in or out only to be used with the instructions in or out respectively Using the instruction in r14 0010 will read the next data from the file I0S0010 to general register r14 The file 1080010 must be a plain text file with 16 bit h
12. ld look something like this sim gt h Senior simulator p print registers r lt n gt run lt n gt cycles do n dump dmO from address n di n dump dmi from address n g go until CTRL C e toggle event 1 list program around pc h display this help q quit sim gt 2 2 2 p print registers Print the contents of all 32 general registers all 32 special registers all 4 accumulators the contents of the hardware stack the settings of all flags the value of the program counter the hardware stack pointer and the cycle counter It should look something like this sim gt p r 0000 0040 0000 0000 0000w0000 0000 0000 0000 0000 0000 0000 0000w0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 sr 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 3F12r0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 acr 0000000000 0000000000 0000000000 0000000000 hwstack 14 CHAPTER 2 SENIOR SIMULATOR 2 2 SIMULATOR COMMANDS 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 flags MV 0 MS 0 MN 0 MZ 0 AV 0 AC 1 AN 0 AZ 0 pc hwsp CC 0003 0 3 testi asm 14 set r7 3F7A sim gt Lastly the next source code line to be executed may be printed Printed is the source code file name line number and then the actual source code line The simulator is not aware of the source code file location
13. mmand print registers is executed It should look something like this sim gt r 4 Simulating 4 cycle s 100 104 r 0040 0001 0000 0000 sr 0000 0000 0000 0000 acr 000aW0000w0000w0001w0002 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0004 007e 0000 0000w0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0a04 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000000000 0000000000 0000000000 0000000000 hwstack 0008 00b5 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 flags MV 0 MS 0 MN 0 MZ 0 AV 0 AC 0 AN 0 AZ 0 pc 00c2 hwsp cc 1 104 testl asm 79 an sim gt d r6 3 2 2 5 d0 dump data memory 0 Dump print 128 address contents starting from a specified address from data memory 0 This command takes one optional argument an integer number specifying from what address to start dumping If no argument is given dumping will continue from after the last address previously dumped It should look something like this 16 sim gt 8258 8260 8268 8270 8278 8280 8288 d0 33368 9592 8276 8276 6a6e 7d8a 7d8a 9592 8276 83d6 7 d9 6dca 4ice aa0a e0e6 1f1a f9b8 be32 9236 5ed7 7c2a 8583 9592 6a6e a129 0648 55f6 8027 aecc b8e3 471d d4e1 c946 7885 8c4a f374 e707 18f9 12c8 9930 7e9d b3c0 3c57 18f9
14. srasm src test1 asm Senior assembler Assembled successfully into src testi hex will generate the file test1 hex in the same directory as the infile test1 asm 1 2 ASSEMBLER SOURCE FILE STRUCTURE CHAPTER 1 SENIOR ASSEMBLER 1 2 Assembler source file structure The assembler source file typically consists of several sections Usually there is first a section with defines and aliases declaring names of constants registers and such for later use in the code There are four memory spaces ram0 rom0 rami and code defining where definitions and code eventually end up Here is an example of a source file main asm This is the main program alias sp ar3 define porti 0x0011 rami Skip 128 stack align 1024 code include output asm main set sp stack initialize stack pointer call stream_init sinitialize stream main_loop call read_header call layer2_decode jump main_loop rom0 table_bitrate dw Os 15 1s 1 15 21 25 35 450 05004 Ta Sy 97 010 table C scale 2 0 dfu 1 33333333333 1 60000000000 1 14285714286 1 77777777777 table D scale 1 0 df 0 06250000000 0 03125000000 0 01562500000 0 00781250000 Concerning indentation label definitions MUST reside at the beginning of a line hash directives dot directives and comments MAY start at the beginning of a line CHAPTER 1 SENIOR ASSEMBLER 1 2 ASSEMBLER SOURCE FILE STRUCTURE and everything else MUST NOT start at the beg
15. typically used together with the skip directive see below to reserve larger sets of RAM memory For instance the following code rami table7 skip 12000 would reserve 12000 data words in data memory 1 for access with the label table7 The directive is valid until another memory space directive occurs 1 2 ASSEMBLER SOURCE FILE STRUCTURE CHAPTER 1 SENIOR ASSEMBLER Skip The skip directive increments the internal memory space pointer for the current mem ory space by the number of its one and only argument Skipping thus reserving that amount of memory This directive only makes sense in the ramO or the rami memory space align The align directive takes one positive number as its argument That argument will adjust the current memory space pointer to the next multiple of the argument number For instance if the current memory space pointer is at 1000 and the directive align 256 is set the memory space pointer would be adjusted to 1024 since 1024 is divisible by 256 If using align 4 nothing will happen since 1000 is already divisible by 4 alias The alias directive defines identifiers for already existing definitions of registers accu mulators other identifiers and such It takes two comma separated identifier arguments The first one must not be previously defined while the second one must be previously defined For instance the following alias sp ar3 would define the identifier sp to be the very same as t
16. xcept undefined identifiers and labels is translated to a hex format In the second pass all remaining identifiers and labels are translated if possible and inserted into the right place in the hex code In the third pass hex file output is generated provided there were no errors in the previous passes The hex file output is a text file for use with the Senior simulator only The following sections in this chapter will describe the use of the Senior assembler and the source file structure The Senior assembler instruction set is described in a separate document 1 1 Command line syntax The assembler command line uses the following syntax srasm infile outfile where srasm is the name of the Senior assembler program infile is the name of the assembler source file and outfile is the optional name of the output hex file If no name is given for the output hex file one will be generated using the name of the infile as the base with the extension hex added For instance if the infile is named test1 asm the outfile will be named test1 hex The output hex file will always be written in the same directory as the input source file unless a certain path is specified in the outfile parameter For instance running the command gt srasm testi asm out test01 Senior assembler Assembled successfully into out test01 will generate the file test01 without hex extension in the out directory provided it exists Running the command gt
17. zA Z0 9 This means they must start with a lowercase or uppercase letter from a to z or the underscore sign _ then followed by a mix of any number of 0 or more lowercase or uppercase letters a to z digits 0 to 9 or underscore signs For instance these are acceptable identifiers start1 data AC9_xy and these are not acceptable 7level track acer 1 2 4 Labels Labels are identifiers and must follow the rules as such see previous section Label definitions MUST reside at the beginning of a line and MUST NOT be followed by anything else for the remainder of the line except comments 1 2 ASSEMBLER SOURCE FILE STRUCTURE CHAPTER 1 SENIOR ASSEMBLER 1 2 5 Comments Comments may reside anywhere in the code A comment is initiated by the semicolon character and is active until the end of the line 1 2 6 Numbers Numbers can be either integer numbers or floating point numbers Integer numbers can be entered using the decimal hexadecimal or binary base Decimal number are entered just the way they are with an optional leading minus sign if it is a negative number Hexadecimal numbers are initiated using either Ox or and binary numbers start with For instance these are decimal numbers 17 32700 and these are hexadecimal numbers 0x3A7F 9001 and this is a binary number 410010110 Floating point numbers can be entered in a decimal form only using the syntax 0 9 0 9 that is starting with one or sev

Download Pdf Manuals

image

Related Search

Related Contents

Descargar Formulario  VIENNA - Shopify  Sprint Nextel SP7084 User's Manual  - S&S Cycle  Teknokroma Analítica S.A. Camí de can Calders 14, 08173  9 BOOKS / VIDEOS  

Copyright © All rights reserved.
Failed to retrieve file