Data tables
All multi-word register data of the bring-up lives in one file
(lib/k1_ddr_tables.c), separate from the code that sequences it. Single
values (offsets, masks, command words, PLL words, CFG parameters) are named
constants in lib/k1_ddrt_regs.h. Keeping data apart lets a host tool print
every value and compare it with the specification (Testing,
check-tables). The values are what this image writes. They are not
an experimental optimum. fp2 timing bytes have measured accepted ranges
and isolated optima in MC timing: accepted ranges and optima (logsRefs/031).
Types (lib/k1_ddr_tables.h)
type |
fields |
meaning |
|---|---|---|
|
|
one MC word |
|
|
one banked MC word, a value per frequency point; |
|
|
one DFC table line: DATA, ADDR (MC offset + flags), INDEX |
|
|
electrical configuration of one memory type |
Rows written with the ROW(off, f3, f2, f1, f0) macro list the columns as
fp3, fp2, fp1, fp0 (the order of the specification tables) but store them by
index (fp[3]…fp[0]), so code indexes fp[n] naturally.
Tables
symbol |
entries |
content |
consumer |
|---|---|---|---|
|
20 |
frequency-independent MC words; entry 0 must be |
|
|
24 |
programmed banked words per fp (boot, both SKUs); three IO rows
( |
|
|
2 |
|
|
|
4 |
|
|
|
3 |
|
|
|
4 |
PMU CLKSEL word per fp ( |
|
|
— |
|
|
|
— |
|
same |
|
5 |
MR1, MR2, MR13, MR3, MR22 — before ZQ |
|
|
4 |
MR12, MR14, MR11, MR23 — after ZQ |
|
|
29 |
DFC entry flow ( |
|
|
15 |
DFC exit flow ( |
|
|
22 |
MC offsets captured once in the snapshot |
|
|
25 |
|
|
|
15 |
fixed entries |
|
|
3 × 3 |
PHY marker triplets (DATA, ADDR, INDEX) |
|
Resistance codes in the IO configurations: 1 = 240 Ω, 2 = 120 Ω, 3 = 80 Ω, 4 = 60 Ω, 5 = 48 Ω, 6 = 40 Ω.
Counts are declared as static constexpr size_t K1_N_* in the header and the
arrays are declared with those sizes, so a missing or extra row is a compile
error. The snapshot layout is additionally checked by static_asserts in
k1_ddr_init.c.
Two copies of the banked-register list
The 24 banked offsets appear twice: as the rows of k1_mc_timing (what
Device_Init writes) and inside k1_dfc_snap_bank (what the DFC snapshot reads
back). They are the same set in a different order: the snapshot list places
0x400 (WDQS) among the timings and 0x34c near the end, following the
snapshot layout, while Device_Init writes 0x400 only for LPDDR4. The test
model has a third copy (banked_off[] in model.c) that decides which
offsets are per-fp in the simulated MC.
Inspecting the tables
tools/test/dump_tables.c prints every fact in a line-oriented format, one
fact per line (265 lines today), for example:
global 0x44 0x40300
freq 2 0xa0800400
timing 0x300 0xc18 0xc18 0x80e 0x80e
timing 0x30c io
overlay 2 0x13e4 0x15000802
clksel 2 0x3b40
hwslp 2 0x40200210
pll 2400 0x2a203b00 0x50dd6432
io lpddr4x tx_pn 0xd8
flow 0x0 0x40303 0x44
exit 0x180 0x40b43 0x44
snap_bank 2 0x8 0x249
mark 0 0x1100 0x10000 0x20
size 0xd 512
geom x16 4 1024 0xe 15
rate lpddr4x 1066 1
mr_init1 1 2 13 3 22
mr21 0x13020095
mr21_after flow 0x18 0x1b
Fact kinds and counts: flow 29, snapb 25, timing 24, snapg 22,
rate 22, global 20, io 18, geom 16, snapt 15, exit 15,
size 9, overlay 8, and one to four lines each of wdqs,
snap_bank, hwslp, freq, clksel, tbl_flag, refresh,
pll, mark, mr21_after, swfc_slp, snap_first, snap_end,
snap_ctl0_bits, mr_init1, mr_init2, mr21 and dfc_pre.
It also prints derived facts produced by the code, not just the table contents:
k1_freq_bank(fp), the HW-DFC HW_SLP word per fp, the CTL_FREQ value
stored in each snapshot block, size codes, geometries from every MR8 density,
and the final fp of a list of data rates. check_tables.py compares this set
with the set it extracts from the specification and reports the differences in
both directions (Testing).
Changing a table
Change the value in
k1_ddr_tables.c(or the constant ink1_ddrt_regs.h).If an entry is added or removed, update the
K1_N_*count; the snapshotstatic_asserts must still hold.Run
make host-test(the model checks the snapshot lines it receives against its own copy of the layout) andmake check-tableswhen the specification source is available.If the change alters behaviour, add or adjust a mutant in
mutate.pyso the new value is pinned by a test.