Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with SLINK from V1.9.5.5 onwards #841

Closed
Unike267 opened this issue Mar 8, 2024 · 3 comments
Closed

Problem with SLINK from V1.9.5.5 onwards #841

Unike267 opened this issue Mar 8, 2024 · 3 comments
Labels
troubleshooting Something is not working as expected

Comments

@Unike267
Copy link
Contributor

Unike267 commented Mar 8, 2024

Hi @stnolting

I'm having problems with SLINK.

The same design in V1.9.5 works and from v1.9.5.5 onwards it doesn't work.

The design is a multiplier added with NEORV32 via SLINK. The FPGA is an ARTY A7 35-t.

It should be noted that I'm not using the tlast signal.

I think that the problems comes in this line L289, because I've simulated both design and I've obtained the following results:

  • In V1.9.5 the signal to write in TX FIFO is tx_fifo.we <= '1' when (bus_req_i.stb = '1') and (bus_req_i.rw = '1') and (bus_req_i.addr(2) = '1') else '0'; and we can see how this condition is satisfied and it is writing in the TX FIFO:

V1 9 5

The data flows through the SLINK (is multiplied 0001 X 0001 = 00000001):

V1 9 5_res

  • From v1.9.5.5 onwards the signal to write in TX FIFO is tx_fifo.we <= '1' when (bus_req_i.stb = '1') and (bus_req_i.rw = '1') and (bus_req_i.addr(3) = '1') else '0'; and this condition is not satisfied:

V1 9 9 5

Therefore, nothing is sent through SLINK.

I've modified the SLINK code replacing tx_fifo.we from tx_fifo.we <= '1' when (bus_req_i.stb = '1') and (bus_req_i.rw = '1') and (bus_req_i.addr(3) = '1') else '0'; to tx_fifo.we <= '1' when (bus_req_i.stb = '1') and (bus_req_i.rw = '1') and (bus_req_i.addr(2) = '1') else '0'; in V1.9.9.5 and it works.

I haven't done a PR because I know that you modified the tx_fifo.we condition for some reason. Could you explain me why? Why do you refer to bus_req_i.addr(3) instead of bus_req_i.addr(2)? Does it have something to do with tlast?

If yes, is it necessary to add this signal to the design?

Thank you so much!

Cheers! 😃


/cc @umarcor

@stnolting
Copy link
Owner

Hey @Unike267!

Please note that the low-level software access mechanism for the SLINK module has also changed in #815 (v1.9.5.5). The old software interface just used two memory-mapped registers:

typedef volatile struct __attribute__((packed,aligned(4))) {
  uint32_t CTRL;  /**< offset 0: control register (#NEORV32_SLINK_CTRL_enum) */
  uint32_t DATA;  /**< offset 4: data register */
} neorv32_slink_t;

Whereas the new one uses 4 registers with individual regs for RX data, TX data and last-TX data (yes, there is a typo in the comments 🙈):

typedef volatile struct __attribute__((packed,aligned(4))) {
  uint32_t CTRL;         /**< offset 0: control register (#NEORV32_SLINK_CTRL_enum) */
  uint32_t RX_DATA;      /**< offset 4: rx data register */
  uint32_t TX_DATA;      /**< offset 8: tx data register */
  uint32_t TX_DATA_LAST; /**< offset 12: tx data register + end-of-stream delimiter */
} neorv32_slink_t;

For the new version you need to write to address SLINK_BASE + 8 to put a data word into the TX FIFO. That's why the HDL code evaluates bit 3 instead of bit 2:

tx_fifo.we <= '1' when (bus_req_i.stb = '1') and (bus_req_i.rw = '1') and (bus_req_i.addr(3) = '1') else '0'

Are you using some kind of hand-crafted low-level accesses for the SLINK module? I have updated the SLINK driver files so the changes in the low-level interface should not be noticeable. 🤔

/**********************************************************************//**
* Write data to TX link (non-blocking)
*
* @param[in] tx_data Data to send to link.
**************************************************************************/
inline void __attribute__((always_inline)) neorv32_slink_put(uint32_t tx_data) {
NEORV32_SLINK->TX_DATA = tx_data;
}

@stnolting stnolting added the troubleshooting Something is not working as expected label Mar 8, 2024
@Unike267
Copy link
Contributor Author

Unike267 commented Mar 8, 2024

Please note that the low-level software access mechanism for the SLINK module has also changed in #815 (v1.9.5.5). The old software interface just used two memory-mapped registers:

Okay, I know what is going on!

The problem was that I hadn't recompiled the program with the new libraries.

Luckily I have an arty 100t in my house (good Christmas), I've generated a new app_image (compiling with container) and it works with the latest version:

res_mult

For the new version you need to write to address SLINK_BASE + 8 to put a data word into the TX FIFO. That's why the HDL code evaluates bit 3 instead of bit 2:

Okey, I understand.

Thank you very much for your quick feedback! 😄


EDIT:

Note that the tlast signal is not strictly necessary.

@Unike267 Unike267 closed this as completed Mar 8, 2024
@stnolting
Copy link
Owner

The problem was that I hadn't recompiled the program with the new libraries.
Luckily I have an arty 100t in my house (good Christmas), I've generated a new app_image (compiling with container) and it works with the latest version:

That's great! 🎉

Note that the tlast signal is not strictly necessary.

Right, just tie that input to zero if you do not need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
troubleshooting Something is not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants