Commit graph

188 commits

Author SHA1 Message Date
Grant Meyerhoff
5ededca7db host: remove deprecated setName usage
As of Python3.10, setName has been deprecated in favor of using name directly as a property
2025-01-09 16:13:34 +01:00
Grant Meyerhoff
e40121441e host: update python formatting 2025-01-09 16:13:34 +01:00
Jörg Hofrichter
8e780be0bc image builder: create build(...) directories in the current directory
Introduce a new parameter --base-dir BASE_DIR.

If the parameters --build-dir BUILD_DIR / --build-ip-dir BUILD_IP_DIR
/ --build-ouput-dir BUILD_OUTPUT_DIR are not set explicitly, they will
be set to these values per default:

- BUILD_DIR=<BASE_DIR>/build-<IMAGE_CORE_NAME>
- BUILD_IP_DIR=<BASE_DIR>/build-ip
- BUILD_OUTPUT_DIR=<BASE_DIR>/build

BASE_DIR defaults to the current directory if the parameter --base-dir
is not set. This means that per default, the build(...) directories
are generated in the current directory.
2024-12-20 10:20:59 +01:00
Jörg Hofrichter
86b06169d0 image builder: print build directories used after build
The directories which are used for the build are printed before
executing the build. However, the build generates hundrets of
lines of output which typically exceeds the scrollback length
of the terminal. Hence, print the directories again after the
build finished.
2024-12-20 10:20:59 +01:00
Lars Amsel
c36e40a5fc cmake: Set classifiers in pyproject.toml
This sets classifiers in pyproject.toml. Most of them
are static except for the development status. The status
is set to 2 (pre alpha) as a default. Only if UHD_RELEASE_MODE
is set it changes to 4 (beta) if we are on a release canditate tag
or 5 (release) if we are on release tag. If we aren't on any tag
or the tag does not meet the correct formatting we stay on 2
and a warning is issued.
2024-12-13 15:53:09 +01:00
Clemens Felber
99d2ecae68 host: python: Add version check for UHD Python bindings 2024-12-12 11:43:33 +01:00
Martin Braun
0fdd63477f image builder: Fix include path handling
There was an issue with include paths, where providing `-I` would not do
the right thing for all types of files. In particular, it was not
possible to do `rfnoc_image_builder -I <path/to/oot>`, which is the
purpose of this command line argument.
2024-12-10 13:58:44 +01:00
Martin Braun
faddb6d2f0 image builder: Improve error message for missing YAML
Previously, if a block in an image core file would reference an unknown
YAML file, the user would get a very unhelpful error messages like this:

   Error parsing image configuration: 'foo.yml'

With this fix, the error message is improved and looks like this:

   Invalid configuration: The block gain0 has an unknown block \
description: gain.yml.
2024-12-10 13:58:44 +01:00
Martin Braun
a811d05b04 image builder: Add 'quote' (or 'q') filter
This is a filter for all templates that will produce the output with
quotes. This is particularly useful for rendering strings that are used
for string parameters in Verilog, which require quotes (or they are
interpreted as an expression).
2024-12-10 13:58:44 +01:00
Martin Braun
7f40aa2001 image builder: Provide a wrapper around mako.template
This allows us to customize the usage of Mako for the image builder in
a central location.
2024-12-10 13:58:44 +01:00
Martin Braun
09bd68aa2d rfnoc: modtool: Fix various issues with block creation
- icores/CMakeLists.txt now contains the correct macro example
- The CMakeLists.txt file for the gateware itself is now created, and
  will dynamically contain the correct argument for
  RFNOC_REGISTER_BLOCK() depending on --skip-testbench
- To enable this, the fpga/<module_name>/CMakeLists.txt is now also
  properly updated on `rfnoc_modtool add`
   - This was facilitated by adding the `append` step option
- The autogenerated Makefile.srcs has the correct file endings now (.sv
  instead of .v)
- There was a bug in the autogenerated Python block controller wrapper,
  which referenced the wrong namespace
- Fix more missing commas in generated HDL.
2024-12-10 13:58:44 +01:00
Lars Amsel
22396d4666 host: python: Add pyproject.toml to enable poetry builds
This adds a pyproject.toml to generate Python wheels using poetry.
The toml file is generated by cmake to add build dependend information to the
file. On Windows the build process invokes poetry using the configured
Python executable. The existing distribution way (copy python data
to site-packages folder of UHD installation) is not changed yet.
2024-12-10 13:02:52 +01:00
Marian Koop
d435d85504 all: use uhd.maintainer@emerson.com as new maintainer email
Replaced instances of email address packages@ettus.com with new
corporate email address uhd.maintainer@emerson.com.

