Add APB3 to AXI Stream peripheral to Murax (with FIFO) #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is an effort to add AXI Stream interfaces to Murax SoC. The scheme of the resulting design is as follows:
The example software to test the peripheral is the following:
Based on https://github.com/SpinalHDL/VexRiscvSocSoftware/blob/master/projects/murax/demo/src/main.c
Based on https://github.com/SpinalHDL/VexRiscvSocSoftware/blob/master/projects/murax/libs/murax.h
New
axis.h
file added to https://github.com/SpinalHDL/VexRiscvSocSoftware/tree/master/libs:The objective of this extension is to support:
This PR was tested in a VUnit testbench with AXI Stream Verification Components. Precisely, the FIFO in array_axis_vcs was replaced with the VHDL generated with SpinalHDL. GHDL was used for simulation.
Although it is functional, I feel that this PR could be significantly improved. The current procedure for a read transaction is as follows:
AXIS->IN_VALID
to betrue/high
.axis_input
and the APB3ctrl
is empty, soaxis_input.ready
istrue
.axis_input
, i.e. valid data is presented inaxis_input.data
andaxis_input.valid
is driven high for a clock period.AXIS->IN_VALID
to be true. Then, the content is read fromAXIS->IN_DATA
.AXIS->IN_VALID
is still true. Therefore, the RISCV core drivesAXIS->IN_READY
to true. As defined inclass Apb3Axis
, as soon asready
is driven totrue
, it is reset by hardware due tovalid
beingtrue
. At the same time,valid
is driven tofalse
by theStreamFifo
, becauseready
andvalid
wheretrue
during a clock cycle.On the one hand, this does not fulfill the specification, because a slave should drive
ready
totrue
when it is ready to receive some data, without waiting forvalid
. Also, data should be read when bothready
andvalid
aretrue
. Fortunately, this is only an issue between the RISCV core and StreamFifos; external interfaces are correct. It would be a problem if FIFOs where removed, in order to provide unbuffered streams.On the other hand, I wonder if I am missing some software libraries that would allow me to handle reading from and writing to
StreamFifo
as read/writes to memory-mapped registers. Ideally, this would be supported:Note that in this example both reads and writes would be blocking. In order to support non-blocking transactions an additional register would be needed to display the status of both streams.
Overall, I think that the two issues described above are constrainted by the actual implementation. These alternatives for some of the new parts in
Murax.scala
where suggested in gitter.However, I could not guess the software procedures to drive them. Moreover, I wonder whether
ctrl.writeStreamNonBlocking(io.input.queue(128), address = 4)
could exist.