ETPU Assembly Converter

2y ago
62 Views
2 Downloads
469.28 KB
10 Pages
Last View : 2m ago
Last Download : 2m ago
Upload by : Luis Waller
Transcription

Freescale SemiconductorDocument ID: ETPUASMCVTRRev. 0.1, 08/2010eTPU Assembly ConvertereTPU Assembly ConverterOverviewThe eTPU Assembly Converter is a tool that converts ByteCraft eTPU assembly language code to Freescale eTPUassembly language code. The tool can be used either toconvert instructions that are input manually or to convertentire .asm files, .c files, or directories of these files.The tool converts only assembly language instructions(either in .asm files or in inline assembly sections of .c files).With this tool, it is easy to convert files previously compiledusing the Byte Craft compiler to the new, FreescaleC compiler for the eTPU.1Command-Line OptionsThe following usage appears when running the converterwith the -h switch. A detailed explanation appears in the subsections below.etpu asm converter [-options] (-c file -a file -m -mc) Freescale Semiconductor, Inc., 2010. All rights reserved.1.2.3.4.5.ContentsCommand-Line Options . . . . . . . . . . . . . . . . . . . . . . .Convert Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Converter options . . . . . . . . . . . . . . . . . . . . . . . . . . . .Converter Operation . . . . . . . . . . . . . . . . . . . . . . . . . .Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12456

Convert ModeConvert Modes — exactly one of these flags must appear: -m: manual mode, converts assembly language instructions from stdin. -mc: manual mode, converts C language text from stdin. -c c file [out file]: converts all assembly language code in c file . -a asm file [out file]: converts the assembly language file asm file .Options — if used, these flags must appear before the convert mode flag: -nowarn: suppress warnings -h: display usage message -pp: preprocess. Replaces macros in assembly language sections before performing conversion.-debugE: debug errors. When this option is used, more information is printed if errors occur. Please notethis option was created for development purposes — the information refers to lex token names and is notalways helpful.2Convert ModeThe converter can run either in manual mode (-m, -mc) or in directory/file mode (-c, -a). In both modes,the converter can run in assembly mode (-a, -m) or c mode (-c, -mc).2.12.1.1Convert Mode — LanguageAssembly ModeIn assembly mode (-a, -m), the entire file (or manually inserted input) will be treated as Byte Craftassembly language and converted immediately.2.1.2C ModeIn c mode (-c, -mc), the entire file (or manually inserted input) will be treated as a C language file. Thefile is copied line-by-line and only the inline assembly language instructions are converted. Inlineassembly language instructions in Byte Craft begin with the #asm directive and end with #endasmdirective. One line inline assembly instructions in Byte Craft can also begin with the #asm directive andan open parenthesis and end with a closing parenthesis.2.22.2.1Convert Mode — Input TypeManual ModeIn manual mode (-m, -mc), the user inserts text manually to the standard input and the converter printsthe converted text to the standard output. This mode is useful for checking specific instructions. Noticethat the output is usually printed only after a full instruction has been analyzed (including the ending '.'character, which is essential in Byte Craft).eTPU Assembly Converter, Release 3.0, Rev. 0.1 Freescale Semiconductor, Inc., 2010. All rights reserved.2

Convert Mode2.2.2Directory/File ModeWhen the converter runs in directory/file mode (-a, -c), a specific file or directory must be specifiedimmediately after the -c or -a mode switch.If the argument after the mode switch is a directory, the converter converts all the files in the specifieddirectory that end with the .c extension (for mode switch -c) or the .asm extension (for mode switch-a). Each generated file will be named file name .converted.c or file name .converted.asm (depending on the current language mode).If the argument after the mode switch is a file name (as opposed to a directory name), the specified file isconverted. In this case, another argument may appear immediately after the file name that specifies thename to assign to the converted file. If this argument does not appear, the converted file is named file name .converted.c or file name .converted.asm, depending on the working languagemode.2.32.3.1ExamplesManual Assembly Modeetpu asm converter.exe -m- alu c b a.add c,b,a- ram p by diob.ld p,*diob2.3.2Manual C Modeetpu asm converter.exe -mc- /* All c information is copied line-by-line *//* All c information is copied line-by-line */- #asm (alu c c 1.)asm{ addi c,c,1 }- callExampleCFunc();callExampleCFunc();- #asmasm{- ram p (diob ).ld p,*diob - alu c b.move c,beTPU Assembly Converter, Release 3.0, Rev. 0.1 Freescale Semiconductor, Inc., 2010. All rights reserved.3

