Commit graph

1072 commits

Author SHA1 Message Date
Wade Fife
3132634bb4 rfnoc: Fix RAM port direction in YAML 2019-11-26 12:21:34 -08:00
Wade Fife
47cacecd2a rfnoc: Update YAML to expose memory clock to blocks 2019-11-26 12:21:33 -08:00
Wade Fife
72e833e7bb rfnoc: Replace DDC/DUC YAML variants with single version 2019-11-26 12:21:33 -08:00
Wade Fife
8ae60e342b rfnoc: Fix YAML block settings 2019-11-26 12:21:33 -08:00
Wade Fife
be1745427a rfnoc: Add FIR block YAML 2019-11-26 12:21:33 -08:00
Martin Braun
2d110b1ded rfnoc_graph: Modify find_blocks() to sort return value
With this patch, the elements of of the return value of find_blocks()
are sorted lexicographically (specifically, using
uhd::rfnoc::block_id_it::operator<()).

The underlying block_container class stores the blocks in an unordered
set, so the return value for find_blocks() was always sorted randomly.
multi_usrp_rfnoc had to sort the return values every time find_blocks()
was used to get a useful return value.

Because find_blocks() had no contract for the order of returned blocks,
this change simply sorts the return value before returning it.
multi_usrp_rfnoc is modified to remove all the sorts that are now
superfluous.

A good way to see the change is to run uhd_usrp_probe, which will now
contain content like this:

|     _____________________________________________________
|    /
|   |       RFNoC blocks on this device:
|   |
|   |   * 0/DDC#0
|   |   * 0/DDC#1
|   |   * 0/DUC#0
|   |   * 0/DUC#1
|   |   * 0/DmaFIFO#0
|   |   * 0/Radio#0
|   |   * 0/Radio#1

Assuming the blocks don't change, the order of this list will always be
the same following this patch. Note that the order is unrelated to the
order on the control crossbar, which it never was.
2019-11-26 12:21:33 -08:00
Martin Braun
d997c235b8 image builder: Add ability to pick up extra Makefile.srcs from YAMLS
The blocks that are neither OOT, nor core blocks (like the DDC/DUC,
etc.) require additional info to find their appropriate Makefile.srcs
files. We don't include them in every build, to avoid building IP for
the FFT, FIR, and other blocks when they're not needed. However, those
blocks are in-tree, and don't follow the same directory structure as
out-of-tree modules, either.

We therefore allow the YAML files for those blocks (which are shipped
with UHD) to contain a path hint to their appropriate Makefile.srcs. The
image builder uses those paths to amend the `make` command
appropriately.
2019-11-26 12:21:33 -08:00
Martin Braun
d5580fcec8 multi_usrp: Add set_rx_spp() call
This API call is a more explicit way of setting the spp than passing in
an spp value in the args of the stream args when creating streamers. For
pre-RFNoC devices, this is done by injecting the spp arg back into the
stream args. For RFNoC devices, the set_property() call on the radio is
called.
2019-11-26 12:21:33 -08:00
Wade Fife
4e6177ed55 utils: image_builder: Support parameterized number of ports on blocks 2019-11-26 12:21:32 -08:00
Martin Braun
2a7e69d862 rfnoc: image_builder: Fix -I, allow devices/targets to bet set in YAML
- The -I switch now allows pointing to an OOT
- The image core file may now contain keys 'device' and
  'default_target', which the image builder can use as default values.
  Command line switches --device and --target are still honoured.
2019-11-26 12:21:32 -08:00
Martin Braun
d3a16b7022 uhd: Replace all occurrences of boost::bind with std::bind
Note: Replacing everything with a lambda would be even better, but that
can't be easily scripted so we'll do this as a first step to reduce the
Boost footprint.

This also removes occurences of #include <boost/bind.hpp>, and makes
sure all usages of std::bind have an #include <functional>. clang-format
wasn't always applied to minimize the changeset in this commit, however,
it was applied to the blocks of #includes.

Due to conflicts with other Boost libraries, the placeholders _1, _2,
etc. could not be directly used, but had to be explicitly called out
(as std::placeholders::_1, etc.). This makes the use of std::bind even
uglier, which serves as another reminder that using std::bind (and even
more so, boost::bind) should be avoided.

nirio/rpc/rpc_client.cpp still contains a reference to boost::bind. It
was not possible to remove it by simply doing a search and replace, so
it will be removed in a separate commit.
2019-11-26 12:21:32 -08:00
Brent Stapleton
2da99fad97 rfnoc: Adding rfnoc_graph utilities
Adding graph_utils to keep rfnoc_graph utilities to contain helper
function and commonly used algorithms for the rfnoc_graph. These
functions aren't core to the rfnoc_graph's functionality, so we'll keep
them out of its API.
2019-11-26 12:21:32 -08:00
Aaron Rossetto
2f97f8bd01 transport: Implement eov indications for Rx and Tx streams 2019-11-26 12:21:32 -08:00
Paul Butler
cfd5cd326d rfnoc: rename block clocks to ce_clk
Renaming the CE clock in the RFNoC block YAML files so that the name
is consistent across blocks. Corresponding `fpga` changes can be found
in `rfnoc: rename block clocks to ce_clk`.
2019-11-26 12:21:32 -08:00
Martin Braun
fcc2e9c602 uhd: Replace boost::function with std::function
This is mostly a search-and-replace operation, with few exceptions:
- boost::function has a clear() method. In C++11, this is achieved by
  assigning nullptr to the std::function object.
- The empty() method is replaced by std::function's bool() operator
2019-11-26 12:21:32 -08:00
Martin Braun
0c43030e71 uhd: Replace BOOST_FOREACH(v, c) with for(v : c)
Also removes all references to boost/foreach.hpp. BOOST_FOREACH is no
longer necessary since all headers require C++11 anyway.
2019-11-26 12:21:32 -08:00
Martin Braun
1fe98e8701 uhd: Replace usage of boost smart pointers with C++11 counterparts
This removes the following Boost constructs:
- boost::shared_ptr, boost::weak_ptr
- boost::enable_shared_from_this
- boost::static_pointer_cast, boost::dynamic_pointer_cast

The appropriate includes were also removed. All C++11 versions of these
require #include <memory>.
Note that the stdlib and Boost versions have the exact same syntax, they
only differ in the namespace (boost vs. std). The modifications were all
done using sed, with the exception of boost::scoped_ptr, which was
replaced by std::unique_ptr.

References to boost::smart_ptr were also removed.

boost::intrusive_ptr is not removed in this commit, since it does not
have a 1:1 mapping to a C++11 construct.
2019-11-26 12:21:32 -08:00
Aaron Rossetto
cb9329a681 uhd: Check property type at access; error if mismatch 2019-11-26 12:21:31 -08:00
Wade Fife
4f130e3c12 rfnoc: Add DRAM support to E320 2019-11-26 12:21:31 -08:00
Lars Amsel
f5c0640304 rfnoc: Port FFT controller
rfnoc used noc-script for FFT controller implementation. Because
erfnoc does not support noc-script yet, the implementation is done
as a rfnoc controller.
2019-11-26 12:16:25 -08:00
Martin Braun
f9f9cb0d2c rfnoc: Add DMA FIFO block controller 2019-11-26 12:16:25 -08:00
Martin Braun
7d69dcdcc3 Remove proto-RFNoC files
This commit removes all files and parts of files that are used by
proto-RFNoC only.

uhd: Fix include CMakeLists.txt, add missing files
2019-11-26 12:16:25 -08:00
Martin Braun
c256b9df65 x300/mpmd: Port all RFNoC devices to the new RFNoC framework
Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Brent Stapleton <brent.stapleton@ettus.com>
Co-Authored-By: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
2019-11-26 12:16:25 -08:00
Martin Braun
9a8435ed99 rfnoc: Add radio_1x64 2019-11-26 11:49:47 -08:00
Martin Braun
67dbaa41f2 rfnoc: radio: Add API call to disable timestamps
By calling radio_control::enable_rx_timestamps(false, chan), the radio
will not add timestamps to outgoing packets.
2019-11-26 11:49:46 -08:00
Brent Stapleton
23f4f8cf4e rfnoc: Add multi_usrp_rfnoc, modify multi_usrp
This adds a separate version of multi_usrp for RFNoC devices. It is
compatible with RFNoC devices only, and prefers C++ APIs over property
tree usage. The factory of multi_usrp is modified such that it picks the
correct version, users of multi_usrp don't care about this change.

This also introduces some API changes:
- Removing redundant GPIO functions. Now all GPIO control, setting, and
  readback is done with uint32_t's.
- Adding getter/setter for GPIO source. This was done to simplify the
  other GPIO settings, as the source for each pin is not always a
  binary. The CTRL mode, for example, can either be ATR or GPIO.
  However, the source can be controlled by various radios or "PS" or
  some other source.
- Removing the mask from the RFNoC radio controllers' set_gpio_attr().
- Adding state caching to gpio_atr_3000, and a getter for it. Whenever
  an attribute is set, that value is cached, and can now be retreieved.
- Remove low-level register API. Since UHD 3.10, there is no USRP that
  implements that API.
Modifying the filter API in the following ways:
- Splitting filter API getter/setter/list into separate RX and TX
  functions
- Adding channel numbers as an argument
- The filter name will no longer be a property tree path, but rather a
  filter name. For RFNoC devices, this will take the form
  `BLOCK_ID:FILTER_NAME`. For non-RFNoC devices, this will just be the
  filter name (e.g. `HB_1`)
- Removing search mask from listing function. Users can do their own
  searching

Co-Authored-By: Martin Braun <martin.braun@ettus.com>
2019-11-26 11:49:42 -08:00
Martin Braun
c55c434425 rfnoc: Allow MB controllers to init after blocks have initialized
This allows mb_controller childs to implement an init() call which
rfnoc_graph will call after the block initialization is complete.

rfnoc: graph/mb_controller: Add synchronization routine

This adds two new API calls:
* rfnoc_graph::synchronize_devices() and
* mb_controller::synchronize().

The purpose is to synchronize devices in time and/or phase, depending on
device capabilities. mb_controller childs can override or extend the
default implementation, which is to simply set time next PPS and verify
(similar to the set_time_unknown_pps() call in multi_usrp).

rfnoc: mb_controller: Add gpio_src API

Adds new API calls (get_gpio_src, get_gpio_srcs, set_gpio_src,
get_gpio_banks) to mb_controllers
2019-11-26 11:49:41 -08:00
Alex Williams
a4274c19eb rfnoc: Use adapter_id_t for balancing load across links
Since the mb_iface allocates local device IDs, also have it track
the associated adapter IDs and provide a facility to retrieve them.
Incorporate the adapter IDs in the user API to select the adapter
for streamers.
2019-11-26 11:49:40 -08:00
Alex Williams
01284980b1 transport: Add modeling of physical adapters
Now link instances must have the ability to report the corresponding
physical adapter that is used for the local side of the link. This
information can be used to help identify when multiple links share
the same adapter.
2019-11-26 11:49:38 -08:00
Martin Braun
af5b2b5e77 rfnoc: node: Add set_properties()
node_t::set_properties() is a convenience function that lets you set
multiple properties at once from a device_addr_t.
2019-11-26 11:49:38 -08:00
Martin Braun
acc4dab894 rfnoc: property: Add option to set properties from strings 2019-11-26 11:49:37 -08:00
Alex Williams
117af6f0b0 rfnoc: Add ability to select transport for streamers to user APIs
Now the user can choose which transport is used in connect() calls.
2019-11-26 11:49:36 -08:00
Ciro Nishiguchi
bffef674fb rfnoc: tx_streamer: add support for async messages
Add an async message queue that aggregates errors from multiple sources.
Errors can come from the strs packets originating from the stream
endpoint or from the radio block through control packets to the host.
2019-11-26 11:49:36 -08:00
Ciro Nishiguchi
1c79742231 utils: remove thread priority elevation
Remove UHD call to elevate thread priority to realtime from utils, and
add warning in documentation of set_thread_priority function. Setting
all threads to the same realtime priority can cause the threads to not
share access to the network interface fairly, which adversely affects
operation of the worker threads in UHD.
2019-11-26 11:49:34 -08:00
Martin Braun
b89c53c069 rfnoc: ctrlport: Separately validate and handle async messages
This introduces the concept of an async message validator, an optional
callback for functions to check if an async message has a valid payload.
After validation, the async message is ack'd. Then, the async message
handler is executed.

This makes sure that an async message is ack'd as soon as possible,
rather than after the async message handling, which can itself have all
sorts of communication going on to the device.
2019-11-26 11:49:34 -08:00
Brent Stapleton
595fba47d5 rfnoc: adding filter_api mixin class for blocks
Adding filter_node, a mixin class that provides an interface that
multi_usrp_rfnoc will use to implement the filter API.
2019-11-26 11:49:34 -08:00
Martin Braun
bf986d3263 rfnoc: Add DUC block controller 2019-11-26 11:49:34 -08:00
Martin Braun
867cd4a23b rfnoc: rfnoc_graph: Add is_connectable() API
rfnoc_graph::is_connectable() allows to check if is possible to call
connect() on blocks. If blocks are attached to other blocks statically,
or if they are on unconnected devices, they are not connectable.
2019-11-26 11:49:33 -08:00
Martin Braun
9b8e4e652c rfnoc: Add MTU tracking
MTUs are now tracked through the framework for all childs of
noc_block_base. Every edge gets an 'mtu' property. MTU can be set and
get either through the prop API, or through new API calls (get_mtu(),
set_mtu()). It is also possible to create custom properties that depend
on the MTU by asking for a reference to the MTU property, and then
adding that to the input list of a property resolver.

The radio_control_impl includes a change in this commit where it sets
the spp based on the MTU.

Blocks can also set an MTU forwarding policy. The DDC block includes a
change in this commit that sets a forwarding policy of ONE_TO_ONE,
meaning that the MTU on an input edge is forwarded to the corresponding
output edge (but not the other edges, as with the tick rate).
2019-11-26 11:49:33 -08:00
Martin Braun
ab87597e9e rfnoc: Implement overrun handling using action API
In order to enable overrun handling through the action API, a few new
features are implemented:
- The RX streamer can now accept stream command actions. The streamer
  will interpret stream command actions as a request to send stream
  commands upstream to all producers.
- A new action type is defined ('restart request') which is understood
  by the radio and streamer, and is a handshake between producers and
  consumers. In this case, it will ask the radio to send a stream
  command itself.

When an RX streamer receives an overrun, it will now run the following
algorithm:
1. Stop all upstream producers (this was already in the code before this
   commit).
2. If no restart is required, Wait for the radios to have space in the
   downstream blocks.

The radio, if it was in continuous streaming mode before the overrun,
includes a flag in its initial action whether or not to restart the
streaming. Also, it will wait for the stop stream command from the
streamer. When it receives that, it will initiate a restart request
handshake.

3. The streamer submits a restart request action upstream. This action
   will be received by the radio.
   The radio will then check the current time, and send a stream command
   action back downstream.
4. The RX streamer receives the stream command action, and uses it to
   send another stream command to all upstream producers. This way, all
   upstream producers receive a start command for the same time.
2019-11-26 11:49:32 -08:00
Martin Braun
053306f293 rfnoc: actions: Add dictionary to all actions
This can be used to set arbitrary key/value pairs on the action object.
Easier to use than serialization, but doesn't require custom types,
either.
2019-11-26 11:49:32 -08:00
Lars Amsel
2a66eb62d8 rfnoc: Introduce device-specific blocks
- Add device ID constants (e.g., E310 == 0xE310, X300 == 0xA300). These
  are stored in the device FPGA, and can be used for decisions later
- Blocks can be specific to a device. For example, x300_radio_control
  can only work on an X300 series device.
- Because blocks can be device-specific, all radio blocks can now share
  a common Noc-ID (0x12AD1000).
- The registry and factory functions are modified to acommodate for
  this.
  - The motherboard access is now also factored into the same registry
    macro.
2019-11-26 11:49:32 -08:00
Lars Amsel
914fbdbcb2 rfnoc: Add a new builder script for FPGA images based on eRFNoC.
The builder has two major jobs:
 * generate an image core file which reflects the FPGA image
   configuration given by the user
 * invoke Xilinx toolchain to actually build the FPGA image

For this purpose it needs to know where to find the FPGA source tree.
This tree can be give by the -F option.

The code that represents the user configurable part of the image is
written to a file called <device>_rfnoc_sandbox.v. To generate the file
these configuration files are needed:
 * io_signatures.yml: A file describing the known IO signatures. This file
                      is global for all devices and contains the superset
                      of all signatures (not all signatures are used by all
                      devices). It resides in usrp3/top/ of the tree given
                      by -F.
* bsp.yml: A file describing interfaces of a specific device such as AXIS
           transport interfaces or IO ports as well as device specific
           settings. It resides in usrp3/top/<device> of the tree given by -F.
* <image>.yml: a file provided by the user with freely chosen name.
               It describes which elements the image should contain
               (RFNoC blocks, streaming endpoints, IO ports) and how
               to connect them. The file also contains image setting
               such as the CHDR width to be used.

The script uses mako templates to generate the sandbox file. Before the
template engine is invoked sanity checks are executed to ensure the
configuration is synthactic correct. The script also build up structures
to ease Verilog code generation in the template engine. The engine should
not invoke more Python than echoing variables or iterating of lists or
dictionaries. This eases debugging as errors in the template engine are
hard to track and difficult to read for the user.

All Python code is placed in a package called rfnoc. The templates used
by the builder are also part of this package. image_builder.py contains
a method called build_image which is the main entry point for the builder.
It can also be utilized by other Python programs. To align with the
existing uhd_image_builder there is also a wrapper in bin called
rfnoc_image_builder which expects similar commands as the uhd_image_builder.

For debugging purpuse the script can be invoked from host/utils using
$ PYTHONPATH=. python bin/rfnoc_image_builder <options>

When installed using cmake/make/make install the builder installs to
${CMAKE_INSTALL_PREFIX}bin and can be invoked without specifying a
PYTHONPATH.

One can also install the package using pip from host/utils
$ pip install .

Image config generation can also be done from  GNU Radio Companion
files. The required GRC files are merged into gr-ettus.

Example usage:

$ rfnoc_image_builder -F ~/src/fpgadev -d x310 \
    -r path/to/x310_rfnoc_image_core.grc \
    -b path/to/gr-ettus/grc

Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Martin Braun <martin.braun@ettus.com>
2019-11-26 11:49:32 -08:00
Martin Braun
0ea553475e rfnoc: async message: Include timestamp in async message handling
Async messages (like, e.g., overrun messages) can include a timestamp.
This change enables access to the timestamp in the async message
handler. It is up to the FPGA block implementation to include the
timestamp, if desired/necessary. The definition of the timestamp may
also depend on the block, for example, the overrun async message will
include the time when the overrun occurred.
2019-11-26 11:49:32 -08:00
Martin Braun
5724548f5c rfnoc: actions: Add rx_event action type 2019-11-26 11:49:31 -08:00
Martin Braun
dbca54be24 rfnoc: node: Make register_property() unlock RW access 2019-11-26 11:49:29 -08:00
Ciro Nishiguchi
75a090543b rfnoc: add rx and tx transports, and amend rfnoc_graph
transports:

Transports build on I/O service and implements flow control and
sequence number checking.

The rx streamer subclass extends the streamer implementation to connect
it to the rfnoc graph. It receives configuration values from property
propagation and configures the streamer accordingly. It also implements
the issue_stream_cmd rx_streamer API method.

Add implementation of rx streamer creation and method to connect it to
an rfnoc block.

rfnoc_graph: Cache more connection info, clarify contract

Summary of changes:
- rfnoc_graph stores more information about static connections at the
  beginning. Some search algorithms are replaced by simpler lookups.
- The contract for connect() was clarified. It is required to call
  connect, even for static connections.
2019-11-26 11:49:29 -08:00
Alex Williams
d8e9705bc6 rfnoc: Add tracking of 'valid' bit to properties
The valid bit helps prevent placeholder defaults from being
propagated through the graph. Values that are not valid will
not be forwarded.
2019-11-26 11:49:29 -08:00
Alex Williams
52c38e3c22 rfnoc: Enable users to query connections in the graph
Implement uhd::rfnoc::rfnoc_graph::enumerate_*_connections()
2019-11-26 11:49:29 -08:00
Martin Braun
3da938f124 rfnoc: Add clock selection to blocks
During registration, blocks must now specify which clock they are using
for the timebase (i.e., for timed commands) and for the ctrlport (this
is used to determine the length of sleeps and polls). For example, the
X300 provides bus_clk and radio_clk; typically, the former is used for
the control port, and the latter for the timebase clock.
Another virtual clock is called "__graph__", and it means the clock is
derived from property propagation via the graph.

The actual clocks are provided by the mb_iface. It has two new API
calls: get_timebase_clock() and get_ctrlport_clock(), which take an
argument as to which clock exactly is requested. On block
initialization, those clock_iface objects are copied into the block
controller.

The get_tick_rate() API call for blocks now exclusively checks the
timebase clock_iface, and will no longer cache the current tick rate in
a separate _tick_rate member variable. Block controllers can't manually
modify the clock_iface, unless they also have access to the
mb_controller (like the radio block), and that mb_controller has
provided said access.

This commit also adds the clock selection API changes to the DDC block,
the Null block, and the default block.
2019-11-26 11:49:27 -08:00