Closed lorenzschmid closed 3 days ago
@tgingold-cern would be great to have your insights on this, thank you!
I think you can adapt wr_ack
. I don't see why the behaviour is not the one you'd like to have.
The wr_ack
delay is needed when there is a register because the strobe is the same as the ack. And the user of the strobe wants to get the new value (which is the output of the dff). So have one signal for ack and strobe (if this is the case) is a mistake.
Thanks for the quick reply. In that case I will prepare a merge request to adapt the wr_ack
behavior inside genreg.py
.
In the meantime, I implemented the changes in #49. Please let me know what you think about it.
A register map generated by cheby translates each request from the bus interface (APB, Wishbone, ...) to a request on an internal bus (
ibus
). Such a request on the internal bus takes only one cycle ("pulse") independently of when it is executed. While the request on the bus interface might be still active (until it is confirmed/responded to), the internal request vanishes after that one cycle. A write request on the internal bus consists ofwr_req
,wr_adr
,wr_dat
, andwr_sel
. Similarly, a read request consists ofrd_req
,rd_adr
, andrd_dat
. Following the request, the internal bus returns the response. Again, the response is only active during one cycle. It consists ofwr_ack
, andwr_err
for a write request and ofrd_ack
,rd_dat
, andrd_err
for a read request.Without pipelining, a request is executed immediately, i.e., the data will be written to the register upon the next rising clock edge, while the read data is returned immediately such that the response can be sampled upon the next rising clock edge as well. Using the
pipeline
attribute, the request, the response or both can be sampled before being acted upon/being returned.Looking at the
bus
, one would expect the following when settingpipeline: none
:Unfortunately, this is not true and it seems as if the write acknowledge signal,
wr_ack
, is first sampled and only returned one cycle later (even withpipeline: none
):Why is this a problem?
It seems more consistent to me that the write and read "response" behave the same, i.e. they are "instantaneous" while purely combinatorial paths can be avoided by using the appropriate
pipeline
settings. Right now, settingpipeline
towr-in
orwr-out
further increases the latency. But more importantly, the current setup makes it impossible to have a bus interface with consecutive single cycle write requests. Since the multiplexer returning thewr_ack
signal is combinatorially based onwr_adr
,wr_adr
has to remain constant for at least two cycles: One cycle for the correct routing of the request (wr_req
/wr_adr
/wr_dat
/wr_sel
) and a second cycle for the always sampledwr_ack
response. If not, thewr_ack
coming in the second cycle is not forwarded (and hence, lost) as the address of the next request might have changed the multiplexer.The following lines from
proto/cheby/hdl/genreg.py
are at the heart of the problem: Instead of creating a combinatorial path between the request,n.h_wreq
, and the response,n.h_wack
, the signal is sampled.In contrast, the read acknowledge generation inside the same file is combinatorial:
I see two possible solutions:
wr_ack
including all bus interfaces such that the interfaces' behavior remains unchanged.Changing the behavior of
wr_ack
might lead to unwanted side effects. Hence this issue, to further discuss possible solutions on who to realize consecutive single cycle write requests.Overall, I am wondering if I understood the current implementation correctly and if the delay of the
wr_ack
signal is intended and if yes, for what reasons (the comment mentions something about the strobe)?