../src/lowrisc_ip_aes_0.6/rtl/aes.sv Cov: 100%
1: // Copyright lowRISC contributors.
2: // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3: // SPDX-License-Identifier: Apache-2.0
4: //
5: // AES top-level wrapper
6:
7: `include "prim_assert.sv"
8:
9: module aes #(
10: parameter bit AES192Enable = 1, // Can be 0 (disable), or 1 (enable).
11: parameter SBoxImpl = "lut" // Can be "lut" (LUT-based SBox), "canright",
12: // "canright_masked_noreuse", or "canright_masked".
13: // Note: Currently, constant masks are used, this is
14: // of course not secure.
15: ) (
16: input clk_i,
17: input rst_ni,
18:
19: // Entropy source interface
20: // TODO: This still needs to be connected.
21: // See https://github.com/lowRISC/opentitan/issues/1005
22: //output logic entropy_req_o,
23: //input logic entropy_ack_i,
24: //input logic [63:0] entropy_i,
25:
26: // Bus interface
27: input tlul_pkg::tl_h2d_t tl_i,
28: output tlul_pkg::tl_d2h_t tl_o
29: );
30:
31: import aes_reg_pkg::*;
32:
33: aes_reg2hw_t reg2hw;
34: aes_hw2reg_t hw2reg;
35:
36: logic prng_data_req;
37: logic prng_data_ack;
38: logic [63:0] prng_data;
39: logic prng_reseed_req;
40: logic prng_reseed_ack;
41:
42: aes_reg_top aes_reg_top (
43: .clk_i,
44: .rst_ni,
45: .tl_i,
46: .tl_o,
47: .reg2hw,
48: .hw2reg,
49: .devmode_i(1'b1)
50: );
51:
52: aes_core #(
53: .AES192Enable ( AES192Enable ),
54: .SBoxImpl ( SBoxImpl )
55: ) aes_core (
56: .clk_i,
57: .rst_ni,
58:
59: .prng_data_req_o ( prng_data_req ),
60: .prng_data_ack_i ( prng_data_ack ),
61: .prng_data_i ( prng_data ),
62: .prng_reseed_req_o ( prng_reseed_req ),
63: .prng_reseed_ack_i ( prng_reseed_ack ),
64:
65: .reg2hw,
66: .hw2reg
67: );
68:
69: aes_prng aes_prng (
70: .clk_i,
71: .rst_ni,
72:
73: .data_req_i ( prng_data_req ),
74: .data_ack_o ( prng_data_ack ),
75: .data_o ( prng_data ),
76: .reseed_req_i ( prng_reseed_req ),
77: .reseed_ack_o ( prng_reseed_ack ),
78:
79: // TODO: This still needs to be connected to the entropy source.
80: // See https://github.com/lowRISC/opentitan/issues/1005
81: .entropy_req_o( ),
82: .entropy_ack_i( 1'b1 ),
83: .entropy_i ( 64'hFEDCBA9876543210 )
84: );
85:
86: // All outputs should have a known value after reset
87: `ASSERT_KNOWN(TlODValidKnown, tl_o.d_valid)
88: `ASSERT_KNOWN(TlOAReadyKnown, tl_o.a_ready)
89:
90: endmodule
91: