aboutsummaryrefslogtreecommitdiffstats
path: root/host
Commit message (Collapse)AuthorAgeFilesLines
* rfnoc: Fix block buffer sizes referring to MTUWade Fife2022-03-048-17/+23
| | | | | | | 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.
* utils: Fix comment in noc_shell Mako templateWade Fife2022-03-041-0/+1
|
* examples: benchmark_rate improvementsmichael-west2022-03-031-95/+124
| | | | | | | - Added support for tx_spb and rx_spb arguments - Fixed TX thread timestamp for single channel Signed-off-by: michael-west <michael.west@ettus.com>
* rfnoc: Refactor ctrlport_endpoint; fix MT issuesAaron Rossetto2022-03-031-121/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit refactors ctrlport_endpoint and fixes several issues related to multiple threads sending and receiving control transfers. First, it refactors the change that Martin Braun implemented in 0caed5529 by adding a tracking mechanism for control requests where clients have explicitly asked to receive an ACK when the corresponding control response is received. When a client wants to wait for an ACK associated with a control request, a combination of that request's opcode, address, and sequence number is added to a set when the request is sent. When a control response is received, the set is consulted to see if the corresponding request is there by matching the packet field data listed above. If so, the control response is added to the response queue, thus notifying all threads waiting in `wait_for_ack()` that there is a response that the thread may be waiting on. If the request is not in the set, the request is never added to the response queue. This prevents the initial problem that 0caed5529 was addressing of the response queue growing infinitely large with control responses that would never be popped from the queue. Secondly, it addresses issues when multiple threads have sent a request packet and are waiting in `wait_for_ack()` on the corresponding response. Originally, the function contained a loop which would sleep the calling thread until the control response queue had at least one element in it. When awakened, the thread would pop the frontmost control response off the queue to see if it matches the corresponding control request (i.e., has the same sequence number, opcode, and address elements). If so, the response would be handled appropriately, which may include signalling an error if the response indicates an exceptional status, and the function would return. If the response is not a matching one, the function would return to the top of the loop. If the corresponding response is not found within a specified period, the function would throw an op_timeout exception. However, there is a subtle issue with this algorithm when two different calling threads submit control requests and end up calling `wait_for_ack()` nearly simultaneously. Consider two threads issuing a control request. Thread T1 issues a request with sequence number 1 and thread T2 issues a request with sequence number 2. The two threads then call `wait_for_ack()`. Let's assume that neither of the control reponses have arrived yet. Both threads sleep, waiting to be notified of a response. Now the response for sequence number 1 arrives and is pushed to the front the response queue. This generates a signal that awakes one of the waiting threads, but which one is awakened is completely at the mercy of the scheduler. If T1 is awakened first, it pops the response from the queue, finds that it matches the request, and handles it as expected. Later, when the reponse for sequence number 2 is pushed onto the queue, the still-sleeping T2 will be awakened. It pops the response, finds it to be matching, and all is well. But if the scheduler decides to wake T2 first, T2 ends up popping the response with sequence number 1 off the front of the queue, but it doesn't match the request that T2 sent with sequence number 2, so T2 goes back to the top of the loop. At this point, it doesn't matter if T2 or T1 is awakened next; because the control response for sequence number 1 was already popped off the queue, T1 never sees the control response it expects, and will throw uhd::op_timeout back up the stack. This commit modifies the `wait_for_ack()` algorithm to search the queue for a matching response rather than indiscriminately popping the frontmost element from the queue and throwing it away if it doesn't match. That way, the order in which threads are awakened no longer matters as they will be able to find the corresponding response regardless. Furthermore, when a response is pushed onto the response queue, all waiting threads are notified of the condition via `notify_all()`, rather than just waking one thread at random (`notify_one()`). This gives all waiting threads the opportunity to check the queue for a response. Finally, the `wait_for_ack()` loop has been modified such that the thread waits to be signalled regardless of whether the queue has elements in it or not. (Prior to this change, the thread would only wait to be signalled if the queue was empty.) This effectively implements the behavior that all threads are awakened when a new control response is pushed into the queue, and combined with the changes above, ensures that all threads get a chance to react and check the queue when the queue is modified.
* N310: Deactivate frontend components on radio shutdownmattprost2022-03-033-0/+35
| | | | | | | | Make sure no active components are connected to the TX frontend during next boot. This avoids configurations that could generate unwanted tones during operations such as the Mykonos init cals. Signed-off-by: mattprost <matt.prost@ni.com>
* rfnoc: window: Set window size register after loading coefficientsJonathon Pendlum2022-03-022-0/+11
|
* host: test: Add GPIO DDR register to x4xx mockLane Kolbly2022-03-021-0/+6
| | | | | | | | | This is useful for unit testing certain code which operates the DDR registers, in particular code which performs a read-modify-write operation on that register. Conceivably we could add more registers here, but I'm just doing one at a time.
* examples: replay: Improve rfnoc_replay_samples_from_fileMartin Braun2022-03-021-127/+87
| | | | | | | | | | - Use connect_through_blocks() to create connections - Remove check for spp being an integer multiple of the word size, the atomic item size feature will do that for us now - When using --nsamps, automatically terminate application after samples have been tx'd. - Added sleep statements to throttle empty while loops - Minor formatting changes
* rfnoc: replay: Add atomic item size propertyMartin Braun2022-03-021-0/+37
| | | | | | | This adds the atomic item size property to the replay block, which was originally introduced in 3e5e4eb. The effect is that it enforces streaming data to and from the block that is an integer multiple of the word size.
* uhd: fix negligible copy/paste typos in rhodium radio controlDavid Raeman2022-02-282-4/+4
|
* tests: Add saturating test casesAaron Rossetto2022-02-281-0/+137
| | | | | This commit adds test cases to convert_test to specifically test the saturating behavior of the fc32/fc64-to-sc16 conversions.
* convert: Make narrowing conversions saturateAaron Rossetto2022-02-282-14/+24
| | | | | This commit modifies the explicitly written narrowing conversions to clamp the results to the limits of the signed integer type.
* tests: Add conversion benchmarking testsAaron Rossetto2022-02-281-38/+571
| | | | | | | | | | | | | This commit adds Boost test cases for benchmarking each of the existing conversions that are tested in convert_test. The benchmarks do take some time, and we do not want to run they as part of every CI run, so they are marked with a test decorator that disables the benchmark by default. To run the benchmarks, invoke convert_test with `--run-test=+benchmark*` to explicitly enable all disabled tests that begin with the word 'benchmark'. Individual benchmark test cases can be enabled by specifying the full name of the benchmark test or by crafting a wildcard that includes all benchmark test cases of interest.
* convert: Add benchmarking abilitiesAaron Rossetto2022-02-281-10/+97
| | | | | This commit adds code to the convert tests to support the ability to benchmark individual conversion test cases.
* tests: Force converter tests to be run with all available priosMartin Braun2022-02-281-49/+91
|
* convert: Minor cleanupAaron Rossetto2022-02-282-115/+38
| | | | | | | | | | | | | | | | | | | This commit implements some minor cleanup of various converter- and convert test-related code: * Improves the log messages regarding which converter was returned for a request. * Modifies the result checking code in the converter tests to only report an out-of-range sample error once, rather than reporting every out-of-range sample encountered during the test. This vastly cuts down on the output when a conversion has failed. * Adds a function `reverse_converter()` which, given a `convert::id_type` describing a conversion from C1 to C2, returns a `convert::id_type` describing the reverse conversion (C2 to C1). * Removes two redundant test cases from the converter test.
* conversion: Saturate transmit IQ levels on NEON architectures.Ron Economos2022-02-281-4/+4
| | | | Signed-off-by: Ron Economos <w6rz@comcast.net>
* Build uhd_test library as static when `-DBUILD_SHARED_LIBS=ON`David Seifert2022-02-241-1/+1
| | | | | * A uhd_test.so lacks the necessary symbols for testing due to default visibility set to hidden.
* docs: Improve documentation for replay blockMartin Braun2022-02-241-15/+73
| | | | | | | - Add notes on playback and record behaviour - Improve docs for play() Co-authored-by: Wade Fife <wade.fife@ettus.com>
* rfnoc: replay: Add action handler for stream commandsMartin Braun2022-02-241-0/+26
| | | | | | | | When connecting an Rx streamer to a replay block, this now allows requesting data from the replay block using a stream command. This will automatically request data from all ports the streamer is connected to, and even if there are blocks in between (depending on their action forwarding policies).
* python: rfnoc: Add connect_through_blocks() and get_block_chain()Martin Braun2022-02-242-2/+16
| | | | These RFNoC C++ API calls were previously not exported into Python.
* rfnoc: graph_utils: Add ability to declare back-edgesMartin Braun2022-02-242-4/+13
| | | | | | | 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().
* docs: Remove superfluous stylesheetMartin Braun2022-02-241-102/+0
| | | | | This was left over from when the manual was ported to Doxygen in a74919c2. It is not used by Doxygen.
* cmake: doxygen: Make MATHJAX_RELPATH configurable via CMakeMartin Braun2022-02-242-1/+5
| | | | | | | | | | | | | | | | | This is a Doxygen setting where to find MathJax. The default might not be suitable for everyone, and in particular, if people already have MJ installed on their local system, they might prefer using that instead of an online one. Example usage: Assume you have MathJax installed locally, e.g., through the mathjax package on Fedora, or the libjs-mathjax package on Debian/Ubuntu. Then you could build UHD as such: cmake -DMATHJAX_RELPATH=/usr/share/javascript/mathjax This will now use the local version. Note that locally generated HTML documentation can now no longer be copied to other machines, unless they also have MathJax installed to the same path.
* cmake: ncurses: fix building with split tinfoRick Farina (Zero_Chaos)2022-02-242-0/+2
| | | | | This fixes an issue where tinfo and ncurses are split into separate libraries.
* python: Read number of ports from grc file in image builderAndré Apitzsch2022-02-241-0/+4
|
* python: Fix RuntimeError: dictionary changed size during iterationAndré Apitzsch2022-02-241-1/+1
| | | | Iterate over copy and delete from original dictionary.
* rfnoc: Remove references to nocscript from YAML filesMartin Braun2022-02-2323-23/+0
| | | | | The sw_iface entry in the `control` section is yet underdefined, so we can remove it from the block descriptors.
* Remove FSRU-related filesMartin Braun2022-02-221-3/+0
| | | | | | | The FSRU (aka EISCAT) was never supported in UHD 4.0. The FPGA repository never had the relevant files, and the block controller also never existed. This removes all the corresponding files from MPM, as well as some references from makefiles.
* docs: x310: Remove reference to ORCMartin Braun2022-02-211-1/+1
| | | | UHD no longer depends on ORC since 41812aa2f (merged 2015).
* docs: Update n3xx tuning notesSteven Koo2022-02-161-4/+8
| | | | | | | n32x is specced to 3 Mhz. Added a note about performance below specced frequency minimums Signed-off-by: Steven Koo <steven.koo@ni.com>
* rfnoc: Fix spelling in property resolution error messageMartin Braun2022-02-111-1/+1
|
* docs: Remove full path names from Doxygen generationMartin Braun2022-02-111-1/+1
| | | | | The full path names can cause non-reproducible builds, because they include the build directory.
* rfnoc: Expose buffer parameters for DRAM FIFO blockWade Fife2022-02-101-0/+2
|
* fpga: e31x: Add DRAM supportWade Fife2022-02-101-0/+4
| | | | | | | | | 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
* fpga: rfnoc: Add BLANK_OUTPUT to FIR filter block's parametersJonathon Pendlum2022-02-101-0/+1
|
* host: Throw exception when accessing properties with incorrect typeLane Kolbly2022-02-074-14/+55
|
* host: Minor cleanups in property_tree codeLane Kolbly2022-02-073-18/+30
|
* cmake: Remove libatomic check on macOSSteven Koo2022-02-071-1/+1
| | | | | | | This removes the libatomic check on macOS. Like MSVC, just assume that it's built in. Signed-off-by: Steven Koo <steven.koo@ni.com>
* utils: Add space to rfnoc_image_builder helpWade Fife2022-02-071-1/+1
|
* fpga: x400: Add DRAM supportWade Fife2022-02-071-0/+4
|
* rfnoc: Rename and enlarge axi4_mm IO signatureWade Fife2022-02-0711-18/+17
|
* uhd: Harmonize fuzzy frequency comparisonsMartin Braun2022-02-049-43/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* math: fp_compare: Adapt fp_compare_epsilon API to actual useMartin Braun2022-02-043-32/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* uhd: rfnoc: Let connect_through_blocks() return edge listMartin Braun2022-02-042-2/+10
| | | | | | 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.
* host: x4xx: Fix some warnings on mac OSLane Kolbly2022-02-042-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following warnings: ``` /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2335:5: warning: \ delete called on non-final 'uhd::rfnoc::x400::x400_gpio_port_mapping' that has \ virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor] delete __ptr; ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2648:7: note: in \ instantiation of member function 'std::__1::default_delete<uhd::rfnoc::x400::x4\ 00_gpio_port_mapping>::operator()' requested here __ptr_.second()(__tmp); ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2602:19: note: in\ instantiation of member function 'std::__1::unique_ptr<uhd::rfnoc::x400::x400_g\ pio_port_mapping, std::__1::default_delete<uhd::rfnoc::x400::x400_gpio_port_map\ ping> >::reset' requested here ~unique_ptr() { reset(); } ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:4063:21: note: in\ instantiation of member function 'std::__1::unique_ptr<uhd::rfnoc::x400::x400_g\ pio_port_mapping, std::__1::default_delete<uhd::rfnoc::x400::x400_gpio_port_map\ ping> >::~unique_ptr' requested here unique_ptr<_Yp> __hold(__p); ^ /Users/rfmibuild/myagent/_work/76/s/host/lib/usrp/x400/x400_radio_control.cpp:1\ 92:33: note: in instantiation of function template specialization 'std::__1::sh\ ared_ptr<uhd::mapper::gpio_port_mapper>::shared_ptr<uhd::rfnoc::x400::x400_gpio\ _port_mapping>' requested here auto gpio_port_mapper = std::shared_ptr<uhd::mapper::gpio_port_mapper>( ``` and: ``` /Users/rfmibuild/myagent/_work/76/s/host/lib/usrp/x400/x400_gpio_control.cpp:15\ 4:75: warning: adding 'const uint32_t' (aka 'const unsigned int') to a string d\ oes not append to the string [-Wstring-plus-int] "Could not find corresponding GPIO pin number for given SPI pin " + value); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ /Users/rfmibuild/myagent/_work/76/s/host/lib/usrp/x400/x400_gpio_control.cpp:15\ 4:75: note: use array indexing to silence this warning "Could not find corresponding GPIO pin number for given SPI pin " + value); ^ & [ ] ```
* host: zbx: Expose tuning table on property treeLane Kolbly2022-02-035-5/+87
| | | | | This allows viewing or, conceivably, customizing the tuning table that ZBX uses, depending on the particular needs of the end user.
* python: rfnoc: Add get_property bindingsWade Fife2022-02-011-0/+60
|
* docs: Add shim Sphinx config for readthedocsMartin Braun2022-02-015-0/+223
| | | | | | | | | This adds a faux Sphinx project under host/docs. When invoking sphinx, it will in fact forward the generator request to Doxygen. This is useful for generating the UHD manual, e.g., on readthedocs. To enable the latter service, .readthedocs.yaml and environment.yml files were added as well.
* rfnoc: Update the MTU forwarding property for some blocksMartin Braun2022-02-018-0/+25
| | | | | | | | | | | | | | | | Note that the default MTU forwarding policy is ONE_TO_ONE, therefore, it is only strictly necessary to modify the MTU forwarding policy for blocks that route data in a different manner. However, it may be nice to explicitly state the forwarding policy for the benefit of the reader. The following blocks had their policies updated: - addsub: ONE_TO_FAN - duc: ONE_TO_ONE - dmafifo: ONE_TO_ONE - null block: DROP - replay block: DROP - split stream: ONE_TO_FAN - switchboard: ONE_TO_FAN