Commit graph

6 commits

Author SHA1 Message Date
Martin Braun
7ca952d914 rfnoc: Always retain order of properties
When resolving properties, it is important to retain the order of
properties. In this patch, this is achieved by changing prop_ptrs_t from
being an unordered_set into a vector.

The biggest effect is that node_t::filter_props() now returns filtered
properties in the order they were added.

Resolving properties in the order they were added, and not in any random
order, is very helpful when designing property resolvers. For the MTU
property, however, it is almost always a requirement. That's because the
the MTU property is added first (via noc_block_base), but also, its
resolution already assumes execution of resolvers in a certain order
(see the long comment towards the end of
noc_block_base::noc_block_base()). Execution of resolvers in a certain
order can only be guaranteed if properties are also in a certain order.

A particular issue this resolves is the ability to have properties that
both depend on atomic_item_size and the MTU. Because blocks have no way
of reading the current MTU other than calling
`noc_block_base::get_mtu()`, resolvers requiring access to the MTU
assume that the MTU properties are always resolved first.

The majority of this patch revolves around syntactical differences
between std::vector and std::unordered_set, like using `push_back()`
instead of `insert()` for adding to `prop_ptrs_t`.
2022-06-14 05:24:58 -07:00
Martin Braun
107a49c0c2 host: Update code base using clang-tidy
The checks from the new clang-tidy file are applied to the source tree
using:

$ find . -name "*.cpp" | sort -u | xargs \
    --max-procs 8 --max-args 1 clang-tidy --format-style=file \
    --fix -p /path/to/compile_commands.json
2021-03-04 08:07:26 -06:00
Aaron Rossetto
a5fe0b071d rfnoc: Support instance overrides in set_properties()
This commit adds an enhancement to node_t::set_properties() in which
the instance argument provided to the function (which normally applies
to all properties in the key/value list) can be overridden on a
per-property basis using a special syntax.

If the key consists of the property name followed by a colon (':') and
then a number, the number following the colon is used to determine which
instance of the property this set pertains to, and the value passed via
the instance parameter is ignored for that property. For example, in the
following call:

    node->set_properties("dog=10,cat:2=5,bird:0=0.5", 1)

instance 1 of node's 'dog' property is set to 10, the 1 coming from the
instance parameter, instance 2 of the node's 'cat' property is set to 5
due to the override syntax provided in the string, and instance 0 of the
node's 'bird' property is set to 0.5 due to its override.

If the name/instance pair is malformed, e.g. 'value:=10' or
'value:foobar=10', a runtime error is thrown.
2020-07-24 13:15:30 -05:00
Martin Braun
876d4150aa uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
2020-03-03 08:51:32 -06:00
Martin Braun
c97bdc6c94 rfnoc: Add property propagation, Boost.Graph storage
- Adds a detail::graph_t class, which handles the propagation
- Adds methods to node_t to aid with propagation
- Adds unit tests
- Adds dynamic property forwarding:
  Nodes are now able to forward properties they don't know about by
  providing a forwarding policy. A good example is the FIFO block which
  simply forwards most properties verbatim.

- node: Temporarily disabling consistency check at init
2019-11-26 11:49:14 -08:00
Martin Braun
efb1d5a472 rfnoc: Add properties, nodes, and accessors
Adds the following classes:
- uhd::rfnoc::node_t, the base class for RFNoC nodes
- uhd::rfnoc::node_accessor_t, a class to access private properties
- uhd::rfnoc::res_source_info, a struct that identifies where properties
  come from
- uhd::rfnoc::property_t, and property_base_t (its parent)
- uhd::rfnoc::prop_accessor_t, a class to access properties

Add always dirty property (dirtifier).

Also adds unit tests for properties.
2019-11-26 11:49:13 -08:00