Create double_buffer module
A double-buffer containing two FIFOs. An example use-case is the ability to read the latest telemetry via a single address (No incrementing address even if there are >256 bytes to read). In this example, while the bus (SW) reads the FIFO, the FW clear/writes the other FIFO. As soon as the FW finishes the new write, the bus switches to the newly written fifo (if no current read is ongoing).
Unittests needed:
-
FIFO: can a read occur in packet_mode=True even if the packet has not been completed -
Reading the D-B twice before the FW has had chance to update it - slave error? Or will the FW always be able to keep-up with the SW, by ensuring the other buffer is filled while the SW is reading the first buffer? -
Partial read of the FIFO - timeout before the FW switches the buffer to allow the chance for SW to continue.