Re: general opcode question
- From: "robertwessel2@xxxxxxxxx" <spamtrap@xxxxxxxxxx>
- Date: Fri, 12 Aug 2005 21:34:45 +0000 (UTC)
Christian Christmann wrote:
> Hi,
>
> I'm a newbie to assembler and have a basic question on opcodes.
>
> Currently I am working with the Infineon Tricore DSP. In the manual the
> MOV instruction is described as follows:
>
> "Move the content of const16 to data register D[c]. The value const16 is
> sign-extended to 32-bits before it is moved."
>
> Further there is a figure:
>
> 31--2827---------------1211----- 87-----------0
> ----c--------const16---------- - --------3BH---
>
> D[c]= sign_ext(const16);
>
>
>
> My questions:
> 1) How can you move a 16-bit constant (bits 27-12) to a 4-bit register
> D[c] (bits31-28). Or are bits 31-28 representing the address ( one of the
> 16 possible due to 2 ^4) of register D[c] ? 2) What does "sign-extended to
> 32-bits" mean? What exactly happens to the 16-bit value const16?
While this is OT to this group (x86 is topical), the question is pretty
basic. First, the four bit register field encodes the register number,
so if it had 1001 in it, you'd be moving to register 9 (nine). Sign
extension is simply the extension of the sign bit to the left when
converting from a shorter format to a longer one. On a twos complement
machine, your 16 bit representation of the number 37 would be
0000-0000-0010-0101. The leftmost with would get replicated 16 times
when you attempted to store that value in a 32 bit register, thus
preserving the value "37". If you had 1111-1111-1101-1011 (-37) in the
constant, that would extend the "1" sign bit, preserving the value
"-37". It's a trade off. If the instruction did zero extension, you
could load values from 0 to 65535, with sign extension, you can load
-32768 thru 32767, which would typically be considered a more useful
range.
.
- References:
- general opcode question
- From: Christian Christmann
- general opcode question
- Prev by Date: Re: Replacing SSE2 instructions with another instruction set in a executable
- Next by Date: Re: Replacing SSE2 instructions with another instruction set in a executable
- Previous by thread: general opcode question
- Next by thread: Replacing SSE2 instructions with another instruction set in a executable
- Index(es):
Relevant Pages
|