spinn_common 7.3.1
Support code for SpiNNaker applications.
Loading...
Searching...
No Matches
Macros | Functions
bit_field.c File Reference

Bit field manipulation. More...

#include "bit_field.h"
#include "sark.h"

Macros

#define __use(x)   ((void) (x))
 The use macro allows us to "pretend" to use a variable in a function; this is useful if we run with -Wextra set for extra warnings.
 

Functions

static void print_bit_field_entry (uint32_t e)
 This function prints out an individual word of a bit_field, as a sequence of ones and zeros.
 
void print_bit_field_bits (const bit_field_t restrict b, size_t s)
 This function prints out an entire bit_field, as a sequence of ones and zeros.
 
void print_bit_field (const bit_field_t restrict b, size_t s)
 This function prints out an entire bit_field, as a sequence of hexadecimal numbers, one per line.
 
void random_bit_field (bit_field_t restrict b, size_t s)
 Generates a random bit_field for testing purposes.
 
bit_field_t bit_field_alloc (uint32_t n_atoms)
 allocates a bit_field_t object
 

Detailed Description

Bit field manipulation.

A bit field is a vector of machine words which is treated as a vector of bits.

For SpiNNaker each machine word is 32 bits, and so a bit_field for each neuron (assuming 256 neurons) would be 8 words long.

The API includes:

There are also support functions for:

Author
Dave Lester (david.nosp@m..r.l.nosp@m.ester.nosp@m.@man.nosp@m.chest.nosp@m.er.a.nosp@m.c.uk), Jamie Knight (knigh.nosp@m.tj@c.nosp@m.s.man.nosp@m..ac..nosp@m.uk)
Date
12 December, 2013

Macro Definition Documentation

◆ __use

#define __use (   x)    ((void) (x))

The use macro allows us to "pretend" to use a variable in a function; this is useful if we run with -Wextra set for extra warnings.

Parameters
xThe name of the argument to mark as used

Function Documentation

◆ print_bit_field_entry()

static void print_bit_field_entry ( uint32_t  e)
inlinestatic

This function prints out an individual word of a bit_field, as a sequence of ones and zeros.

Parameters
[in]eThe word of a bit_field to be printed.

◆ print_bit_field_bits()

void print_bit_field_bits ( const bit_field_t restrict  b,
size_t  s 
)

This function prints out an entire bit_field, as a sequence of ones and zeros.

Parameters
[in]bThe sequence of words representing a bit_field.
[in]sThe size of the bit_field.

◆ print_bit_field()

void print_bit_field ( const bit_field_t restrict  b,
size_t  s 
)

This function prints out an entire bit_field, as a sequence of hexadecimal numbers, one per line.

Parameters
[in]bThe sequence of words representing a bit_field.
[in]sThe size of the bit_field.

◆ random_bit_field()

void random_bit_field ( bit_field_t restrict  b,
size_t  s 
)

Generates a random bit_field for testing purposes.

Parameters
[in]bThe sequence of words representing a bit_field.
[in]sThe size of the bit_field.

◆ bit_field_alloc()

bit_field_t bit_field_alloc ( uint32_t  n_atoms)

allocates a bit_field_t object

Parameters
[in]n_atomsthe number of atoms to cover with this bitfield
Returns
the allocated bitfield