Commit 69b9f76
committed
[kmac,dv] Rewrite kmac_app_agent to be more general
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:
- The interface gets a more conventional "_if" name.
- 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.
- Fixed dubious function names in kmac_app_agent_cfg: things that
acted on a digest, composed of two shares, were previously called
e.g. add_user_digest_share. But they acted on both shares! Drop the
_share" part.
- 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.
- I've renamed kmac_app_rsp_item::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.
- I renamed the agents that connect to KMAC in the keymgr and
keymgr_dpe environments to just m_kmac_agent: there's not much
point in cluttering the code with longer names.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>1 parent e804155 commit 69b9f76
69 files changed
Lines changed: 1736 additions & 1091 deletions
File tree
- hw
- dv/sv/kmac_app_agent
- seq_lib
- ip
- keymgr_dpe/dv
- env
- seq_lib
- tests
- keymgr
- dv
- env
- seq_lib
- tests
- rtl
- kmac/dv
- env
- seq_lib
- lc_ctrl
- dv
- env
- seq_lib
- tests
- rtl
- rom_ctrl
- dv
- cov
- env
- seq_lib
- tb
- tests
- rtl
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | 17 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 18 | + | |
24 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
25 | 23 | | |
26 | | - | |
27 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | | - | |
8 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
10 | 20 | | |
11 | | - | |
| 21 | + | |
12 | 22 | | |
13 | | - | |
| 23 | + | |
| 24 | + | |
14 | 25 | | |
15 | 26 | | |
16 | 27 | | |
17 | | - | |
| 28 | + | |
18 | 29 | | |
19 | 30 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
26 | | - | |
27 | | - | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | | - | |
| 40 | + | |
| 41 | + | |
34 | 42 | | |
35 | | - | |
36 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
37 | 47 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
64 | | - | |
65 | 68 | | |
66 | 69 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 70 | + | |
| 71 | + | |
73 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
16 | 24 | | |
17 | 25 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
22 | 30 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 31 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
36 | 47 | | |
37 | 48 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments