dabelknap / VMEStream

0 stars 1 forks source link

Add tests of data exchange functionality #2

Closed ekfriis closed 11 years ago

ekfriis commented 11 years ago

Hi Austin,

Here are some additional (failing) tests which I think should exercise the protocol. I wrote this quickly so please be advised that I may have gotten something wrong and don't take it as gospel. Here is the data exchange protocol description again for posterity.

2 registers MASTER_2_SLAVE_SIZE, SLAVE_2_MASTER_SIZE 2 RAMs MASTER_2_SLAVE_DATA, SLAVE_2_MASTER_DATA

When master wants to send N bytes of data to slave, it does the following:

1) single check if MASTER_2_SLAVE_SIZE == 0. If != 0, there is still unread data, repeat #1. 2) copy N bytes via VME block write to MASTER_2_SLAVE_DATA 3) set MASTER_2_SLAVE_SIZE = N

Slave loops, checking for MASTER_2_SLAVE_SIZE > 0. If so, it reads out MASTER_2_SLAVE_SIZE (N) bytes > from MASTER_2_SLAVE_DATA. When complete, it sets MASTER_2_SLAVE_SIZE back to 0.

When the slave wants to send data to the master, it works analogously but with the other register/RAM.

Let me know if this doesn't make sense!

Evan

ekfriis commented 11 years ago

Well, the amount transferred in each exchange should be min(data_in_tx_buffer, size_of_ram) where size_of_ram is determined in the FPGA firmware by Mathias. The examples I made assume that size_of_ram = 1 - this will definitely have to be updated. It should be somehow configurable in the protocol (maybe a member of the VMEStream state struct).

NB that regardless, cbuffer_pop_front will always return a single value. See here [1] for cbuffer_pop, which will return a buffer with more than one element.

[1] https://svnweb.cern.ch/trac/cactus/browser/trunk/cactuscore/softipbus/include/circular_buffer.h#L75

dabelknap commented 11 years ago

In this case size_of_ram = 1 means 1 word, correct?

ekfriis commented 11 years ago

Yes.

On Tuesday, August 20, 2013, Austin Belknap wrote:

In this case size_of_ram = 1 means 1 word, correct?

— Reply to this email directly or view it on GitHubhttps://github.com/dabelknap/VMEStream/pull/2#issuecomment-22948959 .

dabelknap commented 11 years ago

I got VMEStream to where it passes the tests.

ekfriis commented 11 years ago

Cool! Now I would try to update the tests to be a bit more general

1) size_of_ram > 1 2) a test where there is more space in the RAM than there is data to transfer (it should just transfer the right amount) 3) where there is not enough space in the RX buffer to read the input data (nothing should happen, the data should stay in limbo until there is enough space to read it out)

dabelknap commented 11 years ago

I added in a few more tests with these conditions. Everything appears to work fine.

On Aug 21, 2013, at 3:02 PM, Evan K. Friis notifications@github.com wrote:

Cool! Now I would try to update the tests to be a bit more general

1) size_of_ram > 1 2) a test where there is more space in the RAM than there is data to transfer (it should just transfer the right amount) 3) where there is not enough space in the RX buffer to read the input data (nothing should happen, the data should stay in limbo until there is enough space to read it out)

— Reply to this email directly or view it on GitHub.