Open samuelgruetter opened 2 years ago
I haven't really looked at this PR yet but I noticed yesterday that runUntilResp
is behaving wrong with respect to the TL protocol. The function should only send the h2d packet with a_valid=1
until it gets a d2h packet with a_ready=1
, and then it should keep sending h2d packets with a_valid=0
and d_ready=1
, until it gets back a d2h packet with d_valid=1
. Also note that the tlul_adapter_reg implementation sends the a_ready=1
signal in the d2h packet prior to the h2d with a_valid=1. So runUntilResp
must start by sending a nop_h2d (i.e. a_valid=0
), check the a_ready in the returned packet, to determine if the next h2d packet will be received, and only then send the valid h2d packet.
Also, I'm redoing CavaIncrementDevice.v anyway so don't worry about breaking it.
I added one more file, Bedrock2StateMachineToCavaHmac.v
, where I wrote some invariant for hmac_top
, but then, when I started to think about what update_repr
for hmac_top
should look like, taking into account response delays that I would not want to specify deterministically, I noticed that I first should understand TLUL better, so I sketched a tlul_step
that's supposed to specify the TLUL interaction at a high level. I'm not sure if that definition tlul_step
will show up as-is anywhere in the final specs and proofs, but I'd still be interested in @fshaked's feedback on whether that looks about right?
I'm trying to work top-down from
device_implements_state_machine
towards Cava Hmac, and the first too-high-level item that I encountered was that the read/write steps indevice_implements_state_machine
talk about several device steps at once (because they're usingrunUntilResp
). I wrote an alternativedevice_implements_state_machine
that only usesrun1
, but notrunUntilResp
. That should bring the interface closer to the structure of Cava proofs, hopefully. Unfortunately, the proofs forCavaIncrementDevice.v
break badly, and I haven't fixed them yet, so this is still a draft, but I'm posting it here because I'd be interested to know what @fshaked thinks about the changes I made inMMIOToCava.v
, and whether they could simplify what you're working on?