Commit graph

1272 commits

Author SHA1 Message Date
Martin Braun
84c56eae1f rfnoc: Rename skip_property_propagation to is_back_edge
`skip_property_propagation` was always a bad choice for a name, but
since 3930a615, it is completely wrong.

In the C++ API, there is no change in API or ABI, because the argument
name is not part of API/ABI, although the documentation strings were
modified.

In the Python API, the argument name and default value are also modified
to match the C++ API. Scripts using named arguments may have to be
modified to track this change.
2022-06-16 06:03:56 -07:00
Wade Fife
ec74e70cd0 x300: Add protover and chdr_width regs to x300_mb_iface 2022-06-14 07:38:54 -05:00
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
Lars Amsel
81711625be uhd: Align numeric data types in digital filter classes
Modified accessors and constructors in digital filter classes
to align with the type declared in the corresponding fields.
2022-06-03 13:15:19 -07:00
Lars Amsel
f5d2daa0f6 uhd: pybind: Fix digital filter compile issue on Windows
0cf8a60 introduces Python binding for the digital filter
classes. This does not compile under Windows because the
digital filter classes are header only classes but are
declared as UHD_API. They must be declared as UHD_API_HEADER.
See also 1b3ed20.
2022-06-03 13:15:19 -07:00
Martin Braun
90239cfee4 lib: Remove references to uhd::sid_t
This data structure was used in UHD 3, but is no longer relevant.
2022-06-03 06:12:41 -07:00
Martin Braun
6419405e7c transport: Remove zero_copy_flow_ctrl
In the current streaming model, this is never used. Another UHD-3
remnant.
2022-06-03 06:12:41 -07:00
Martin Braun
840335390c lib: Remove vrt::chdr namespace
This is another remnant of UHD 3. This chdr:: namespace is not used
anywhere in the current streaming model.
2022-06-03 06:12:41 -07:00
Clayton Smith
244c9d2d90 host: Remove redundant template parameter list
C++20 no longer allows redundant template parameter lists. The
template parameter list must be removed from the property_impl
constructor to allow C++20 projects to include UHD.

Signed-off-by: Clayton Smith <argilo@gmail.com>
2022-05-24 07:52:00 -07:00
Martin Braun
3f900ba3d6 rfnoc: Improve comments regarding streaming and mgmt. code
This commit *only* touches comments in the code for RFNoC streaming,
link management and management portal.
2022-05-18 08:23:53 -07:00
Martin Braun
264db078dd dboard_iface: Change boost::chrono to std::chrono in sleep()
The underlying implementation was already using std::chrono. This
further removes boost::chrono from UHD.
2022-04-27 09:50:06 -07:00
Martin Braun
7d2b96c308 lib: Remove muxed_zero_copy_if
The usage of muxed_zero_copy_if was removed in 20baa41. We can thus
remove the muxed_zero_copy_if itself.
2022-04-27 09:49:04 -07:00
Martin Braun
2c8272079f docs: multi_usrp: Clarify GPIO source bank meaning 2022-04-19 07:30:49 -07:00
mattprost
4bd20a9e2a utils: string: Add split string utility function
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
michael-west
ac5ddf9d0e uhd: Replay block version 1.1
- Add ability to get current record position.
- Add ability to get current play position.
- Track space in play command FIFO and throw uhd::op_failed error when
  command requested would overflow the command FIFO.

Signed-off-by: michael-west <michael.west@ettus.com>
2022-04-01 13:33:08 -07:00
Michael Dickens
f8c39eb075 config: fix clang fallthrough syntax 2022-04-01 12:13:12 -07:00
Michael Dickens
8dd3ace5c3 uhd: fix compiler macro ordering
Clang provides the same macros as GCC, so if we're differentiating between these compilers then we need to get the compiler checking macros in the correct order
2022-04-01 12:13:12 -07:00
Wade Fife
07ee9ab751 rfnoc: Remove redundant RFNoC block descriptions
The block descriptions radio_1x64.yml and radio_2x64.yml are subsets
of radio.yml. Similarly, axi_ram_fifo_2x64.yml and
axi_ram_fifo_4x64.yml are subsets of axi_ram_fifo.yml. This commit
removes the redundant YAML descriptions in favor of the
parameterizable versions.
2022-03-31 13:51:23 -07:00
Wade Fife
5007d98328 rfnoc: Make RFNoC device port names consistent
Update all USRPs to use the same names for the same port types.
For example, instead of "ctrl_port" and "ctrlport" use "ctrlport".
Instead "timekeeper" and "time_keeper", use "timekeeper". Etc.
2022-03-31 13:51:23 -07:00
Martin Braun
1d2ec74317 rfnoc: replay: Add ability to capture and read async info
- Add action handlers to the replay block to store TX and RX events.
- Adds two new APIs: get_{record,play}_async_metadata() to read back
  async info.
