Você está na página 1de 5

Embedded Programs

Embedded system programs are translated in a Machine Language. This language enables the
instruction to communicate with other devices.
Machine translation can use a method based on linguistic rules, which means that words will be
translated in a linguistic way the most suitable (orally speaking) words of the target language
will replace the ones in the source language.
It is often argued that the success of machine translation requires the problem of natural language
understanding to be solved first.
Generally, rule-based
based methods parse a text, usually creating an intermediary, symbolic
representation, from which the text in the target language is generated. According to the nature
of the intermediary representation, an approach is described as interlingual machine
translation or transfer-based
based
machine
translation.
These
methods
require
extensive lexicons with morphological, syntactic, and semantic information, and large sets of
rules, all of which are parts of the brain's Universal grammar.
Given enough data, machine translation programs often work well enough for a native speaker of
one language to get the approximate meaning of what is written by the other native speaker. The
difficulty is getting enough data of the right kind to support the particular method. For example,
the large multilingual corpus of data needed for statistical methods to work is not necessary for
the grammar-based
based methods. But then, the grammar methods need a skilled linguist to carefully
design the grammar that
hat they use.
To translate between closely related languages, a technique referred to as Transfer-based
machine translation may be used.

Bernard Vauquois' pyramid showing comparative depths of intermediary representation, interlingual machine translation at the peak, followed
by transfer-based, then direct translation.

Prepared by: Dr. Vinyl Ho Oquino

Machine code or machine language is the name for commands. They can directly be executed
by a processor. Usually, they are 1s and 0s. Their order tells the computer what to do. This code
is the lowest level of software. All other kinds of software need to be translated into machine
code before they can be used.
Each processor has its own machine code.
Each instruction is made up of an opcode (operation code) and operand(s). An instruction tells
the computer to do one thing. The operands are usually memory addresses. An instruction set is a
list of the opcodes used in a computer. Machine code is what assemble code. Other programming
languages are compiled to or interpreted as.
Program builders turn code into another language or machine code. Machine code is sometimes
called native code. This is used when talking about things that work on only some computers
Machine code usually offers many kinds of instructions:

Arithmetical operations: Addition, subtraction, multiplication, division.

Logical operations: Conjunction, disjunction, negation.

Operations acting on single bits: Shift left, shift right.

Operations acting on memory: copy a value from one register to another.

Operations that compare two values: bigger than, smaller than, equal.

Operations that combine other operations: add, compare, and copy if equal to some
value(as one operation), jump to some point in the program if a register is zero.

Operations that act on program flow: jump to some address.

Operations that convert data types: e.g. convert a 32-bit integer to a 64-bit integer,
convert a floating point value to an integer (by truncating).

Many modern processors use microcode for some of the commands. More complex commands
tend to use it. This is often done with CISC architectures.
Every processor or processor family has its own machine code instruction set. They correspond
to the different commands that can be given. An instruction set is specific to a processor or a
family of processors that have a similar set up. Newer processors often copy all of its
instructions. Processors that try to be similar to the original processor can also copy all of its
instructions. Often, newer processors add more instructions not present in the original design.
Sometimes a newer processor will change the meaning of an instruction. Sometimes it will no
longer support it. This can change the compatibility of the code. Some old code will no longer

Prepared by: Dr. Vinyl Ho Oquino

work on the newer processor. Processors that are similar will sometime act different. This is
rarely a problem. Many systems may also be different in other ways. Their access to the memory
or its arrangement may be different. Computer hardware may be connected in a different way.
Also, the access to other hardware could be changed. A program normally relies on such factors.
For this reason, different systems will typically not run the same machine code. This is true even
when the same type of processor is used.
Most instructions have one or more opcode fields. They specify the basic instruction type. Other
fields may give the type of the operands, the addressing mode, and so on. There may also be
special instructions. They are contained in the opcode itself. These instructions are
called immediates.
Processor designs can be different in other ways. Different instructions can have different
lengths. Also, they can have the same length. Having all instructions have the same length can
simplify the design.
An assembly language is a programming language that can be used to directly tell the computer
what to do. An assembly language is almost exactly like the machine language that a computer
can understand, except that it uses words in place of numbers. A computer cannot really
understand an assembly program directly. However, it can easily change the program
into machine code by replacing the words of the program with the numbers that they stand for. A
program that does that is called an assembler.
Programs written in assembly language are usually made of instructions, which are small tasks
that the computer performs when it is running the program. They are called instructions because
the programmer uses them to instruct the computer what to do. The part of the computer that
follows the instructions is the processor.
The assembly language of a computer is a low-level language, which means that it can only be
used to do the simple tasks that a computer can understand directly. In order to perform more
complex tasks, one must tell the computer each of the simple tasks that are part of the complex
task. For example, a computer does not understand how to print a sentence on its screen. Instead,
a program written in assembly must tell it how to do all of the small steps that are involved in
printing the sentence.

Assembler
An assembler translates assembly language into machine code. Assembly language consists of
mnemonics for machine opcodes so assemblers perform a 1:1 translation from mnemonic to a
direct instruction. For example:
LDA #4 converts to 0001001000100100
Prepared by: Dr. Vinyl Ho Oquino

Conversely, one instruction in a high level language will translate to one or more instructions at
machine level.
Advantages of using an Assembler:

Very fast in translating assembly language to machine code as 1 to 1 relationship


Assembly code is often very efficient (and therefore fast) because it is a low level
language
Assembly code is fairly easy to understand due to the use of English-like mnemonics

Disadvantages of using Assembler:


Assembly language is written for a certain instruction set and/or processor
Assembly tends to be optimised for the hardware it's designed for, meaning it is often
incompatible with different hardware
Lots of assembly code is needed to do relatively simple tasks, and complex programs
require lots of programming time
Compiler
A Compiler is a computer program that translates code written in a high level language to a
lower level language, object/machine code. The most common reason for translating source code
is to create an executable program (converting from a high level language into machine
language).
Advantages of using a compiler

Source code is not included; therefore compiled code is more secure than interpreted
code
Tends to produce faster code than interpreting source code
Produces an executable file, and therefore the program can be run without need of the
source code

Disadvantages of using a compiler


Object code needs to be produced before a final executable file, this can be a slow
process
The source code must be 100% correct for the executable file to be produced
Interpreter
An interpreter program executes other programs directly, running through program code and
executing it line-by-line. As it analyses every line, an interpreter is slower than running compiled
code but it can take less time to interpret program code than to compile and then run it this is
very useful when prototyping and testing code. Interpreters are written for multiple platforms,
this means code written once can be run immediately on different systems without having to
Prepared by: Dr. Vinyl Ho Oquino

recompile for each. Examples of this include flash based web programs that will run on your PC,
MAC, games console and Mobile phone.
Advantages of using an Interpreter

Easier to debug (check errors) than a compiler


Easier to create multi-platform code, as each different platform would have an interpreter
to run the same code
Useful for prototyping software and testing basic program logic

Disadvantages of using an Interpreter


Source code is required for the program to be executed, and this source code can be read
making it insecure
Interpreters are generally slower than compiled programs due to the per-line translation
method

Prepared by: Dr. Vinyl Ho Oquino

Você também pode gostar