Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tlul, shim] Externalize Caliptra registers #12

Merged

Conversation

andrea-caforio
Copy link
Collaborator

Move Caliptra-internal registers to a separate module with its own DV interface and redirect shim requests to it.

@andrea-caforio andrea-caforio self-assigned this Nov 28, 2024
@andrea-caforio andrea-caforio marked this pull request as ready for review November 28, 2024 13:52
@andrea-caforio andrea-caforio force-pushed the tlul-shim-internal-regs branch from 8e7da5a to 97ea47e Compare November 28, 2024 16:56
parameter bit [31:0] SHIM_NAME_1 = 32'hCAFEBABE,
parameter bit [31:0] SHIM_VERSION_0 = 32'h00000001,
parameter bit [31:0] SHIM_VERSION_1 = 32'h00000000,

parameter bit [11:0] SHIM_REGISTER_ADDRESS_OFFSET = 12'h100,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be renamed to DV_REGISTER_ADDRESS_OFFSET?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And, I think this would need to be of width ADDR_WIDTH actually.

Comment on lines 28 to 41
// DV device interface (DV to TLUL).
input logic tlul_dv_i,
output logic tlul_hld_o,
input logic [ADDR_WIDTH-1:0] tlul_addr_i,
input logic tlul_write_i,
input logic [DATA_WIDTH-1:0] tlul_wdata_i,
input logic [MASK_WIDTH-1:0] tlul_wstrb_i,
input logic [2:0] tlul_size_i,
output logic [DATA_WIDTH-1:0] tlul_rdata_o,
output logic tlul_error_o,
input logic tlul_last_i,
input logic [USER_WIDTH-1:0] tlul_user_i,
input logic [ID_WIDTH-1:0] tlul_id_i,

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tlul_ prefix here is a bit confusing. Because what's coming in here can both go to TLUL or the port below. One could say that this is the primary interface of the shim, whereas the newly added interface is the secondary interface.

input logic [USER_WIDTH-1:0] tlul_user_i,
input logic [ID_WIDTH-1:0] tlul_id_i,

// DV host interface (DV to internal registers).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe clarify the comment by saying that accesses for which the internal_access signal gets set are routed to this interface?

// file and those targeting OpenTitan registers, with the latter ones being translated into TLUL
// requests while the other requests are relayed to the internal register file.
logic internal_access;
assign internal_access = |(tlul_addr_i[11:0] & SHIM_REGISTER_ADDRESS_OFFSET);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should probably compare the full address now that the shim becomes much more generic (by outputting the unmapped requests again) - I think this shim may get used pretty widely in the future.

input logic [ID_WIDTH-1:0] tlul_id_i,

// DV host interface (DV to internal registers).
output logic dv_dv_o,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a good idea regarding how to distinguish these signals of the secondary port from the primary above. I think some form of prefix is needed. Given that we call these registers "internal" we could maybe use int_?

@andrea-caforio andrea-caforio force-pushed the tlul-shim-internal-regs branch from 97ea47e to 7135d87 Compare November 29, 2024 06:48
@andrea-caforio
Copy link
Collaborator Author

@vogelpi Thank you for the review. Let's see whether the custom bus protocol has a name. :-)

@andrea-caforio andrea-caforio force-pushed the tlul-shim-internal-regs branch from 7135d87 to d8bbd8b Compare November 29, 2024 12:37
Move Valid-Hold-internal registers to a separate module with its own
VH interface and redirect requests to it.

Signed-off-by: Andrea Caforio <[email protected]>
@andrea-caforio andrea-caforio force-pushed the tlul-shim-internal-regs branch from d8bbd8b to 8fd5666 Compare November 29, 2024 14:46
Copy link
Owner

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @andrea-caforio !

@vogelpi
Copy link
Owner

vogelpi commented Nov 29, 2024

CHANGE AUTHORIZED: hw/ip/tlul/rtl/tlul_adapter_shim.sv
CHANGE AUTHORIZED: hw/ip/tlul/rtl/tlul_adapter_vh.sv

This PR touches the TLUL - VH adapter which is expected and fine.

@vogelpi vogelpi merged commit a9b9558 into vogelpi:aes-gcm-review Nov 29, 2024
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants