Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This document intends to shed some light on the way binary variables are handled in the 6K programming language. Binary variables follow three basic rules:

  • Math operations (i.e. + , - , * , / , = , etc.) treat binary variables as 32 bit numbers. This means that all 32 bits are affected by any math operation done to a binary variable. See the truth table below for examples.

    NOTE: This means that bits previously set as a "don't care" ('X') will get set to a 1 or a 0 as appropriate to the math operation result.

  • Logical operations (i.e. & , | , <> , etc.) treat binary variables as 32 bits. This means that the operation is done bit-wise (bit by bit and only on the bits specified by the operation). See the truth table below for examples.

    NOTE: The 6K language will not make assumptions about any "don't care" ('X') bits contained within the binary variable. If the operation's result cannot be determined because of a "don't care" bit, the result will be a "don't care".

    Two examples are:

    VARB1=B1
    VARB2=BX
    VARB3=VARB1|VARB2
    VARB3 ends up with a 1 as the first bit.
    In the first example, the 6K knows that since VARB1=B1 the OR operation will be TRUE = 1.

    VARB1=B1
    VARB2=BX
    VARB3=VARB1&VARB2
    VARB3 ends up with an X as the first bit.
    In the second example, the 6K does not have enough information to evaluate it so the result is an X.

  • Conditionals will always evaluate a "don't care" bit ('X') as true. Three examples are:

    VARB1=B1
    IF(VARB1=BX) will always evaluate as TRUE.

    VARB1=BX
    IF(VARB1=B1) will also always evaluate as TRUE since you are comparing a 1 against a don't care.

    VARB1=B11
    IF(VARB1=BX0) will evaluate as FALSE. The first bit evaluated as TRUE but the comparison of the second bit evaluated as FALSE. Multiple bit comparisons are ANDed.

VARB1

VARB2

Operation

Result

0

0

+ (add)

0000_0000_0000_0000_0000_0000_0000_0000

0

0

  • (subtract)

0000_0000_0000_0000_0000_0000_0000_0000

0

0

| (OR)

0XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

0

0

& (AND)

0XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

0

1

+ (add)

1000_0000_0000_0000_0000_0000_0000_0000

0

1

  • (subtract)

1111_1111_1111_1111_1111_1111_1111_1111

0

1

| (OR)

1XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

0

1

& (AND)

0XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

1

0

+ (add)

1000_0000_0000_0000_0000_0000_0000_0000

1

0

  • (subtract)

1000_0000_0000_0000_0000_0000_0000_0000

1

0

| (OR)

1XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

1

0

& (AND)

0XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

1

1

+ (add)

0100_0000_0000_0000_0000_0000_0000_0000

1

1

  • (subtract)

0000_0000_0000_0000_0000_0000_0000_0000

1

1

| (OR)

1XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

1

1

& (AND)

1XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

0

X

+ (add)

0000_0000_0000_0000_0000_0000_0000_0000

0

X

  • (subtract)

0000_0000_0000_0000_0000_0000_0000_0000

0

X

| (OR)

XXXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

0

X

& (AND)

0XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

X

0

+ (add)

0000_0000_0000_0000_0000_0000_0000_0000

X

0

  • (subtract)

0000_0000_0000_0000_0000_0000_0000_0000

X

0

| (OR)

XXXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

X

0

& (AND)

0XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

1

X

+ (add)

1000_0000_0000_0000_0000_0000_0000_0000

1

X

  • (subtract)

1000_0000_0000_0000_0000_0000_0000_0000

1

X

| (OR)

1XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

1

X

& (AND)

XXXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

X

1

+ (add)

1000_0000_0000_0000_0000_0000_0000_0000

X

1

  • (subtract)

1111_1111_1111_1111_1111_1111_1111_1111

X

1

| (OR)

1XXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

X

1

& (AND)

XXXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

X

X

+ (add)

0000_0000_0000_0000_0000_0000_0000_0000

X

X

  • (subtract)

0000_0000_0000_0000_0000_0000_0000_0000

X

X

| (OR)

XXXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

X

X

& (AND)

XXXX_XXXX_XXXX_XXXX_ XXXX_XXXX_XXXX_XXXX

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.