- Add unit tests.
2022-03-30 10:28:07 -07:00
Martin Braun
6629823dcb docs: rfnoc: Add doxygen tag for missing parameter
This adds a doxygen tag for the `chan` parameter in
fir_filter_block_control::set_coefficients().
2022-03-25 08:19:15 -05:00
Jonathon Pendlum
5d20a5a401 rfnoc: fir filter: Add support for multiple channels to block controller 2022-03-23 16:21:24 -05:00
Lane Kolbly
93f7ffb73a host: Add power_reference_iface::sptr declaration 2022-03-17 13:57:27 -05:00
Lane Kolbly
74f371fcd3 host: Create meta_range_t::as_monotonic
In order to perform certain operations (start/stop/step), meta_range_t
objects must be "monotonic", meaning that the subranges composing it
are sorted and non-overlapping. This commit creates a method which
takes a non-monotonic meta_range_t containing no non-continuous
subranges and converts it into a monotonic meta_range_t.
2022-03-14 15:49:41 -05:00
Lane Kolbly
7484b4f095 host: test: Add UHD_UNITTEST_LOG_LEVEL override 2022-03-11 09:10:04 -06:00
Martin Braun
6d58b692e4 docs: stream_args: Clarify usage of stream_args_t::channels
This vector is no longer used with RFNoC devices. We remove references
to X300 from the example, and instead use B210 as an example.
2022-03-11 08:59:39 -06:00
Martin Braun
708f1c2b35 rfnoc: Remove UHD3-API usages
- rfnoc_replay_samples_from_file still had UHD3-vestiges for selecting
  block port and ID
- The documentation for stream_args_t also included block port and ID
  examples
2022-03-11 08:59:39 -06:00
Wade Fife
a6f666092a rfnoc: Fix block buffer sizes referring to MTU
In the HDL, the parameter named 'MTU' is clog2 of the size of the
desired MTU. For example, when the 'MTU' parameter is 10, that means
the actual MTU setting is 2**MTU or 1024. So we need to set our
buffers to 2**MTU if we want them to be one MTU in size.
2022-03-04 09:42:39 -06:00
Martin Braun
1f31a9d95d docs: Improve documentation for replay block
- Add notes on playback and record behaviour
- Improve docs for play()

Co-authored-by: Wade Fife <wade.fife@ettus.com>
2022-02-24 13:41:14 -06:00
Martin Braun
0f15704cb9 rfnoc: graph_utils: Add ability to declare back-edges
rfnoc::connect_through_blocks(), unlike rfnoc_graph::connect(), did not
have an argument to declare a back-edge. This patch remedies this
situation by adding a skip_property_propagation argument that works
exactly as with rfnoc_graph::connect().
2022-02-24 13:39:41 -06:00
Martin Braun
1c726f5667 rfnoc: Remove references to nocscript from YAML files
The sw_iface entry in the `control` section is yet underdefined, so we
can remove it from the block descriptors.
2022-02-23 08:57:48 -06:00
Wade Fife
4ea32ae32d rfnoc: Expose buffer parameters for DRAM FIFO block 2022-02-10 19:46:39 -07:00
Wade Fife
788fef11ef fpga: e31x: Add DRAM support
This adds DRAM support to E31x devices. Due to the size of the DDR3
memory controller, it is not enabled by default. You can include the
memory controller IP in the build by adding the DRAM environment
variable to your build. For example:

DRAM=1 make E310_SG3
2022-02-10 18:13:44 -07:00
Jonathon Pendlum
8444f84add fpga: rfnoc: Add BLANK_OUTPUT to FIR filter block's parameters 2022-02-10 18:11:41 -07:00
Lane Kolbly
ed18ed376b host: Throw exception when accessing properties with incorrect type 2022-02-07 14:43:46 -06:00
Lane Kolbly
a7c5d70fec host: Minor cleanups in property_tree code 2022-02-07 14:43:46 -06:00
Wade Fife
19a333a268 fpga: x400: Add DRAM support 2022-02-07 13:08:11 -07:00
Wade Fife
eb90880067 rfnoc: Rename and enlarge axi4_mm IO signature 2022-02-07 13:08:11 -07:00
Martin Braun
42ff4fb7f5 uhd: Harmonize fuzzy frequency comparisons
Throughout UHD, we often do floating-point comparisons for frequency
ranges that require resilience to floating point rounding errors. Most
of the time the checks look like this:

```cpp
if (fp_compare_epsilon<double>(freq) > boundary) {
    // ...
}
```

The exception is the N320 daughterboard control, which uses a custom
epsilon:
```cpp
if (fp_compare_epsilon<double>(freq,
        RHODIUM_FREQ_COMPARE_EPSILON) > boundary) {
    // ...
}
```

This was, for the most part, not by design, but because authors simply
didn't think about which epsilon value was appropriate for the frequency
comparison. This was complicated by the fact that fp_compare_epsilon
previously had some issues.

This patch introduces FREQ_COMPARE_EPSILON, which is a sensible default
value for fp_compare_epsilon when doing frequency comparisons (note that
fp_compare_delta already had such a value).
Also, it introduces freq_compare_epsilon(x), which is a shorthand for
fp_compare_epsilon<double>(x, FREQ_COMPARE_EPSILON).

We then replace all occurrences of fp_compare_epsilon<double> which are
specific to frequency checks with freq_compare_epsilon.
2022-02-04 13:16:00 -06:00
Martin Braun
3e496cbda1 math: fp_compare: Adapt fp_compare_epsilon API to actual use
UHD had an issue where the design of fp_compare_epsilon and its usage
differed. In fact, the *only* usage of fp_compare_epsilon outside of
unit tests was to do a fuzzy frequency comparison, and it always took
a form like this:

```cpp
// The argument EPSILON may be implied, i.e., using the default
if (fp_compare_epsilon<double>(test_freq, EPSILON) < boundary_freq) {
    // ...
}
```

However, the API of fp_compare_epsilon was such that it would apply
DOUBLE_PRECISION_EPSILON to part of the frequency comparison, thus
rendering the argument EPSILON obsolete. When the default EPSILON was
used, this was OK, but only when the floating point type of
fp_compare_epsilon<> was `double`, and not `float`.

As an example, consider the following:
```
if (fp_compare_epsilon<double>(1e9 + x, LITTLE_EPSILON) == 1e9) {
    // ....
}
double BIG_EPSILON = x * 10;
if (fp_compare_epsilon<double>(1e9 + x, BIG_EPSILON) == 1e9) {
    // ....
}
```

If you expect the second comparison to pass even if the first failed,
then you are not alone. However, that's not what UHD would do. Because
of the aforementioned behaviour, it would use DOUBLE_PRECISION_EPSILON
for the right hand comparison, which would fail again.

Instead of fixing the instances of fp_compare_epsilon throughout UHD,
this patch changes the comparison algorithm from "very close with
tolerance epsilon" to "close enough with tolerance epsilon". This
requires only one side to be close to the other, using its own epsilon,
so the aforementioned example would always pass on the second check.

However, this exposed a second bug in fp_compare_epsilon. For
greater-/less-than comparisons, it would use epsilon like a delta value,
i.e., it would check if

    a + epsilon < b - epsilon

That means that if a < b, but (b-a) < 2*epsilon, this check would return
"false", i.e., it would report that a >= b, which is incorrect. These
operators are now changed such that they first check equality of a and
b using the algorithm described in the code, and then compare the values
of a and b (ignoring epsilon) directly. A unit test for this case was
added.
2022-02-04 13:16:00 -06:00
Martin Braun
c1e26b4a26 uhd: rfnoc: Let connect_through_blocks() return edge list
This changes the return value of connect_through_blocks() from void to
a list of edges. If the connection can be made, then it will now return
the list of connections between the source block and port.
2022-02-04 13:13:59 -06:00
Martin Braun
cba3c8351d rfnoc: Set the default MTU forwarding policy to ONE_TO_ONE.
Previously, the default was DROP. For almost all RFNoC blocks, this is
not a good default. It is very easy to crash USRPs by not properly
propagating the MTU. For example, the following flow graph:

Radio -> DDC -> FIR -> Streamer

