Domains

From Mill Computing Wiki
Jump to: navigation, search

Domains are the different kinds of scalar values the different Mill operations can work with. What this really means is, A value on the belt is just a value on the belt, it is just bits. The Metadata determines how many bits and whether they are arranged in vectors or not, but how exactly those bits are interpreted is up to the different operations. And as such the different operations tend to fall into different categories called domain. Some operations don't care at all what kind of values they are dealing with, they just move them around, but anything that produces new bit patterns based on old ones does have a domain it interprets the bitpatterns as.
Most of the domains are indicated in the opcode mnemonic of the operation via suffix.

Byte Widths for Different Domains
op u s p f d uf sf i n sel pred
1-16 1-16 1-16 8 4-16 8-16 1-16 1-16 1 1 1 1

Domains

Logical

The logical domain is the default domain in a sense in that it is not indicated by any operation suffix. It treats bits just as bits, and a whole slew of booloan and logical operations work on pure bits. Also quite a few signed and unsigned integer operations alias to the logical domain when they have modulo/wraparound overflow behavior. In the documentation pages for the operations operands that are interpreted as logical bits are presented as an op type. This is also the case for operations that don't really change the bit patterns but just move them around in some way.

u - Unsigned Integer

Most of the unsigned integer arithmetic with modulo overflow behavior aliases to the logical domain hardware.

s - Signed Integer

Most of the signed integer arithmetic with modulo overflow behavior aliases to the logical domain hardware, too.

p - Pointers

Pointers are always 64bit, and the upper 4 bits are ignored in pointer arithmetic because they are reserved for special purposes, like triggering traps for garbage collection. More under Virtual Addresses.

f - Floating Point

This is IEEE 754 binary floating points. Available as 32, 64 and 128 bits. The narrowf operation can produce 16bit floats, and the widenf operation can use them as an operand to produce 32bit floats, but this is a are pure interchange format to be loaded and stored, and no arithmetic is available on it.

d - Decimal Floating Point

IEEE 754 decimal floating points. Available as 64 and 128 bits. On most Cores this is emulated. The narrowd operation can produce 32bit decimal floats, and the widenf operation can use them as an operand to produce 64bit decimal floats, but this is a are pure interchange format to be loaded and stored, and no arithmetics are available on it.

sf - Signed Fixed Point

Generally fixed point arithmetic is the same as integer arithmetic, except for shifts and multiplication and widening and narrowing.

uf - Unsigned Fixed Point

The same goes for unsigned fixed point arithmetic.



Pseudo Domains

There are also some operands to some operations that get interpreted in a special way without applying to the whole operation. Those are not truly full fledged domains and aren't part of the mnemonics but are listed here anyway. Generally they take the width of the other operands in the operation, but only the lowest few bits or even just the lowest bit matter.

i - Vector Index

Some operations build and take apart vector operands and index the vector elements. The values can be any width actually, but if the index exceeds the vector element count, NaRs happen.

n - Bit Count

Shifts and bit tests and similar operations move or index bits within a value. If the n value is bigger than the width of the other operand, NaRs happen here as well.

sel - Selector

The pick and recur operations select values based on a select predicate where only the lowest bit is evaluated.

pred - Predicate

The conditional branches also have to make choices, those predicates really require 0 or 1 values though and don't just evaluate the lowest bit.