SpiNNFrontEndCommon 7.1.1
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
filter_info.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 The University of Manchester
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
20#ifndef __FILTER_INFO_H__
21#define __FILTER_INFO_H__
22
23#include <bit_field.h>
24
26typedef struct filter_info_t {
28 uint32_t key;
30 uint32_t merged: 1;
32 uint32_t all_ones: 1;
34 uint32_t n_atoms: 30;
36 uint32_t core_shift: 5;
38 uint32_t n_atoms_per_core:27;
42
50
52struct core_atom {
53 uint32_t core;
54 uint32_t atom;
55};
56
60static inline void next_core_atom(filter_info_t *filter, struct core_atom *core_atom) {
61 core_atom->atom++;
62 // If n_atoms_per_core is 0 (i.e. disabled) this will never match, so the
63 // atom will be global
64 if (core_atom->atom == filter->n_atoms_per_core) {
65 core_atom->core++;
66 core_atom->atom = 0;
67 }
68}
69
74static inline uint32_t get_bf_key(filter_info_t *filter, struct core_atom *core_atom) {
75 // Note if n_atoms_per_core is 0, core will be 0, and atom will just be the
76 // global atom
77 return filter->key + (core_atom->core << filter->core_shift) + core_atom->atom;
78}
79
84static inline uint32_t global_atom(filter_info_t *filter, struct core_atom *core_atom) {
85 return (filter->n_atoms_per_core * core_atom->core) + core_atom->atom;
86}
87
88#endif // __FILTER_INFO_H__
uint32_t * bit_field_t
uint32_t merged
Flag to indicate if the filter has been merged.
Definition filter_info.h:30
static uint32_t global_atom(filter_info_t *filter, struct core_atom *core_atom)
Get the global atom from the core-atom data.
Definition filter_info.h:84
filter_info_t filters[]
The filters themselves, ordered by key.
Definition filter_info.h:48
uint32_t all_ones
Flag to indicate if the filter is redundant.
Definition filter_info.h:32
uint32_t core_shift
The shift to apply to the core to add the core to the key (0-31)
Definition filter_info.h:36
static void next_core_atom(filter_info_t *filter, struct core_atom *core_atom)
Move to the next atom, updating the core as needed.
Definition filter_info.h:60
bit_field_t data
The words of the bitfield.
Definition filter_info.h:40
uint32_t n_filters
Total number of filters.
Definition filter_info.h:46
static uint32_t get_bf_key(filter_info_t *filter, struct core_atom *core_atom)
Get the key for a given core-atom pair.
Definition filter_info.h:74
uint32_t key
Bit field master population key.
Definition filter_info.h:28
uint32_t n_atoms
Number of atoms (=valid bits) in the bitfield.
Definition filter_info.h:34
uint32_t n_atoms_per_core
The number of atoms per core (0 if not used)
Definition filter_info.h:38
A core and an atom for counting.
Definition filter_info.h:52
Describes a single filter, which is a wrapper for bit_field_t.
Definition filter_info.h:26
The contents of the bitfield region in SDRAM.
Definition filter_info.h:44