Shop OBEX P1 Docs P2 Docs Learn Events
9-bit literal to 32-bit value extension — Parallax Forums

9-bit literal to 32-bit value extension

jontyjonty Posts: 3
edited 2006-12-21 21:58 in Propeller 1
Here's a question for those who really know the fine details of assembler programming on the Propeller:

When an instruction uses a 9-bit literal value in the s field and the instruction operates on a 32-bit value then is the 9-bit literal always zero extended before it is used by the instruction?

The manual V1.01 explicitly says that ABS and ABSNEG both zero extend. But is this a general rule for all arithmetic and logical operations like ADD, SUB, AND etc?

For example, does ANDN take a 9-bit literal, zero extend it to 32-bits, negate (so that the top 23 bits are now all 1's), then bitwise AND with d?

Thanks in advance
Jonty

Post Edited (jonty) : 12/21/2006 9:24:49 PM GMT

Comments

  • cgraceycgracey Posts: 14,206
    edited 2006-12-21 21:49
    jonty said...


    When an instruction uses a 9-bit literal value in the s field and the instruction operates on a 32-bit value then is the 9-bit literal always zero extended before it is used by the instruction?


    YES

    The manual V1.01 explicitly says that ABS and ABSNEG both zero extend. But is this a general rule for all arithmetic and logical operations like ADD, SUB, AND etc?

    Just imagine that instead of using an S register, you are using a nine-bit literal that is zero-extended. What the instruction does to the value is constant, regardless of whether it was from a register or a nine-bit zero-extended literal.

    For example, does ANDN take a 9-bit literal, zero extend it to 32-bits, negate (so that the top 23 bits are now all 1's), then bitwise AND with d?



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • jontyjonty Posts: 3
    edited 2006-12-21 21:58
    Thanks very much for the quick reply. Answered my question very nicely.

    jonty
Sign In or Register to comment.