Hi Rob, and various Ettus folk,

(Resurrecting an old unreplied thread here...)

This exact issue came up to bite me this this week and I'm curious how this
would be implemented. I consider this a solvable bug in RFNOC in its
current state.

Initially, I expected that if I have a nocscript arg that includes an
"SR_WRITE" action on a specific port, then the action would be applied to
the corresponding port:

```
    <arg>
      <name>enable</name>
      <type>int</type>
      <value>0</value>
      <check>GE($enable, 0) AND LE($enable, 1)</check>
      <action>SR_WRITE("ENABLE_OUTPUT", $enable)</action>
      <port>1</port>
    </arg>
```

This only ever writes to port 0 (consistent with a "sr_write" call without
a specified port).

Secondly I tried hardcoding the port input to SR_WRITE like so:

```
    <arg>
      <name>enable</name>
      <type>int</type>
      <value>0</value>
      <check>GE($enable, 0) AND LE($enable, 1)</check>
      <action>SR_WRITE("ENABLE_OUTPUT", $enable, 1)</action>
      <port>1</port>
    </arg>
```

And this becomes a runtime crash, of course, because the code here clearly
indicates that the NocScript SR_WRITE does not support a "port" argument:
https://github.com/EttusResearch/uhd/blob/master/host/lib/rfnoc/nocscript/block_iface.cpp#L28

So I see two potential solutions...
1. Use the "<port>X</port>" field of the nocscript to indicate which port
the SR_WRITE applies to (a nice solution)
2. Add an optional "port" input to the SR_WRITE argument, similar to the
"SET_ARG" and "SET_VAR" commands (then my second solution would apply)

Any thoughts? I couldnt puzzle out how #1 would work in the nocscript
architecture, but #2 seems pretty straightforward to me

By the way, the workaround I found is to instantiate a block controller
that adds a "set_coerced_subscriber" onto the "enable/value" property tree
which calls the *correct* sr_write function with the corresponding port.

EJ


On Thu, Jul 26, 2018 at 12:04 PM Rob Kossler via USRP-users <
usrp-users@lists.ettus.com> wrote:

> When trying to set a custom register in a noc block with multiple ports, I
> noticed that there is no noc script SR_WRITE that includes the port
> argument.  Is this on the list to be added?
>
> Rob
> _______________________________________________
> USRP-users mailing list
> USRP-users@lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
_______________________________________________
USRP-users mailing list
USRP-users@lists.ettus.com
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

Reply via email to