forked from lowRISC/opentitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflash_ctrl.hjson
3107 lines (2998 loc) · 84.2 KB
/
flash_ctrl.hjson
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
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
{
name: "flash_ctrl",
human_name: "Flash Controller",
one_line_desc: "Interfaces and manages integrated non-volatile flash memory; supports scrambling, integrity, and secure wipe",
one_paragraph_desc: '''
Flash Controller interfaces the integrated, non-volatile flash memory with software and other hardware components in the system, such as Life Cycle Controller, Key Manager, and OTP Controller.
It consists of the open source flash controller that interfaces with a third party flash module.
The protocol controller handles read, program, and erase requests, as well as life cycle RMA entry.
It supports differentiation between informational and data flash partitions, flash memory protection at page boundaries, and the handling of key manager secrets inaccessible to software.
The actual physical controller is highly parameterized (number of banks, number of pages for each bank, number of words and word size for each page, and number of read buffers) and supports XEX scrambling configurable by software, as well as two types of ECC support configurable on a page boundary.
'''
// Unique comportable IP identifier defined under KNOWN_CIP_IDS in the regtool.
cip_id: "8",
design_spec: "../doc",
dv_doc: "../doc/dv"
hw_checklist: "../doc/checklist",
sw_checklist: "/sw/device/lib/dif/dif_flash_ctrl",
revisions: [
{
version: "0.1.0",
life_stage: "L1",
design_stage: "D1",
verification_stage: "V1",
commit_id: "7049fd0d5d48e20772f8ebf32b240faa0dad5528",
},
{
version: "1.0.0",
life_stage: "L1",
design_stage: "D2S",
verification_stage: "V2S",
dif_stage: "S2",
},
]
clocking: [
{clock: "clk_i", reset: "rst_ni", primary: true},
{clock: "clk_otp_i", reset: "rst_otp_ni"}
]
bus_interfaces: [
{ protocol: "tlul", direction: "device", name: "core" }
{ protocol: "tlul", direction: "device", name: "prim" , hier_path: "u_eflash.u_flash.gen_generic.u_impl_generic.u_reg_top"}
{ protocol: "tlul", direction: "device", name: "mem" }
],
available_input_list: [
{ name: "tck", desc: "jtag clock" },
{ name: "tms", desc: "jtag tms" },
{ name: "tdi", desc: "jtag input" },
],
available_output_list: [
{ name: "tdo", desc: "jtag output" },
],
interrupt_list: [
{ name: "prog_empty", desc: "Program FIFO empty" },
{ name: "prog_lvl", desc: "Program FIFO drained to level" },
{ name: "rd_full", desc: "Read FIFO full" },
{ name: "rd_lvl", desc: "Read FIFO filled to level" },
{ name: "op_done", desc: "Operation complete" },
{ name: "corr_err", desc: "Correctable error encountered"},
],
alert_list: [
{ name: "recov_err",
desc: "flash recoverable errors",
},
{ name: "fatal_std_err",
desc: "flash standard fatal errors"
},
{ name: "fatal_err",
desc: "flash fatal errors"
},
{ name: "fatal_prim_flash_alert",
desc: "Fatal alert triggered inside the flash primitive, including fatal TL-UL bus integrity faults of the test interface."
},
{ name: "recov_prim_flash_alert",
desc: "Recoverable alert triggered inside the flash primitive."
}
],
// Define flash_ctrl <-> flash_phy struct package
inter_signal_list: [
{ struct: "flash_otp_key",
type: "req_rsp",
name: "otp",
act: "req",
package: "otp_ctrl_pkg"
},
{ struct: "lc_tx",
package: "lc_ctrl_pkg",
type: "uni"
act: "rcv"
name: "lc_nvm_debug_en"
},
{ struct: "mubi4"
package: "prim_mubi_pkg"
type: "uni"
act: "rcv"
name: "flash_bist_enable"
},
{ struct: "logic"
package: ""
type: "uni"
act: "rcv"
name: "flash_power_down_h"
},
{ struct: "logic"
package: ""
type: "uni"
act: "rcv"
name: "flash_power_ready_h"
},
{ struct: "",
package: "",
width: "2",
type: "io"
act: "none"
name: "flash_test_mode_a"
},
{ struct: "",
package: "",
type: "io"
act: "none"
name: "flash_test_voltage_h"
},
{ struct: "lc_tx"
type: "uni"
name: "lc_creator_seed_sw_rw_en"
act: "rcv"
package: "lc_ctrl_pkg"
},
{ struct: "lc_tx"
type: "uni"
name: "lc_owner_seed_sw_rw_en"
act: "rcv"
package: "lc_ctrl_pkg"
},
{ struct: "lc_tx"
type: "uni"
name: "lc_iso_part_sw_rd_en"
act: "rcv"
package: "lc_ctrl_pkg"
},
{ struct: "lc_tx"
type: "uni"
name: "lc_iso_part_sw_wr_en"
act: "rcv"
package: "lc_ctrl_pkg"
},
{ struct: "lc_tx"
type: "uni"
name: "lc_seed_hw_rd_en"
act: "rcv"
package: "lc_ctrl_pkg"
},
{ struct: "lc_tx"
type: "uni"
name: "lc_escalate_en"
act: "rcv"
package: "lc_ctrl_pkg"
},
{ struct: "lc_tx"
type: "uni"
name: "rma_req"
act: "rcv"
package: "lc_ctrl_pkg"
},
{ struct: "lc_tx"
type: "uni"
name: "rma_ack"
act: "req"
package: "lc_ctrl_pkg"
},
{ struct: "lc_flash_rma_seed"
type: "uni"
name: "rma_seed"
act: "rcv"
package: "lc_ctrl_pkg"
},
{ struct: "pwr_flash",
type: "uni",
name: "pwrmgr",
act: "req",
package: "pwrmgr_pkg"
},
{ struct: "keymgr_flash",
type: "uni",
name: "keymgr",
act: "req",
package: "flash_ctrl_pkg"
}
{ struct: "ast_obs_ctrl",
type: "uni",
name: "obs_ctrl",
act: "rcv",
package: "ast_pkg"
}
{ struct: "logic",
type: "uni",
name: "fla_obs",
act: "req",
width: "8",
package: ""
}
],
countermeasures: [
{ name: "REG.BUS.INTEGRITY",
desc: '''
End-to-end bus integrity scheme.
Since there are multiple access points for flash, please see
Transmission Integrity Faults in the documentation for more details.
The bus integrity scheme for flash is different from other comportable modules.
'''
}
{ name: "HOST.BUS.INTEGRITY",
desc: '''
End-to-end bus integrity scheme.
Since there are multiple access points for flash, please see
Transmission Integrity Faults in the documentation for more details.
The bus integrity scheme for flash is different from other comportable modules.
'''
}
{ name: "MEM.BUS.INTEGRITY",
desc: '''
End-to-end bus integrity scheme.
Since there are multiple access points for flash, please see
Transmission Integrity Faults in the documentation for more details.
The bus integrity scheme for flash is different from other comportable modules.
'''
}
{ name: "SCRAMBLE.KEY.SIDELOAD",
desc: "The scrambling key is sideloaded from OTP and thus unreadable by SW."
}
{ name: "LC_CTRL.INTERSIG.MUBI",
desc: '''
Life cycle control signals are used control information partition access
and flash debug access. See secret information partition, isolated information partitions
and jtag connection in documentation for more details.
'''
}
{ name: "CTRL.CONFIG.REGWEN",
desc: "Configurations cannot be changed when an operation is ongoing."
}
{ name: "DATA_REGIONS.CONFIG.REGWEN",
desc: "Each data region has a configurable regwen."
}
{ name: "DATA_REGIONS.CONFIG.SHADOW",
desc: "Data region configuration is shadowed."
}
{ name: "INFO_REGIONS.CONFIG.REGWEN",
desc: "Each info page of each type in each bank has separate regwen."
}
{ name: "INFO_REGIONS.CONFIG.SHADOW",
desc: "Each info page is shadowed."
}
{ name: "BANK.CONFIG.REGWEN",
desc: "Each bank has separate regwen for bank erase."
}
{ name: "BANK.CONFIG.SHADOW",
desc: "Each bank has separate regwen for bank erase."
}
{ name: "MEM.CTRL.GLOBAL_ESC",
desc: "Global escalation causes memory to no longer be accessible."
}
{ name: "MEM.CTRL.LOCAL_ESC",
desc: '''
A subset of fatal errors cause memory to no longer be accessible.
This subset is defined in !!STD_FAULT_STATUS.
'''
}
{ name: "MEM_DISABLE.CONFIG.MUBI",
desc: '''
Software control for flash disable is multibit.
The register is !!DIS.
'''
}
{ name: "EXEC.CONFIG.REDUN",
desc: '''
Software control for flash enable is 32-bit constant.
The register is !!EXEC.
'''
}
{ name: "MEM.SCRAMBLE",
desc: '''
The flash supports XEX scrambling.
The cipher used is PRINCE.
The scrambling scheme is enabled by software, please see flash scrambling in documentation for more details.
'''
}
{ name: "MEM.INTEGRITY",
desc: '''
The flash supports two layers of ECC integrity: one layer is for integrity,
and the other layer is for reliability.
These ECCs are enabled and disabled together by software.
Please see Flash ECC in the documentation for more details.
'''
}
{ name: "RMA_ENTRY.MEM.SEC_WIPE",
desc: "RMA entry entry wipes flash memory with random data."
}
{ name: "CTRL.FSM.SPARSE",
desc: '''
RMA handling FSMs in flash_ctrl_lcmgr are sparsely encoded.
FSM in flash_ctrl_arb is sparsely encoded.
'''
}
{ name: "PHY.FSM.SPARSE",
desc: "PHY FSMs are sparsely encoded."
}
{ name: "PHY_PROG.FSM.SPARSE",
desc: "PHY program FSMs are sparsely encoded."
}
{ name: "CTR.REDUN",
desc: '''
flash_ctrl_lcmgr handling counters are redundantly encoded.
This includes seed count and address count used during seed reading phase,
as well as word count, page count and wipe index in RMA entry phase.
'''
}
{ name: "PHY_ARBITER.CTRL.REDUN",
desc: '''
The phy arbiter for controller and host is redundant.
The arbiter has two instance underneath that are constantly compared to each other.
'''
}
{ name: "PHY_HOST_GRANT.CTRL.CONSISTENCY",
desc: '''
The host grant is consistency checked.
If the host is ever granted with info partition access, it is an error.
If the host is ever granted at the same time as a program/erase operation, it is an error.
'''
}
{ name: "PHY_ACK.CTRL.CONSISTENCY",
desc: '''
If the host or controller ever receive an unexpeced transaction acknowledge, it is an error.
'''
}
{ name: "FIFO.CTR.REDUN",
desc: "The FIFO pointers of several FIFOs are implemented with duplicate counters."
}
{ name: "MEM_TL_LC_GATE.FSM.SPARSE",
desc: "The control FSM inside the TL-UL gating primitive is sparsely encoded."
}
{ name: "PROG_TL_LC_GATE.FSM.SPARSE",
desc: "The control FSM inside the TL-UL gating primitive is sparsely encoded."
}
]
scan: "true", // Enable `scanmode_i` port
scan_en: "true", // Enable `scan_en_i` port
scan_reset: "true", // Enable `scan_rst_ni` port
param_list: [
// The reg parameters can be modified directly through top_*.hjson.
// The template will automatically propagate the appropriate values.
// Random netlist constants
{ name: "RndCnstAddrKey",
desc: "Compile-time random bits for default address key",
type: "flash_ctrl_pkg::flash_key_t"
randcount: "128",
randtype: "data", // randomize randcount databits
},
{ name: "RndCnstDataKey",
desc: "Compile-time random bits for default data key",
type: "flash_ctrl_pkg::flash_key_t"
randcount: "128",
randtype: "data", // randomize randcount databits
},
{ name: "RndCnstAllSeeds",
desc: "Compile-time random bits for default seeds",
type: "flash_ctrl_pkg::all_seeds_t"
randcount: "512",
randtype: "data", // randomize randcount databits
},
{ name: "RndCnstLfsrSeed",
desc: "Compile-time random bits for initial LFSR seed",
type: "flash_ctrl_pkg::lfsr_seed_t"
randcount: "32",
randtype: "data",
},
{ name: "RndCnstLfsrPerm",
desc: "Compile-time random permutation for LFSR output",
type: "flash_ctrl_pkg::lfsr_perm_t"
randcount: "32",
randtype: "perm",
},
{ name: "RegNumBanks",
desc: "Number of flash banks",
type: "int",
default: "2",
local: "true"
},
{ name: "RegPagesPerBank",
desc: "Number of pages per bank",
type: "int",
default: "256",
local: "true"
},
{ name: "RegBusPgmResBytes",
desc: "Program resolution window in bytes",
type: "int",
default: "64",
local: "true"
},
{ name: "RegPageWidth",
desc: "Number of bits needed to represent the pages within a bank",
type: "int",
default: "8",
local: "true"
},
{ name: "RegBankWidth",
desc: "Number of bits needed to represent the number of banks",
type: "int",
default: "1",
local: "true"
},
{ name: "NumRegions",
desc: "Number of configurable flash regions",
type: "int",
default: "8",
local: "true"
},
// The following parameters are derived from topgen and should not be
// directly modified.
{ name: "NumInfoTypes",
desc: "Number of info partition types",
type: "int",
default: "3",
local: "true"
},
{ name: "NumInfos0",
desc: "Number of configurable flash info pages for info type 0",
type: "int",
default: "10",
local: "true"
},
{ name: "NumInfos1",
desc: "Number of configurable flash info pages for info type 1",
type: "int",
default: "1",
local: "true"
},
{ name: "NumInfos2",
desc: "Number of configurable flash info pages for info type 2",
type: "int",
default: "2",
local: "true"
},
{ name: "WordsPerPage",
desc: "Number of words per page",
type: "int",
default: "256",
local: "true"
},
{ name: "BytesPerWord",
desc: "Number of bytes per word",
type: "int",
default: "8",
local: "true"
},
{ name: "BytesPerPage",
desc: "Number of bytes per page",
type: "int",
default: "2048",
local: "true"
},
{ name: "BytesPerBank",
desc: "Number of bytes per bank",
type: "int",
default: "524288",
local: "true"
},
// hex value of 0xa26a38f7
{ name: "ExecEn",
desc: "Constant value that enables flash execution",
type: "int unsigned"
default: "2724870391",
local: "true"
},
{ name: "SecScrambleEn",
desc: "Compile-time option to enable flash scrambling",
type: "bit",
default: "1",
local: "false",
expose: "true",
},
// Program FIFO depth
{ name: "ProgFifoDepth",
desc: "Depth of program fifo",
type: "int"
default: "16",
local: "false",
expose: "true"
},
{ name: "RdFifoDepth",
desc: "Depth of read fifo",
type: "int"
default: "16",
local: "false",
expose: "true"
},
// Maximum FIFO depth allowed
{ name: "MaxFifoDepth",
desc: "Maximum depth for read / program fifos",
type: "int"
default: "16",
},
{ name: "MaxFifoWidth",
desc: "Maximum depth for read / program fifos",
type: "int"
default: "5",
},
],
regwidth: "32",
registers: {
core: [
{ name: "DIS",
desc: "Disable flash functionality",
swaccess: "rw0c",
hwaccess: "hro",
fields: [
{ bits: "3:0",
name: "VAL",
mubi: true,
desc: '''
Disables flash functionality completely.
This is a shortcut mechanism used by the software to completely
kill flash in case of emergency.
Since this register is rw0c instead of rw, to disable, write any value in the form of
0xxx or xxx0, where x could be either 0 or 1.
'''
resval: false,
},
]
tags: [// Dont touch disable, it has several side effects on the system
"excl:CsrAllTests:CsrExclWrite"],
},
{ name: "EXEC",
desc: "Controls whether flash can be used for code execution fetches",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "31:0",
name: "EN",
desc: '''
A value of 0xa26a38f7 allows flash to be used for code execution.
Any other value prevents code execution.
'''
resval: 0
},
]
},
{ name: "INIT",
desc: "Controller init register",
swaccess: "rw1s",
hwaccess: "hro",
fields: [
{ bits: "0",
name: "VAL",
desc: '''
Initializes the flash controller.
During the initialization process, the flash controller requests the address and data
scramble keys and reads out the root seeds stored in flash before allowing other usage
of the flash controller.
When the initialization sequence is complete, the flash read buffers are enabled
and turned on.
'''
resval: "0"
tags: [// Dont init flash, it has several side effects on the status bits
"excl:CsrAllTests:CsrExclWrite"],
},
]
},
{ name: "CTRL_REGWEN",
swaccess: "ro",
hwaccess: "hwo",
hwext: "true",
desc: '''
Controls the configurability of the !!CONTROL register.
This register ensures the contents of !!CONTROL cannot be changed by software once a flash
operation has begun.
It unlocks whenever the existing flash operation completes, regardless of success or error.
''',
fields: [
{ bits: "0",
name: "EN",
desc: '''
Configuration enable.
This bit defaults to 1 and is set to 0 by hardware when flash operation is initiated.
When the controller completes the flash operation, this bit is set
back to 1 to allow software configuration of !!CONTROL
''',
resval: "1",
},
]
tags: [// This regwen is completely under HW management and thus cannot be manipulated
// by software.
"excl:CsrNonInitTests:CsrExclCheck"]
},
{ name: "CONTROL",
desc: "Control register",
regwen: "CTRL_REGWEN",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "0",
hwaccess: "hrw",
name: "START",
desc: '''
Start flash transaction. This bit shall only be set at the same time or after the other
fields of the !!CONTROL register and !!ADDR have been programmed.
'''
resval: "0"
tags: [// Dont enable flash - it causes several side-effects.
"excl:CsrAllTests:CsrExclWrite"],
},
{ bits: "5:4",
name: "OP",
desc: "Flash operation selection",
resval: "0"
enum: [
{ value: "0",
name: "Read",
desc: '''
Flash Read.
Read desired number of flash words
'''
},
{ value: "1",
name: "Prog",
desc: '''
Flash Program.
Program desired number of flash words
'''
},
{ value: "2",
name: "Erase",
desc: '''
Flash Erase Operation.
See ERASE_SEL for details on erase operation
'''
},
]
},
{ bits: "6",
name: "PROG_SEL",
desc: "Flash program operation type selection",
resval: "0"
enum: [
{ value: "0",
name: "Normal program",
desc: '''
Normal program operation to the flash
'''
},
{ value: "1",
name: "Program repair",
desc: '''
Repair program operation to the flash. Whether this is actually
supported depends on the underlying flash memory.
'''
},
]
},
{ bits: "7",
name: "ERASE_SEL",
desc: "Flash erase operation type selection",
resval: "0"
enum: [
{ value: "0",
name: "Page Erase",
desc: '''
Erase 1 page of flash
'''
},
{ value: "1",
name: "Bank Erase",
desc: '''
Erase 1 bank of flash
'''
},
]
},
{ bits: "8",
name: "PARTITION_SEL",
desc: '''
When doing a read, program or page erase operation, selects either info or data partition for operation.
When 0, select data partition - this is the portion of flash that is accessible both by the host and by the controller.
When 1, select info partition - this is the portion of flash that is only accessible by the controller.
When doing a bank erase operation, selects info partition also for erase.
When 0, bank erase only erases data partition.
When 1, bank erase erases data partition and info partition.
'''
resval: "0"
},
{ bits: "10:9",
name: "INFO_SEL",
desc: '''
Informational partions can have multiple types.
This field selects the info type to be accessed.
'''
resval: "0"
},
{ bits: "27:16",
name: "NUM",
desc: '''
One fewer than the number of bus words the flash operation should read or program.
For example, to read 10 words, software should program this field with the value 9.
'''
resval: "0"
},
]
},
{ name: "ADDR",
desc: "Address for flash operation",
swaccess: "rw",
hwaccess: "hro",
regwen: "CTRL_REGWEN",
resval: "0",
fields: [
{ bits: "19:0",
name: "START",
desc: '''
Start address of a flash transaction. This is a byte address relative to the flash
only. Ie, an address of 0 will access address 0 of the requested partition.
For read operations, the flash controller will truncate to the closest, lower word
aligned address. For example, if 0x13 is supplied, the controller will perform a
read at address 0x10.
Program operations behave similarly, the controller does not have read modified write
support.
For page erases, the controller will truncate to the closest lower page aligned
address. Similarly for bank erases, the controller will truncate to the closest
lower bank aligned address.
'''
resval: "0"
},
]
},
// Program type
{ name: "PROG_TYPE_EN",
desc: "Enable different program types",
regwen: "CTRL_REGWEN",
swaccess: "rw0c",
hwaccess: "hro",
fields: [
{ bits: "0",
resval: "1",
name: "NORMAL",
desc: '''
Normal prog type available
'''
},
{ bits: "1",
resval: "1",
name: "REPAIR",
desc: '''
Repair prog type available
'''
},
]
},
// erase suspend support
{ name: "ERASE_SUSPEND",
desc: "Suspend erase",
swaccess: "rw",
hwaccess: "hrw",
fields: [
{ bits: "0",
resval: "0",
name: "REQ",
desc: '''
When 1, request erase suspend.
If no erase ongoing, the request is immediately cleared by hardware
If erase ongoing, the request is fed to the flash_phy and cleared when the suspend is handled.
'''
},
],
tags: [// Erase suspend must be directly tested
"excl:CsrAllTests:CsrExclWrite"],
},
// Data partition memory properties region setup
{ multireg: {
cname: "FLASH_CTRL",
name: "REGION_CFG_REGWEN"
desc: "Memory region registers configuration enable.",
count: "NumRegions",
swaccess: "rw0c",
hwaccess: "none",
compact: false,
fields: [
{ bits: "0",
name: "REGION",
resval: "1"
desc: "Region register write enable. Once set to 0, it can longer be configured to 1",
enum: [
{ value: "0",
name: "Region locked",
desc: '''
Region can no longer be configured until next reset
'''
},
{ value: "1",
name: "Region enabled",
desc: '''
Region can be configured
'''
},
]
},
],
},
},
{ multireg: {
cname: "FLASH_CTRL",
name: "MP_REGION_CFG",
desc: "Memory property configuration for data partition",
count: "NumRegions",
swaccess: "rw",
hwaccess: "hro",
regwen: "REGION_CFG_REGWEN",
regwen_multi: true,
update_err_alert: "recov_err",
storage_err_alert: "fatal_err",
fields: [
{ bits: "3:0",
name: "EN",
mubi: true,
desc: '''
Region enabled, following fields apply.
If region is disabled, it is not matched against any incoming transaction.
''',
resval: false
},
{ bits: "7:4",
name: "RD_EN",
mubi: true,
desc: '''
Region can be read
''',
resval: false
},
{ bits: "11:8",
name: "PROG_EN",
mubi: true,
desc: '''
Region can be programmed
''',
resval: false
}
{ bits: "15:12",
name: "ERASE_EN",
mubi: true,
desc: '''
Region can be erased
''',
resval: false
}
{ bits: "19:16",
name: "SCRAMBLE_EN",
mubi: true,
desc: '''
Region is scramble enabled.
''',
resval: false
}
{ bits: "23:20",
name: "ECC_EN",
mubi: true,
desc: '''
Region is integrity checked and reliability ECC enabled.
''',
resval: false
}
{ bits: "27:24",
name: "HE_EN",
mubi: true,
desc: '''
Region is high endurance enabled.
''',
resval: false
}
],
},
},
{ multireg: {
cname: "FLASH_CTRL",
name: "MP_REGION",
desc: "Memory base and size configuration for data partition",
count: "NumRegions",
swaccess: "rw",
hwaccess: "hro",
regwen: "REGION_CFG_REGWEN",
regwen_multi: true,
update_err_alert: "recov_err",
storage_err_alert: "fatal_err",
fields: [
{ bits: "8:0",
name: "BASE",
desc: '''
Region base page. Note the granularity is page, not byte or word
''',
resval: "0"
},
{ bits: "18:9",
name: "SIZE",
desc: '''
Region size in number of pages.
For example, if base is 0 and size is 1, then the region is defined by page 0.
If base is 0 and size is 2, then the region is defined by pages 0 and 1.
''',
resval: "0"
},
],
},
},
// Default region properties for data partition
{ name: "DEFAULT_REGION",
desc: "Default region properties",
swaccess: "rw",
hwaccess: "hro",
update_err_alert: "recov_err",
storage_err_alert: "fatal_err",
fields: [
{ bits: "3:0",
name: "RD_EN",
mubi: true,
desc: '''
Region can be read
''',
resval: false