Converter options- #endasm}- callExampleCFunc();callExampleCFunc();2.3.3File Assembly Modeetpu asm converter.exe -a asm input.txtTable 1. File Assemble Mode2.3.4asm input.txt:asm input.txt.converted.asm:chan write mera; ram p - (diob).alu a a - p.alu p mach 0x0.erw1 ; st p,*diobsub a,a,paddi.shl p,mach,0x0File C Modeetpu asm converter.exe -c c input.c out.txtTable 2. File C Modec input.cout.txtmain() {asm{shli c,diob,2movei c,0x11// this is a note}callFunc()asm{ add c,b,a };}Main() {#asmalu c diob 2.alu c 17./* this is a note*/#endasmcallFunc()#asm ( alu c b a.);}33.1Converter options2.2.1 No WarningsWhen the -noWarn option is used, warnings are not reported. This option is useful when converting manyfiles and only the conversion errors are important. For more about warnings, see the Limitations section.3.2PreprocessingWhen the -pp option is used, the file is preprocessed before being converted. The preprocessing isexecuted using the ccetpu compiler. In the preprocessing stage, all the macros are analyzed and replacedwith their values. Only after preprocessing the file completes does conversion start. This option is usefuleTPU Assembly Converter, Release 3.0, Rev. 0.1 Freescale Semiconductor, Inc., 2010. All rights reserved.4

Converter Operationwith C language files that use macros in their inline assembly language sections. The converter does notrecognize these macros without preprocessing the file first; therefore the option is necessary in such cases.NOTEUsing the -pp option causes white space and new line modifications in thefile. Spaces and new lines may be added or removed during thepreprocessing stage, and macros are replaced with their values; however,the actual content of the file is not modified.When using this option, the input file is passed through the ccetpu Ccompiler. Therefore, this file must follow eTPU C language rules. Forexample, the file must end with the ".c" extension.Example of the -pp option:etpu asm converter.exe -pp -c c input.c out.txtTable 3. Preprocessing Optionsc input.cdef.hout.txt#include "def.h"#asmMY ALU c REG B VALUE.MY CHAN pdcm sm dt.#endasm#define MY ALUalu#define REG Bb#define VALUE3#define MY CHANchan#include "def.h"asm{addi c,b,3chmode.sm dt}3.3Debug InformationWhen the -debugE option is used, debug information is printed in the case of errors. This informationmay be useful in finding Byte Craft syntax errors. Note that this option was created for developmentpurposes; therefore, in many cases, the provided information may not be clear or helpful.This option is mostly useful for the chan instruction. For example:etpu asm converter.exe -m -debugEchan set flag2.error in line 3: syntax error, unexpected FREE TEXT, expecting FLAG0 or FLAG1.4Converter OperationThe eTPU assembly converter is given a file (or manually input data) as input and generates a new file,with all assembly language instructions converted from Byte Craft to Freescale assembly language. If theoriginal file compiled correctly according to the standard Byte Craft assembly language architecture, theasm converter should convert the file without error and produce a new, Freescale compile-ready file.eTPU Assembly Converter, Release 3.0, Rev. 0.1 Freescale Semiconductor, Inc., 2010. All rights reserved.5

Limitations4.1ContextThe converter is a context-independent tool. It analyzes each assembly language instruction separately andconverts it without reference to any other instructions. The only exception to this rule involves macros.The converter has the ability to preprocess C language files before converting them and therefore canrecognize macros in instructions even if the macros were defined elsewhere in the file (or outside the file).More information about this option in available in the command-line section.4.2Error HandlingWhen the converter encounters an unrecognized instruction, it reports an error along with the line numberof the problematic instruction. Since the converter is context independent, it can continue convertinginstructions immediately after the error. Therefore, when the converter finishes, it is only necessary tomanually fix the reported error; there is no need to convert the whole file again.In addition, during conversion, the converter may report warnings. In these cases, the converter is able toconvert the specified instruction, but there a chance that the conversion was not perfect. See theLimitations section for more information.4.3VariablesIn C language files, variables may appear in inline assembly language instructions. The converter does notrecognize these variables (since it is context independent). In order to handle variables in inline assemblylanguage, the converter copies any text that appears in assembly language operands where variables are anoption. It is the user’s responsibility to verify that this text refers to a real variable. If no such variableexists, the compiler reports an error when it compiles the converted file.4.4Parallel InstructionsThe eTPU assembly converter supports parallel instructions. The sub-instructions in parallel instructionsare separated by semicolons in Byte Craft assembly language.5LimitationsThis section lists possible limitations to the eTPU assembly converter.5.1Complex expressionsThe converter does not analyze complex expressions (for example, alu c 3 6-1 2); instead, theconverter copies them as is. (In the example above, the converted text is: movei c,3 6-1 2). Thisapproach should deal correctly with most expressions, but some complex expressions may cause issueswhen converted.eTPU Assembly Converter, Release 3.0, Rev. 0.1 Freescale Semiconductor, Inc., 2010. All rights reserved.6

