forked from chipsalliance/caliptra-ss
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathotp_ctrl_part_pkg.sv
More file actions
725 lines (683 loc) · 26.8 KB
/
Copy pathotp_ctrl_part_pkg.sv
File metadata and controls
725 lines (683 loc) · 26.8 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// DO NOT EDIT THIS FILE DIRECTLY.
// It has been generated with ./tools/scripts/fuse_ctrl_script/gen_fuse_ctrl_partitions.py
package otp_ctrl_part_pkg;
import caliptra_prim_util_pkg::vbits;
import otp_ctrl_reg_pkg::*;
import otp_ctrl_pkg::*;
import lc_ctrl_state_pkg::*;
parameter int NumVendorPkFuses = 2;
parameter int NumVendorSecretFuses = 0;
parameter int NumVendorNonSecretFuses = 3;
////////////////////////////////////
// Scrambling Constants and Types //
////////////////////////////////////
parameter int NumScrmblKeys = 6;
parameter int NumDigestSets = 1;
parameter int ScrmblKeySelWidth = vbits(NumScrmblKeys);
parameter int DigestSetSelWidth = vbits(NumDigestSets);
parameter int ConstSelWidth = (ScrmblKeySelWidth > DigestSetSelWidth) ?
ScrmblKeySelWidth :
DigestSetSelWidth;
typedef enum logic [ConstSelWidth-1:0] {
StandardMode,
ChainedMode
} digest_mode_e;
typedef logic [NumScrmblKeys-1:0][ScrmblKeyWidth-1:0] key_array_t;
typedef logic [NumDigestSets-1:0][ScrmblKeyWidth-1:0] digest_const_array_t;
typedef logic [NumDigestSets-1:0][ScrmblBlockWidth-1:0] digest_iv_array_t;
typedef enum logic [ConstSelWidth-1:0] {
SecretManufKey,
SecretProdKey0,
SecretProdKey1,
SecretProdKey2,
SecretProdKey3,
SecretLifeCycleTransitionKey
} key_sel_e;
typedef enum logic [ConstSelWidth-1:0] {
CnstyDigest
} digest_sel_e;
// SEC_CM: SECRET.MEM.SCRAMBLE
parameter key_array_t RndCnstKey = {
128'h277195FC471E4B26B6641214B61D1B43,
128'h4D5A89AA9109294AE048B657396B4B83,
128'hBEAD91D5FA4E09150E95F517CB98955B,
128'h85A9E830BC059BA9286D6E2856A05CC3,
128'hEFFA6D736C5EFF49AE7B70F9C46E5A62,
128'h3BA121C5E097DDEB7768B4C666E9C3DA
};
// SEC_CM: PART.MEM.DIGEST
// Note: digest set 0 is used for computing the partition digests. Constants at
// higher indices are used to compute the scrambling keys.
parameter digest_const_array_t RndCnstDigestConst = {
128'hD60822E1FAEC5C7290C7F21F6224F027
};
parameter digest_iv_array_t RndCnstDigestIV = {
64'hB7474D640F8A7F5
};
parameter digest_const_array_t RndCnstDigestConstDefault = {
128'hD60822E1FAEC5C7290C7F21F6224F027
};
parameter digest_iv_array_t RndCnstDigestIVDefault = {
64'hB7474D640F8A7F5
};
/////////////////////////////////////
// Typedefs for Partition Metadata //
/////////////////////////////////////
typedef enum logic [1:0] {
Unbuffered,
Buffered,
LifeCycle
} part_variant_e;
typedef struct packed {
part_variant_e variant;
// Offset and size within the OTP array, in Bytes.
logic [OtpByteAddrWidth-1:0] offset;
logic [OtpByteAddrWidth-1:0] size;
// Key index to use for scrambling.
key_sel_e key_sel;
// Attributes
logic secret; // Whether the partition is secret (and hence scrambled)
logic sw_digest; // Whether the partition has a software digest
logic hw_digest; // Whether the partition has a hardware digest
logic write_lock; // Whether the partition is write lockable (via digest)
logic read_lock; // Whether the partition is read lockable (via digest)
logic integrity; // Whether the partition is integrity protected
logic iskeymgr_creator; // Whether the partition has any creator key material
logic iskeymgr_owner; // Whether the partition has any owner key material
// Decoded LC state index. A partition can be written as long this index is
// smaller or equal the current state index of the LC (see `dec_lc_state_e`).
logic [DecLcStateWidth-1:0] lc_phase;
} part_info_t;
parameter part_info_t PartInfoDefault = '{
variant: Unbuffered,
offset: '0,
size: OtpByteAddrWidth'('hFF),
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b0,
hw_digest: 1'b0,
write_lock: 1'b0,
read_lock: 1'b0,
integrity: 1'b0,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStRaw
};
////////////////////////
// Partition Metadata //
////////////////////////
localparam part_info_t PartInfo [NumPart] = '{
// SW_TEST_UNLOCK_PARTITION
'{
variant: Buffered,
offset: 12'd0,
size: 72,
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b0,
hw_digest: 1'b1,
write_lock: 1'b1,
read_lock: 1'b0,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStDev
},
// SECRET_MANUF_PARTITION
'{
variant: Buffered,
offset: 12'd72,
size: 72,
key_sel: SecretManufKey,
secret: 1'b1,
sw_digest: 1'b0,
hw_digest: 1'b1,
write_lock: 1'b1,
read_lock: 1'b1,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStDev
},
// SECRET_PROD_PARTITION_0
'{
variant: Buffered,
offset: 12'd144,
size: 16,
key_sel: SecretProdKey0,
secret: 1'b1,
sw_digest: 1'b0,
hw_digest: 1'b1,
write_lock: 1'b1,
read_lock: 1'b1,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStProd
},
// SECRET_PROD_PARTITION_1
'{
variant: Buffered,
offset: 12'd160,
size: 16,
key_sel: SecretProdKey1,
secret: 1'b1,
sw_digest: 1'b0,
hw_digest: 1'b1,
write_lock: 1'b1,
read_lock: 1'b1,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStProd
},
// SECRET_PROD_PARTITION_2
'{
variant: Buffered,
offset: 12'd176,
size: 16,
key_sel: SecretProdKey2,
secret: 1'b1,
sw_digest: 1'b0,
hw_digest: 1'b1,
write_lock: 1'b1,
read_lock: 1'b1,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStProd
},
// SECRET_PROD_PARTITION_3
'{
variant: Buffered,
offset: 12'd192,
size: 16,
key_sel: SecretProdKey3,
secret: 1'b1,
sw_digest: 1'b0,
hw_digest: 1'b1,
write_lock: 1'b1,
read_lock: 1'b1,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStProd
},
// SW_MANUF_PARTITION
'{
variant: Unbuffered,
offset: 12'd208,
size: 104,
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b1,
hw_digest: 1'b0,
write_lock: 1'b1,
read_lock: 1'b0,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStDev
},
// SECRET_LC_TRANSITION_PARTITION
'{
variant: Buffered,
offset: 12'd312,
size: 184,
key_sel: SecretLifeCycleTransitionKey,
secret: 1'b1,
sw_digest: 1'b0,
hw_digest: 1'b1,
write_lock: 1'b1,
read_lock: 1'b1,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStTestUnlocked0
},
// LIFE_CYCLE
'{
variant: LifeCycle,
offset: 12'd496,
size: 88,
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b0,
hw_digest: 1'b0,
write_lock: 1'b0,
read_lock: 1'b0,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStRaw
},
// VENDOR_HASHES_MANUF_PARTITION
'{
variant: Unbuffered,
offset: 12'd584,
size: 152,
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b1,
hw_digest: 1'b0,
write_lock: 1'b1,
read_lock: 1'b0,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStDev
},
// VENDOR_HASHES_OWNER_PROD_PARTITION
'{
variant: Unbuffered,
offset: 12'd736,
size: 56,
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b1,
hw_digest: 1'b0,
write_lock: 1'b1,
read_lock: 1'b0,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStProd
},
// VENDOR_HASHES_PROD_PARTITION
'{
variant: Unbuffered,
offset: 12'd792,
size: 56,
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b1,
hw_digest: 1'b0,
write_lock: 1'b1,
read_lock: 1'b0,
integrity: 1'b1,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStProd
},
// VENDOR_NON_SECRET_PROD_PARTITION
'{
variant: Unbuffered,
offset: 12'd848,
size: 112,
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b0,
hw_digest: 1'b0,
write_lock: 1'b0,
read_lock: 1'b0,
integrity: 1'b0,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStProd
},
// CSR_PARTITION
'{
variant: Unbuffered,
offset: 12'd960,
size: 192,
key_sel: key_sel_e'('0),
secret: 1'b0,
sw_digest: 1'b0,
hw_digest: 1'b0,
write_lock: 1'b0,
read_lock: 1'b0,
integrity: 1'b0,
iskeymgr_creator: 1'b0,
iskeymgr_owner: 1'b0,
lc_phase: DecLcStRma
}
};
typedef enum logic [4:0] {
SwTestUnlockPartitionIdx,
SecretManufPartitionIdx,
SecretProdPartition0Idx,
SecretProdPartition1Idx,
SecretProdPartition2Idx,
SecretProdPartition3Idx,
SwManufPartitionIdx,
SecretLcTransitionPartitionIdx,
LifeCycleIdx,
VendorHashesManufPartitionIdx,
VendorHashesOwnerProdPartitionIdx,
VendorHashesProdPartitionIdx,
VendorNonSecretProdPartitionIdx,
CsrPartitionIdx,
// These are not "real partitions", but in terms of implementation it is convenient to
// add these at the end of certain arrays.
DaiIdx,
LciIdx,
// Number of agents is the last idx+1.
NumAgentsIdx
} part_idx_e;
parameter int NumAgents = int'(NumAgentsIdx);
// Breakout types for easier access of individual items.
typedef struct packed {
logic [63:0] sw_test_unlock_partition_digest;
logic [511:0] cptra_ss_manuf_debug_unlock_token;
} otp_sw_test_unlock_partition_data_t;
// default value used for intermodule
parameter otp_sw_test_unlock_partition_data_t OTP_SW_TEST_UNLOCK_PARTITION_DATA_DEFAULT = '{
sw_test_unlock_partition_digest: 64'hA445C3C29F71A256,
cptra_ss_manuf_debug_unlock_token: 512'h0
};
typedef struct packed {
logic [63:0] secret_manuf_partition_digest;
logic [511:0] cptra_core_uds_seed;
} otp_secret_manuf_partition_data_t;
// default value used for intermodule
parameter otp_secret_manuf_partition_data_t OTP_SECRET_MANUF_PARTITION_DATA_DEFAULT = '{
secret_manuf_partition_digest: 64'h4947DD361344767A,
cptra_core_uds_seed: 512'hF98C48B1F93772844A22D4B78FE0266FBEE3958332F2939B63B9485A3856C417CF7A50A9A91EF7F7B3A5B4421F462370FFF698183664DC7EDF3888886BD10DC6
};
typedef struct packed {
logic [63:0] secret_prod_partition_0_digest;
logic [63:0] cptra_core_field_entropy_0;
} otp_secret_prod_partition_0_data_t;
// default value used for intermodule
parameter otp_secret_prod_partition_0_data_t OTP_SECRET_PROD_PARTITION_0_DATA_DEFAULT = '{
secret_prod_partition_0_digest: 64'h340A5B93BB19342,
cptra_core_field_entropy_0: 64'h7ABB319BDA0529AE
};
typedef struct packed {
logic [63:0] secret_prod_partition_1_digest;
logic [63:0] cptra_core_field_entropy_1;
} otp_secret_prod_partition_1_data_t;
// default value used for intermodule
parameter otp_secret_prod_partition_1_data_t OTP_SECRET_PROD_PARTITION_1_DATA_DEFAULT = '{
secret_prod_partition_1_digest: 64'hE29749216775E8A5,
cptra_core_field_entropy_1: 64'h40119A3C6E63CDF3
};
typedef struct packed {
logic [63:0] secret_prod_partition_2_digest;
logic [63:0] cptra_core_field_entropy_2;
} otp_secret_prod_partition_2_data_t;
// default value used for intermodule
parameter otp_secret_prod_partition_2_data_t OTP_SECRET_PROD_PARTITION_2_DATA_DEFAULT = '{
secret_prod_partition_2_digest: 64'h15F164D7930C9D19,
cptra_core_field_entropy_2: 64'h58840E458E4029A6
};
typedef struct packed {
logic [63:0] secret_prod_partition_3_digest;
logic [63:0] cptra_core_field_entropy_3;
} otp_secret_prod_partition_3_data_t;
// default value used for intermodule
parameter otp_secret_prod_partition_3_data_t OTP_SECRET_PROD_PARTITION_3_DATA_DEFAULT = '{
secret_prod_partition_3_digest: 64'h20440F25BB053FB5,
cptra_core_field_entropy_3: 64'hB5AC1F53D00A08C3
};
typedef struct packed {
// This reuses the same encoding as the life cycle signals for indicating valid status.
lc_ctrl_pkg::lc_tx_t valid;
otp_secret_prod_partition_3_data_t secret_prod_partition_3_data;
otp_secret_prod_partition_2_data_t secret_prod_partition_2_data;
otp_secret_prod_partition_1_data_t secret_prod_partition_1_data;
otp_secret_prod_partition_0_data_t secret_prod_partition_0_data;
otp_secret_manuf_partition_data_t secret_manuf_partition_data;
otp_sw_test_unlock_partition_data_t sw_test_unlock_partition_data;
} otp_broadcast_t;
// default value for intermodule
parameter otp_broadcast_t OTP_BROADCAST_DEFAULT = '{
valid: lc_ctrl_pkg::Off,
secret_prod_partition_3_data: OTP_SECRET_PROD_PARTITION_3_DATA_DEFAULT,
secret_prod_partition_2_data: OTP_SECRET_PROD_PARTITION_2_DATA_DEFAULT,
secret_prod_partition_1_data: OTP_SECRET_PROD_PARTITION_1_DATA_DEFAULT,
secret_prod_partition_0_data: OTP_SECRET_PROD_PARTITION_0_DATA_DEFAULT,
secret_manuf_partition_data: OTP_SECRET_MANUF_PARTITION_DATA_DEFAULT,
sw_test_unlock_partition_data: OTP_SW_TEST_UNLOCK_PARTITION_DATA_DEFAULT
};
// OTP invalid partition default for buffered partitions.
parameter logic [9215:0] PartInvDefault = 9216'({
1536'({
1536'h0
}),
896'({
128'h0,
256'h0,
256'h0,
256'h0
}),
448'({
64'h8CBBAD02BB4CA928,
384'h0
}),
448'({
64'hC469C593E5DC0DA8,
384'h0
}),
1216'({
64'hBE193854E9CA60A0,
384'h0,
384'h0,
384'h0
}),
704'({
320'h851B80674A2B6FBE93B61DE417B9FB339605F051E74379CBCC6596C7174EBA643E725E464F593C87,
384'h315FD2B871D88819A0D1E90E8C9FDDFA01E46311FD36D95401136C663A36C3E3E817E760B27AE937BFCDF15A3429452A
}),
1472'({
64'hBBF4A76885E754F2,
128'h688098A43C33459F0279FC51CC7C626E,
128'hD3D58610F4851667D68C96F0B3D1FEED,
128'h2C0DBDDEDF7A854D5E58D0AA97A0F8F6,
128'h2A4D8B51F5D41C8AD0BAC511D08ECE0E,
128'h1C752824C7DDC89694CD3DED94B57819,
128'h426D99D374E699CAE00E9680BD9B7029,
128'h234729143F97B62A55D0320379A0D260,
128'hD396D1CE085BDC31105733EAA3880C5A,
128'h7E17D06B5D4E0DDDDBB9844327F20FB5,
128'hB6711DB6F5D40A37DBC827839FE2DCC2,
128'hB28B5C0FEE5F4C02711D135F59A50322
}),
832'({
64'hF87BED95CFBA3727,
768'h0
}),
128'({
64'h20440F25BB053FB5,
64'hB5AC1F53D00A08C3
}),
128'({
64'h15F164D7930C9D19,
64'h58840E458E4029A6
}),
128'({
64'hE29749216775E8A5,
64'h40119A3C6E63CDF3
}),
128'({
64'h340A5B93BB19342,
64'h7ABB319BDA0529AE
}),
576'({
64'h4947DD361344767A,
512'hF98C48B1F93772844A22D4B78FE0266FBEE3958332F2939B63B9485A3856C417CF7A50A9A91EF7F7B3A5B4421F462370FFF698183664DC7EDF3888886BD10DC6
}),
576'({
64'hA445C3C29F71A256,
512'h0
})});
///////////////////////////////////////////////
// Parameterized Assignment Helper Functions //
///////////////////////////////////////////////
function automatic otp_ctrl_core_hw2reg_t named_reg_assign(
logic [NumPart-1:0][ScrmblBlockWidth-1:0] part_digest);
otp_ctrl_core_hw2reg_t hw2reg;
logic unused_sigs;
unused_sigs = ^part_digest;
hw2reg = '0;
hw2reg.sw_test_unlock_partition_digest = part_digest[SwTestUnlockPartitionIdx];
hw2reg.secret_manuf_partition_digest = part_digest[SecretManufPartitionIdx];
hw2reg.secret_prod_partition_0_digest = part_digest[SecretProdPartition0Idx];
hw2reg.secret_prod_partition_1_digest = part_digest[SecretProdPartition1Idx];
hw2reg.secret_prod_partition_2_digest = part_digest[SecretProdPartition2Idx];
hw2reg.secret_prod_partition_3_digest = part_digest[SecretProdPartition3Idx];
hw2reg.sw_manuf_partition_digest = part_digest[SwManufPartitionIdx];
hw2reg.secret_lc_transition_partition_digest = part_digest[SecretLcTransitionPartitionIdx];
hw2reg.vendor_hashes_manuf_partition_digest = part_digest[VendorHashesManufPartitionIdx];
hw2reg.vendor_hashes_owner_prod_partition_digest = part_digest[VendorHashesOwnerProdPartitionIdx];
hw2reg.vendor_hashes_prod_partition_digest = part_digest[VendorHashesProdPartitionIdx];
return hw2reg;
endfunction : named_reg_assign
function automatic part_access_t [NumPart-1:0] named_part_access_pre(
otp_ctrl_core_reg2hw_t reg2hw);
part_access_t [NumPart-1:0] part_access_pre;
logic unused_sigs;
unused_sigs = ^reg2hw;
// Default (this will be overridden by partition-internal settings).
part_access_pre = {{32'(2*NumPart)}{caliptra_prim_mubi_pkg::MuBi8False}};
// Note: these could be made a MuBi CSRs in the future.
// The main thing that is missing right now is proper support for W0C.
// SW_MANUF_PARTITION
if (!reg2hw.sw_manuf_partition_read_lock) begin
part_access_pre[SwManufPartitionIdx].read_lock = caliptra_prim_mubi_pkg::MuBi8True;
end
// VENDOR_HASHES_MANUF_PARTITION
if (!reg2hw.vendor_hashes_manuf_partition_read_lock) begin
part_access_pre[VendorHashesManufPartitionIdx].read_lock = caliptra_prim_mubi_pkg::MuBi8True;
end
// VENDOR_HASHES_OWNER_PROD_PARTITION
if (!reg2hw.vendor_hashes_owner_prod_partition_read_lock) begin
part_access_pre[VendorHashesOwnerProdPartitionIdx].read_lock = caliptra_prim_mubi_pkg::MuBi8True;
end
// VENDOR_HASHES_PROD_PARTITION
if (!reg2hw.vendor_hashes_prod_partition_read_lock) begin
part_access_pre[VendorHashesProdPartitionIdx].read_lock = caliptra_prim_mubi_pkg::MuBi8True;
end
// VENDOR_NON_SECRET_PROD_PARTITION
if (!reg2hw.vendor_non_secret_prod_partition_read_lock) begin
part_access_pre[VendorNonSecretProdPartitionIdx].read_lock = caliptra_prim_mubi_pkg::MuBi8True;
end
return part_access_pre;
endfunction : named_part_access_pre
function automatic otp_broadcast_t named_broadcast_assign(
logic [NumPart-1:0] part_init_done,
logic [$bits(PartInvDefault)/8-1:0][7:0] part_buf_data);
otp_broadcast_t otp_broadcast;
logic valid, unused;
unused = 1'b0;
valid = 1'b1;
// SW_TEST_UNLOCK_PARTITION
valid &= part_init_done[SwTestUnlockPartitionIdx];
otp_broadcast.sw_test_unlock_partition_data = otp_sw_test_unlock_partition_data_t'(part_buf_data[SwTestUnlockPartitionOffset +: SwTestUnlockPartitionSize]);
// SECRET_MANUF_PARTITION
valid &= part_init_done[SecretManufPartitionIdx];
otp_broadcast.secret_manuf_partition_data = otp_secret_manuf_partition_data_t'(part_buf_data[SecretManufPartitionOffset +: SecretManufPartitionSize]);
// SECRET_PROD_PARTITION_0
valid &= part_init_done[SecretProdPartition0Idx];
otp_broadcast.secret_prod_partition_0_data = otp_secret_prod_partition_0_data_t'(part_buf_data[SecretProdPartition0Offset +: SecretProdPartition0Size]);
// SECRET_PROD_PARTITION_1
valid &= part_init_done[SecretProdPartition1Idx];
otp_broadcast.secret_prod_partition_1_data = otp_secret_prod_partition_1_data_t'(part_buf_data[SecretProdPartition1Offset +: SecretProdPartition1Size]);
// SECRET_PROD_PARTITION_2
valid &= part_init_done[SecretProdPartition2Idx];
otp_broadcast.secret_prod_partition_2_data = otp_secret_prod_partition_2_data_t'(part_buf_data[SecretProdPartition2Offset +: SecretProdPartition2Size]);
// SECRET_PROD_PARTITION_3
valid &= part_init_done[SecretProdPartition3Idx];
otp_broadcast.secret_prod_partition_3_data = otp_secret_prod_partition_3_data_t'(part_buf_data[SecretProdPartition3Offset +: SecretProdPartition3Size]);
// SW_MANUF_PARTITION
unused ^= ^{part_init_done[SwManufPartitionIdx],
part_buf_data[SwManufPartitionOffset +: SwManufPartitionSize]};
// SECRET_LC_TRANSITION_PARTITION
unused ^= ^{part_init_done[SecretLcTransitionPartitionIdx],
part_buf_data[SecretLcTransitionPartitionOffset +: SecretLcTransitionPartitionSize]};
// LIFE_CYCLE
unused ^= ^{part_init_done[LifeCycleIdx],
part_buf_data[LifeCycleOffset +: LifeCycleSize]};
// VENDOR_HASHES_MANUF_PARTITION
unused ^= ^{part_init_done[VendorHashesManufPartitionIdx],
part_buf_data[VendorHashesManufPartitionOffset +: VendorHashesManufPartitionSize]};
// VENDOR_HASHES_OWNER_PROD_PARTITION
unused ^= ^{part_init_done[VendorHashesOwnerProdPartitionIdx],
part_buf_data[VendorHashesOwnerProdPartitionOffset +: VendorHashesOwnerProdPartitionSize]};
// VENDOR_HASHES_PROD_PARTITION
unused ^= ^{part_init_done[VendorHashesProdPartitionIdx],
part_buf_data[VendorHashesProdPartitionOffset +: VendorHashesProdPartitionSize]};
// VENDOR_NON_SECRET_PROD_PARTITION
unused ^= ^{part_init_done[VendorNonSecretProdPartitionIdx],
part_buf_data[VendorNonSecretProdPartitionOffset +: VendorNonSecretProdPartitionSize]};
// CSR_PARTITION
unused ^= ^{part_init_done[CsrPartitionIdx],
part_buf_data[CsrPartitionOffset +: CsrPartitionSize]};
otp_broadcast.valid = lc_ctrl_pkg::lc_tx_bool_to_lc_tx(valid);
return otp_broadcast;
endfunction : named_broadcast_assign
function automatic otp_keymgr_key_t named_keymgr_key_assign(
logic [NumPart-1:0][ScrmblBlockWidth-1:0] part_digest,
logic [$bits(PartInvDefault)/8-1:0][7:0] part_buf_data,
lc_ctrl_pkg::lc_tx_t lc_seed_hw_rd_en);
otp_keymgr_key_t otp_keymgr_key;
logic valid, unused;
unused = 1'b0;
// For now we use a fixed struct type here so that the
// interface to the keymgr remains stable. The type contains
// a superset of all options, so we have to initialize it to '0 here.
otp_keymgr_key = '0;
// SW_TEST_UNLOCK_PARTITION
unused ^= ^{part_digest[SwTestUnlockPartitionIdx],
part_buf_data[SwTestUnlockPartitionOffset +: SwTestUnlockPartitionSize]};
// SECRET_MANUF_PARTITION
unused ^= ^{part_digest[SecretManufPartitionIdx],
part_buf_data[SecretManufPartitionOffset +: SecretManufPartitionSize]};
// SECRET_PROD_PARTITION_0
unused ^= ^{part_digest[SecretProdPartition0Idx],
part_buf_data[SecretProdPartition0Offset +: SecretProdPartition0Size]};
// SECRET_PROD_PARTITION_1
unused ^= ^{part_digest[SecretProdPartition1Idx],
part_buf_data[SecretProdPartition1Offset +: SecretProdPartition1Size]};
// SECRET_PROD_PARTITION_2
unused ^= ^{part_digest[SecretProdPartition2Idx],
part_buf_data[SecretProdPartition2Offset +: SecretProdPartition2Size]};
// SECRET_PROD_PARTITION_3
unused ^= ^{part_digest[SecretProdPartition3Idx],
part_buf_data[SecretProdPartition3Offset +: SecretProdPartition3Size]};
// SW_MANUF_PARTITION
unused ^= ^{part_digest[SwManufPartitionIdx],
part_buf_data[SwManufPartitionOffset +: SwManufPartitionSize]};
// SECRET_LC_TRANSITION_PARTITION
unused ^= ^{part_digest[SecretLcTransitionPartitionIdx],
part_buf_data[SecretLcTransitionPartitionOffset +: SecretLcTransitionPartitionSize]};
// LIFE_CYCLE
unused ^= ^{part_digest[LifeCycleIdx],
part_buf_data[LifeCycleOffset +: LifeCycleSize]};
// VENDOR_HASHES_MANUF_PARTITION
unused ^= ^{part_digest[VendorHashesManufPartitionIdx],
part_buf_data[VendorHashesManufPartitionOffset +: VendorHashesManufPartitionSize]};
// VENDOR_HASHES_OWNER_PROD_PARTITION
unused ^= ^{part_digest[VendorHashesOwnerProdPartitionIdx],
part_buf_data[VendorHashesOwnerProdPartitionOffset +: VendorHashesOwnerProdPartitionSize]};
// VENDOR_HASHES_PROD_PARTITION
unused ^= ^{part_digest[VendorHashesProdPartitionIdx],
part_buf_data[VendorHashesProdPartitionOffset +: VendorHashesProdPartitionSize]};
// VENDOR_NON_SECRET_PROD_PARTITION
unused ^= ^{part_digest[VendorNonSecretProdPartitionIdx],
part_buf_data[VendorNonSecretProdPartitionOffset +: VendorNonSecretProdPartitionSize]};
// CSR_PARTITION
unused ^= ^{part_digest[CsrPartitionIdx],
part_buf_data[CsrPartitionOffset +: CsrPartitionSize]};
unused ^= valid;
return otp_keymgr_key;
endfunction : named_keymgr_key_assign
parameter int ProdVendorHashNum = NumVendorPkFuses-1;
parameter int ProdVendorHashSize = CptraCoreVendorPkHash1Size;
parameter int ProdVendorHashStart = CptraCoreVendorPkHash1Offset;
parameter int ProdVendorHashEnd = CptraCoreVendorPkHash1Offset + (ProdVendorHashSize * ProdVendorHashNum);
endpackage : otp_ctrl_part_pkg