[DRAFT] Adapt kmac_app_agent to dynamic app interface#30230
Conversation
cc20f07 to
d57a440
Compare
|
Force-push rebases onto latest version of #30195 |
d57a440 to
1cdfaf1
Compare
|
I've just rebased this PR past the enormous changes that have landed (and tweaks to the DV code from the design team). I'm going to allow this to run through CI and then will review/hack on the code at this end a little bit until I'm convinced it's ready for review. |
|
In case you are looking for the initial smoke test of the dynamic app interface, you can find it on this branch: https://github.com/etterli/opentitan/tree/otbn-kmac-if-combo |
|
This first force-push is prompted by trying to improve
|
1cdfaf1 to
69b9f76
Compare
This probably shouldn't be a signed value (we want bytes that contain 129, not -127!) Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
There's no need to encode the name of the environment into agents that it instantiates. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
These queues contain digests, rather than shares. I suspect the original name was because it's a queue of digests which, in turn, have multiple shares, so it's a "share digest" queue. But the name looks a lot like it's a queue of shares, which is wrong. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
No functional change, but this matches the conventional name used in OpenTitan for interfaces. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
|
Changes in the latest force-push:
|
69b9f76 to
fea2cf9
Compare
This should be a little cleaner than the version we were using before. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
fea2cf9 to
73df79f
Compare
|
Latest force-push pulls the change to the connections to |
|
Latest force-push addresses a few minor things, and also fixes a silly error in keymgr_env:
|
73df79f to
5a589a0
Compare
This work adapts the agent to match the newly defined interface with
minimal changes. This should allow OTBN to interact with KMAC through
the interface in a more complicated way than existing users.
The agent that was in place isn't really able to handle the tweaked
protocol, so this commit rewrites it to allow extending things
smoothly.
Upsettingly, the commit is enormous! I couldn't figure out how to
split it up into smaller pieces. :-(
Important changes:
- The agent gets split in two ("kmac_app_device_agent" and
"kmac_app_host_agent"). These have different sequencers,
corresponding to the fact that they fundamentally drive different
sorts of items.
- We no longer use push_pull_agent. It was already a slightly awkward
fit (I think) and can't really support the new protocol.
- kmac_app_device_driver now watches app requests and creates
sequence items to represent these requests. They get
broadcast through m_req_port. That port is connected to the
sequencer's m_req_fifo, which can be consumed by the sequence that
sends responses.
- Sequence items are a bit more structured:
+ A request is sent in multiple beats, which each get a
kmac_app_req_item where the last has m_last set.
+ The items representing the beats of a request are grouped into
a "packet", represented by a kmac_app_req_packet_item. This
contains a queue with the kmac_app_req_item objects for the
beats.
+ A response is represented by a kmac_app_rsp_item.
+ The monitor sees complete transactions (a request followed by a
response) and represents this as a kmac_app_mon_item, which
contains a kmac_app_req_packet_item and a kmac_app_rsp_item.
- The signals in kmac_app_if are now driven through clocking blocks
in both directions, depending on an if_mode variable.
- We don't use phase sequences any more. I think this is not really
recommended and we can just start the "device responder" sequences
from the test: probably a bit clearer. For example, see
keymgr_base_test.sv (three lines of code).
Minor ("while we're at it") changes:
- It also exposes the request and response as inout ports, which
makes it a bit easier to use. See hw/ip/keymgr/dv/tb.sv for an
example of the change.
- Any new or dramatically-altered classes use out-of-block
definitions and I've added meaningful documentation comments to
functions, tasks and class variables.
- The imports in kmac_app_agent_pkg are a bit more precise (mainly
because I was concentrating to make sure I got the right thing
from the right place).
- The StrbAlignLSB_A assertions in kmac_app_intf were more
complicated than needed. Group them into a single assertion. Also,
express the assertions with default clocking/disable to make them
easier to understand.
- Rather than using field macros for the new classes, I've defined
do_print/do_copy manually. This is probably a bit more efficient at
runtime and (more importantly) lets us be explicit about things
like radixes. For example, kmac_app_req_item always uses
hexadecimal for its m_data field.
- Since the strobe line is always required to be contiguous and
aligned to the lsb, kmac_app_req_item represents it as just the
number of valid bytes (m_num_bytes). This makes some of the code
deailing with the item a bit simpler.
For example, see kmac_app_host_seq: handling partial words when
cfg.inject_zero_in_host_strb is now rather less mysterious.
- When porting the function from kmac_app_item, I renamed
get_is_kmac_rsp_data_invalid to just is_kmac_rsp_data_invalid.
There's no need for the "double accessor name".
- Since I was having to touch the code anyway, I've made the way
scoreboards consume items from the agent a bit simpler. For
example, keymgr_scoreboard now has two imp imports (for requests
and transactions) and doesn't have to manually maintain fifos in
the same way.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
5a589a0 to
fc7404e
Compare
This DV change is designed to adapt the kmac_app_agent to a more sensible interface after the changes in #30143 were merged. I have split out several parts into separate PRs:
Once those are merged the remaining commit is as follows: