User Tools

Site Tools


dev:atomic_parameters

This is an old revision of the document!


Atomic Parameters

This tutorial describes the current procedure for adding a parameter to an Atom. This is used when an Atom needs to use its bits for some kind of information.

Declare Compilation Constants

First, we need to describe in the Element how big of a field we want to use, and where to place it inside the atom. We need to use the bits on the right hand part of the atom first, since a number of ones on the left hand side are already used. For instance, let's declare a small field storing a random byte:

enum
{
    BITS = P::BITS_PER_ATOM,
    
    RANDOM_BITS_LENGTH = 8,
    RANDOM_BITS_POSITION = BITS - RANDOM_BITS_LENGTH - 1
}

These constants are then used to describe a BitField, like so:

typedef BitField<BitVector<BITS>, RANDOM_BITS_LENGTH, RANDOM_BITS_POSITION> AFRandomBits;
dev/atomic_parameters.1410288156.txt.gz · Last modified: 2014/09/09 18:42 by tsmall1