Limitations5.2Negative NumbersThe Byte Craft approach to negative numbers is not consistent: They are treated as 8-bit variables in somecases, as 24-bit variables in some cases, ignored in some cases, and not allowed in other cases. Therefore,the conversion of these numbers is also not completely consistent.5.3MacrosMacros in inline assembly language are supported, but the -pp switch must be used for them to beconverted correctly. See the command-line section for more information.5.4Byte Craft ErrorsIn certain cases, the Byte Craft compiler does not create code in consistent fashion and according to itsown documentation. In these cases, the eTPU assembly converter “fixes” Byte Craft's errors. This solutionensures that the converted Freescale assembly language instruction matches Byte Craft's originalinstruction; however, in contrast to most cases, the generated binary code of the original instruction andthe converted instruction are different (because Byte Craft's instruction does not generate the expectedcode).For example:The instruction "alu c b a 1." generates the binary code 0x3D330F95 when assembled by theByte Craft compiler, even though the meaning of this code is to shift b a 1 left instead of right. (Thisseems like a Byte Craft error.) The eTPU assembly converter converts this instruction to "add.shr.onec,b,a". As a result, the Freescale and Byte Crafts instructions match — their syntax has the samemeaning — but the code each instruction generates is different, since the converted instruction shiftsb a 1 right, while Byte Craft's original instruction shifts them left.5.5Unsupported featuresAll Byte Craft directives besides %hex are not supported. Local Byte Craft labels are not supported either.5.6Parallel InstructionsThe converter supports parallel instructions. However, there are certain rare parallel instructions that aresupported in Byte Craft but not by the Freescale assembler. The Byte Craft compiler supports jmp andend sub-instructions as part of the same parallel instruction, but the Freescale compiler does not supportsuch a combination since both jmp and end change the program flow. If the original code contains sucha parallel instruction, it will be converted without error, but the assembler will report an error when theconverted instruction is assembled.eTPU Assembly Converter, Release 3.0, Rev. 0.1 Freescale Semiconductor, Inc., 2010. All rights reserved.7

Limitations5.75.7.1Warningsld/ldmWhen loading variables that are allocated on the channel, the ldm operator should be used, and whenloading global variables, the ld operator should be used. The converter does not distinguish between thesevariables and therefore always uses the ldm operator when converting instructions that load C variables.In such cases, this warning is printed: "Instruction has been converted by default toldm but might be ld depending on the label's value".5.7.2Hex DirectivesThe converter supports hex directives that begin with %hex in Byte Craft assembly language; they areconverted to .word directives in Freescale assembly language. However, a warning is still printed whenthese directives appear because the converter does not analyze their meaning. Since there is usually areason that the original instructions appears in hex instead of in Byte Craft assembly language, it isrecommended to review the converted directive and possibly rewrite the instruction in Freescale assemblylanguage.eTPU Assembly Converter, Release 3.0, Rev. 0.1 Freescale Semiconductor, Inc., 2010. All rights reserved.8

LimitationseTPU Assembly Converter, Release 3.0, Rev. 0.1 Freescale Semiconductor, Inc., 2010. All rights reserved.9

How to Reach Us:Home SA/Europe or Locations Not Listed:Freescale SemiconductorTechnical Information Center, CH3701300 N. Alma School RoadChandler, Arizona 85224(800) 521-6274480-768-2130support@freescale.comEurope, Middle East, and Africa:Freescale Halbleiter Deutschland GmbHTechnical Information CenterSchatzbogen 781829 Muenchen, Germany 44 1296 380 456 (English) 46 8 52200080 (English) 49 89 92103 559 (German) 33 1 69 35 48 48 (French)support@freescale.comInformation in this document is provided solely to enable system and softwareimplementers to use Freescale Semiconductor products. There are no express orimplied copyright licenses granted hereunder to design or fabricate any integratedcircuits or integrated circuits based on the information in this document.Freescale Semiconductor reserves the right to make changes without further notice toany products herein. Freescale Semiconductor makes no warranty, representation orguarantee regarding the suitability of its products for any particular purpose, nor doesFreescale Semiconductor assume any liability arising out of the application or use ofany product or circuit, and specifically disclaims any and all liability, including withoutlimitation consequential or incidental damages. “Typical” parameters which may beprovided in Freescale Semiconductor data sheets and/or specifications can and dovary in different applications and actual performance may vary over time. All operatingJapan:Freescale Semiconductor Japan Ltd.HeadquartersARCO Tower 15F1-8-1, Shimo-Meguro, Meguro-kuTokyo 153-0064, Japan0120 191014 81 2666 8080support.japan@freescale.comparameters, including “Typicals” must be validated for each customer application byAsia/Pacific:Freescale Semiconductor Hong Kong Ltd.Technical Information Center2 Dai King StreetTai Po Industrial Estate,Tai Po, N.T., Hong Kong 800 2666 8080support.asia@freescale.compurchase or use Freescale Semiconductor products for any such unintended orFor Literature Requests Only:Freescale SemiconductorLiterature Distribution CenterP.O. Box 5405Denver, Colorado 80217(800) 441-2447303-675-2140Fax: oup.comETPUASMCVTRRev. 0.108/2010customer’s technical experts. Freescale Semiconductor does not convey any licenseunder its patent rights nor the rights of others. Freescale Semiconductor products arenot designed, intended, or authorized for use as components in systems intended forsurgical implant into the body, or other applications intended to support or sustain life,or for any other application in which the failure of the Freescale Semiconductor productcould create a situation where personal injury or death may occur. Should Buyerunauthorized application, Buyer shall indemnify and hold Freescale Semiconductorand its officers, employees, subsidiaries, affiliates, and distributors harmless against allclaims, costs, damages, and expenses, and reasonable attorney fees arising out of,directly or indirectly, any claim of personal injury or death associated with suchunintended or unauthorized use, even if such claim alleges that FreescaleSemiconductor was negligent regarding the design or manufacture of the part.Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc.All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc., 2010.

entire .asm files, .c files, or directories of these files. The tool converts only assembly language instructions (either in .asm files or in inline assembly sections of .c files). With this tool, it is easy to convert files previously com

Related Documents:

There are mainly four types dc-dc converters: buck converter, boost converter, buck-boost converter, and flyback converter. The function of buck converter is to step down the input voltage. The function of boost converter, on the other hand, is to step up the input voltage. The function of buck-boost combines the functions of both buck converter

Keywords: Converter, Boost Converter, Back to Back Converter, Fly-back Converter, Indirect Matrix Converter. I. INTRODUCTION One of the most commonly applied converters in hybrid systems is the AC/DC/AC converter because it has the ability to connect

Fig. 1. Conventional dual-output SC DC-DC converter. 2. Circuit Configuration 2.1 Conventional Converter Figure 1 shows an example of the conventional multi-output SC converter. The converter of figure 1 is based on the serial fix type converter(6) proposed by Suzuki et al. The conventional converter consists of six transistor

The battery is connected to a DC-DC converter (Buck/Boost converter). The DC-DC converter operates as a Buck or Boost converter to charge or discharge the Battery. The DC-DC converter connects to the DC- AC converter via a DC Link system of 3900 micro F capacitors. The DC-AC converter controls the DC voltage (V_dc) on the DC Link.

received the qualification affirmative. 8. Fix Breakdown 1. Power indicating light and fan don't work, no output to d o welding. 1. Power switch is broken. 2 .C of irm wh etpu s cd lv 3 .C nf i rmwh etpu sb k 2. Power indicating light is on, the fan can't turn, or stop turning after second turning. No output to do welding. 1.

data converter architectures is included in Chapter 3 (Data Converter Architectures) along with the individual converter architectural descriptions. Likewise, Chapter 4 (Data Converter Process Technology) includes most of the key events related to data converter process technology. Chapter 5 (Testing Data Converters) touches on some of the key

Converter Standalone agent from the source machine automatically or manually after the import is complete. Converter Standalone client The Converter Standalone server works with the Converter Standalone client. The client component consists of the Converter Standalone user interface, which provides access to the Conversion and the Configuration

ASTM A312 /A312M ASME SA312 Covers seamless, straight-seam welded, and heavily cold worked welded austenitic stainless-steel pipe intended for high-temperature and general corrosive service. ASTM A312 /A312M ASME SA312 Grades TP304, TP304L, TP304H, TP309S, TP309H, TP310S, TP310H, TP316, TP316L, TP316H, TP317, TP317L, TP321, TP321H, TP347, TP347H, TP348, TP348H Standard: ASTM A312/A312M .