would crash an X310 when not manually setting an spp value. The reason
is: The Radio block has an output buffer of 8192 bytes, capable of
handling 2044 samples per packet. However, that's too big for the
Ethernet portion of the X310, which would cause the X310 to lose
connection between UHD and firmware. If the FIR were configured to
propagate MTU, the Host->USRP connection (which has an MTU of <= 8000)
would limit the MTU on all links, and the spp value would automatically
be reduced to 1996 (or less).

This commit uses the post_init() feature to check the user set an MTU in
the constructor, and sets it to the default if that didn't happen. This
doesn't solve all problems (the new default of ONE_TO_ONE) could also be
incorrect, but is a much more suitable default.

As a consequence, this has a minor change in how
set_mtu_forwarding_policy() can be used: It now must be called during
the constructor. Before, the rule was that it may only be called once,
but that could also have happened, e.g., during the first property
resolution. Now, the constructor is the last time block authors can
choose an MTU forwarding policy.
2022-02-01 14:40:41 -06:00
Martin Braun
c3327801ca rfnoc: Add post_init() method to noc_block_base
This method allows running a fixed set of rules to check the internal
consistency of a block. This may be necessary, because blocks authors
may incorrectly implement a certain design rule, and we want the ability
to not start an RFNoC graph with blocks that have rule violations which
we can write checks for.
2022-02-01 14:39:35 -06:00
Steven Koo
943ebd40ca uhd: expose uhd::dict and fs_path with UHD_API_HEADER
uhd::dict gets typedefed into board_eeprom_t, which is used by applications
like uhd_usrp_probe, so this should be considered as part of the API.

fs_path is also an API, but because of MSVC build issues it
was not marked as so. Instead mark with UHD_API_HEADER.

Signed-off-by: Steven Koo <steven.koo@ni.com>
2022-01-31 13:56:12 -06:00
Steven Koo
1b3ed2072e rfnoc: set UHD_API_HEADER on property_t
UHD_API sets the visibility for the symbols. Adding UHD_API fixes
casting issues seen on macOS. However this breaks Windows because
UHD_API sets __declspec(dllexport) and __declspec(dllimport) which
doesn't make sense for header/inline only definitions. This change
adds UHD_API_HEADER to denote entrypoints for this case. It sets
the visibility flags for Linux/Mac but does not set the
__declspec on Windows.

Signed-off-by: Steven Koo <steven.koo@ni.com>
2022-01-31 13:56:12 -06:00
Martin Anderseck
ee8e4f2c9b SPI: Implement SPI engine for x410
Add SPI Core host implementation for x410 and a discoverable
feature to make it accessible.
2022-01-13 14:35:55 -06:00
Martin Braun
2d9a833747 uhd: Fix non-standard function name macros
Throughout UHD, we are using a random mix of __FUNCTION__, __func__,
__PRETTY_FUNCTION__, and BOOST_CURRENT_FUNCTION. Note that the first two
macros are non-standard (although many compilers understand them), and
the last requires Boost. __func__ is available since C++11, but is not
the best choice because the C++ standard doesn't require it to be of any
specific value.

We thus define UHD_FUNCTION and UHD_PRETTY_FUNCTION as portable macros.
The former simply contains the undecorated function name, the latter the
expanded function with full signature.

As it happens, our currently supported compilers didn't have any issues
using non-standard macros, so the main fix here is the removal of the
Boost macros and the harmonization of the other macros.
2022-01-12 15:07:54 -06:00
Lane Kolbly
57635b69e1 host: Make get_mb_controller public 2022-01-11 13:30:27 -06:00
Lars Amsel
3e5e4eb06c rfnoc: Add atomic item size property for RFNoC blocks
An RFNoC block (like the radio) might require a minimal number of
items in each clock cycle, e.g. the radio has to process
SPC (samples per cycle). Because data in RFNoC is transmitted and
processed in packets, we have to make sure the items inside these
packets are a multiple of the items processed in each cycle.

This commit adds an atomic item size properties which is set by
the radio and adapted by the streamers. The streamers adapt the
SPP property of the radio block controller depending on the MTU
value. This might lead to an SPP value which does not align with
the SPC value of the radio block, hence we add a property resolver
for the atomic item size.
2022-01-10 14:56:35 -06:00
Lane Kolbly
d0bd9f1741 host: Add divider constructor to spi_config_t 2022-01-06 15:05:32 -06:00