For some yet undefined transition time emails to the old address
are being forwarded to the new one.
2024-12-03 09:23:49 +01:00
Martin Braun
5f38bb842a image builder: Fix error message for missing control SEP
When attempting to generate an image core file with no control SEPs
(which is illegal), the image builder would throw an exception while
trying to produce the proper error message. The exception would look
like this:

File "[...]/site-packages/uhd/rfnoc_utils/builder_config.py", \
                                     line 330, in _check_configuration
    failures += [
TypeError: can only concatenate str (not "list") to str

This fixes the error, such that a regular error messages is shown now in
case of missing control SEPs.
2024-11-07 12:36:19 +01:00
Martin Braun
cc354e70ad image builder: Re-implement GRC support
This adds support for generating RFNoC bitfiles from GNU Radio Companion
(.grc) files. Note that this requires changes to GNU Radio as well
(updated block definition files for the GRC bindings).

There is a new mini-feature in the image builder itself: The option to
dump the YAML file into the build directory. For the GRC import, this
makes sense, because it allows reading the UHD YAML represenation of a GRC
image core.
2024-11-07 12:36:19 +01:00
Martin Braun
4f4b00b772 image builder: Improve error reporting for invalid connections 2024-11-07 12:36:19 +01:00
Martin Braun
f894f8c101 image builder: Add reload_dict() and read_yaml() to yaml_utils 2024-11-07 12:36:19 +01:00
Martin Braun
e08b7bb806 image builder: Allow default clocks in domain checks
This fixes an issue where default clocks would not get detected
properly when checking for correct clock domain connections (change
added in ce96d9bf). The following error message could be observed with
some image cores:

[error] Invalid clock domain connection: _device_:rfnoc_chdr → ddc0:ce
(rfnoc_chdr is not a clock output)
[error] Invalid clock domain connection: _device_:rfnoc_chdr → duc0:ce
(rfnoc_chdr is not a clock output)

Clearly, _device_.rfnoc_chdr is a valid clock output, but it was not
detected because default clocks are stored differently from non-default
clocks.
2024-11-05 15:30:50 +01:00
Martin Braun
c74883092f image builder: Improve parameter resolution
- Default BSP parameters are now also resolved and can make use of
  previously defined BSP parameters
- Regular block parameter resolution is simplified
2024-11-05 15:30:50 +01:00
Martin Braun
cca9ff06e0 image builder: Improve IO port compat check
This improves error checking and -messages for IO ports. In particular,
this will now be able to check wire widths for compatibility. Imagine
you have a BSP with a radio connection of 1 SPC, 64-bit CHDR width, and
attempt to instantiate a radio block with 2 SPC (and also 64-bit CHDR
width). Without this changeset, the misconnection would either be caught
by the bitfile generation process, or not at all (e.g., if we are
connecting a narrow bus to a wider one, we would simply connect the
least significant bits).

With this changeset, a clear error message is given immediately when the
YAML is parsed such as this:

   Connection _device_:radio0 → radio0:radio has a wire width mismatch.
   Source port radio_rx_data_radio0 has width 64, destination port
   radio_rx_data has width 128.
2024-11-05 15:30:50 +01:00
Martin Braun
ce96d9bf04 image builder: Improve clock connection checks
This adds more checks for clock connections:

- When an input clock is not connected, a warning is now produced, like
  this:

  ⚠   Unconnected clock input: gain0.ce

  Previously, this would go without any warning.

- When source or destination block are incorrectly specified, the error
  message is improved to give a much clearer indication which line of
  the input file is wrong:

     Invalid clock domain connection: _device_:ce → gaen0:ce
  (destination block is not defined)

- When two input or output clocks are connected, this is now also
  flagged as an error:

     Invalid clock domain connection: radio0:radio → gain0:ce (radio
  is not a clock output)

- When a block specifies a timebase or control clock (as the radio
  blocks on X4x0 do, for example) we now check the validity of the
  clocks. If an invalid or unknown clock is provided, there is now
  a clear error message:

     Invalid timebase_clock for block radio0: _device_.tb_clk

- Clock checking is now performed on all modules, transport adapters,
  and blocks with the same rules applying to all of them.

- Because of all the new features, the clock management code was
  simplified to recoup some complexity. The `self.clocks` object was
  discarded, and all blocks, modules, and transport adapters now store
  all clock information on themselves. For example,
  `self.noc_blocks["radio0"].clocks` would provide all information on
  the clocks for radio0. This change also makes the builder object more
  similar to the YAML file (there is no "clocks" object in the YAML).

- As a result of the previous change, the template code for generating
  clock indices for control and timebase clock was simplified, and the
  logic for looking up the correct index was moved into
  builder_config.py.
2024-11-04 10:09:26 +01:00
Martin Braun
62641f8ffb image builder: Add nodevice argument to get_module_list()
The method ImageBuilderConfig.get_module_list() can now take
a 'nodevice' argument, which is a wildcard argument for "return all
blocks and modules, but not the device".

The docstring is also updated.
2024-11-04 10:09:26 +01:00
Martin Braun
945e873655 image builder: Fix linter issues 2024-11-04 10:09:26 +01:00
Javier Valenzuela
19d7dd6d49 image builder: Add SYNTH and CHECK build options 2024-10-25 08:03:20 -05:00
Martin Braun
2530baeee1 image builder: Add additional checks for duplicate connections
This adds code to check if sources or destinations are referenced
multiple times in the connection list of a YAML file, and provides more
useful error messages if that is the case.
2024-10-23 12:04:08 +02:00
Martin Braun
abae1a38d9 image builder: Factor out connection-check code
This creates common.py and connections.py and moves code from
builder_config.py into those files. This is to facilitate future
modifications in the image builder.
2024-10-23 12:04:08 +02:00
Joerg Hofrichter
d97b635639 rfnoc-modtool: fix multi_rename
Make sure files are renamed before renaming the directories
which are containing these files.
2024-10-15 14:11:40 +02:00
Joerg Hofrichter
2b2cfadc47 image builder: add default fpga target for device x410 and x440 2024-10-15 14:07:28 +02:00
Wade Fife
d6ba2dfb5c Fix instances of sim preamble 2024-09-17 08:43:22 -05:00
Martin Braun
f0066cf16d rfnoc: modtool: Fix generation of NoC shells
Without this fix, there will be missing commas in the NoC-shells signal
list.

When trying to build an image, Vivado will fail with an error similar to:

ERROR: [VRFC 10-2063] Module <noc_shell_***> not found while
 processing module instance <noc_shell_***_i>

This fixes the missing commas.
2024-09-09 11:50:45 +02:00
Wade Fife
945849586c image builder: Put dependencies first in Makefile SRCS list 2024-09-06 17:58:33 -05:00
prefix
b380c7a762 host: add octoclock python api
Co-authored-by: Joerg Hofrichter <joerg.hofrichter@ni.com>
2024-09-05 14:45:45 +02:00
Martin Braun
1fb022a35f Add rfnoc-modtool
This replaces rfnoc_modtool that was previously shipped with gr-ettus.
It is fully RFNoC/UHD4.x compatible. There is no shared code between
this version and the old one; this is a clean rewrite.

As of now, it lacks many of the features that were available with the
previous version, most importantly, the ability to generate GNU Radio
bindings.
2024-09-02 08:22:58 +02:00
Martin Braun
38b89ae965 cmake: Make UHDPython.cmake available to OOTs
This installs UHDPython.cmake to lib/uhd/, so that OOT RFNoC modules can
use it (and don't have to use a version that ships with the OOT). This
makes maintanance of that file a lot easier.

Now that this file can (and should) be used outside of UHD, we
"namespace" the macros and functions by prefacing them with 'UHD_'
(e.g., there's now UHD_PYTHON_CHECK_MODULE).

This file requires creating UHDMinDepVersions.cmake, which also gets
installed.
2024-09-02 08:22:58 +02:00
Martin Braun
82f9c15e55 python: Rename imgbuilder to rfnoc_utils
We will be sharing code between rfnoc_image_builder, modtool, and
blocktool so the name is no longer appropriate.
2024-09-02 08:22:58 +02:00
Max Köhler
4abb089a8c image builder: always put transport adapter last 2024-08-21 13:52:59 +02:00
Marian Koop
c6bea44c61 [imgbuilder] fixup: Do not fail on dynamically generated version-info.dtsi files.
Implement workaround to commit 3cb868e and do not report error
on missing *-version-info-dtsi files. These include files are listed
in the bsp (board support package) for X4xx devices, but are dynamically
generated at build time (in the dts source folder).
2024-08-13 13:40:47 +02:00
Grant Meyerhoff
09f125f631 python: Add windows dll import logic
In python3.8, a change was made to the DLL search path, which requires using os.add_dll_directory to add a non-default path.
2024-08-01 17:55:58 +02:00
Martin Braun
3cb868e1fb image builder: Improve handling of include paths
- The main installation path is now always an include path and can be
  used as such (e.g., /usr/share/uhd/rfnoc)
- fpga_includes and dts_includes have been streamlined. They now work
  identically on all blocks/modules/_device_, and can use resolve() the
  same way as other arguments do.
- Error messages for missing include files are improved.
2024-07-26 22:08:29 +02:00
Martin Braun
0c010d2ece image builder: Fix deprecated usage of yaml.load()
With ruamel.yaml versions >= 0.18, the current image builder doesn't
work, because it uses a deprecated call.

This call was part of a wrapper that fixes Python 3.5-compatibility.
Since our minimum version of Python is now 3.6, we don't need this
anyway so we just can just replace the deprecated usage with
ruamel.yaml's round-trip loader.
2024-07-25 17:11:47 +02:00
Martin Braun
6e920a41af image builder: Apply Python autoformatting
Also fixes some of the more simpler linter issues.
2024-07-17 12:02:46 +02:00
Martin Braun
6758966a5a image builder: Allow missing connections
The image builder will currently emit a warning if a NoC-block has
unconnected ports. This requires specifying `-W` to continue building,
which is the intended behaviour.

However, there are cases where there are legitimate reasons to not
connect a block, e.g., in the X310, where the radio block has 2x2 ports,
but we only connect 2 RX ports, and 1 TX port.

This adds a way to declare a "null" connection, which makes it explicit
in the image core YAML that a connection was deliberately omitted. Such
connections are created by connecting to a port called "_none_", e.g.:

```
connections:
  - { srcblk: _device_,  srcport: _none_, dstblk: radio0, dstport: in_1 }
```

The block name is irrelevant, but the schema requires providing a block
name.

This commit also amends the x3xx_radio_base.yml to avoid warnings when
building X3x0 bitfiles.
2024-06-26 15:08:39 +02:00
Martin Braun
b3c663d14b image builder: Improve error checking during build
- If there are any warnings during the image core parsing, the build is
  now skipped unless --no-warnings (-W) is also given.
- Exceptions in the ImageBuilderConfig are now caught in
  rfnoc_image_builder and an error message is logged, instead of
  printing the Python exception backtrace.
2024-06-25 17:19:51 +02:00
Martin Braun
942502f121 image builder: Provide default for -K
When -S is provided without -K (--secure-core without --secure-key), the
build fails without comment. This provides a default value for -K based
on the default Vivado key.
2024-06-25 17:19:51 +02:00
Martin Braun
d0e9a8d8fe image builder: Add ability to run checks on BSP level
The 'checks' section that was available for block definition YAMLs is
now also available at the BSP level.
2024-06-25 17:19:51 +02:00
Martin Braun
84bf24402e image builder: Improve missing-connection logging
When an image core file has a missing, required IO port connection, the
tool will now suggest which ports may be sensible options for
connecting.

When there is a single available option, it will even suggest which line
to add to the image core YAML to fix.
2024-06-25 17:19:51 +02:00
Martin Braun
66597a484a image builder: Add improved error checking
- Blocks, modules, and transport adapter YAMLs may include a `checks`
  section and define validation checks there
- IO ports can declare if they require a connection or not
- Unconnected NoC-Block data ports trigger a warning now
2024-06-25 17:19:51 +02:00
Martin Braun
c545a115f4 image builder: Improve logging
- Demote some info logs to debug that are not really required for
  regular operation.
- Reformat some log messages for better readability
2024-06-25 17:19:51 +02:00
Marian Koop
52467d3261 python: Update pyuhd wrapper functions to make freq tuning use timedcmds 2024-06-11 10:20:08 +02:00
Martin Braun
94b4de39d6 image builder: Add --build-ip-dir option
Co-authored-by: Wade Fife <wade.fife@ni.com>
2024-06-11 10:20:08 +02:00