47 powerlib(libDRAMPower(getMemSpec(
p), include_io))
51Data::MemArchitectureSpec
54 Data::MemArchitectureSpec archSpec;
55 archSpec.burstLength =
p.burst_length;
56 archSpec.nbrOfBanks =
p.banks_per_rank;
58 archSpec.nbrOfRanks = 1;
59 archSpec.dataRate =
p.beats_per_clock;
62 archSpec.nbrOfColumns = 0;
63 archSpec.nbrOfRows = 0;
64 archSpec.width =
p.device_bus_width;
65 archSpec.nbrOfBankGroups =
p.bank_groups_per_rank;
69 archSpec.termination =
false;
80 Data::MemTimingSpec timingSpec;
81 timingSpec.RC =
divCeil((
p.tRAS +
p.tRP),
p.tCK);
89 timingSpec.WL = timingSpec.RL - 1;
94 timingSpec.XPDLL =
divCeil(
p.tXPDLL,
p.tCK);
96 timingSpec.XSDLL =
divCeil(
p.tXSDLL,
p.tCK);
100 assert(timingSpec.clkPeriod != 0);
101 timingSpec.clkMhz = (1 / timingSpec.clkPeriod) * 1000;
109 Data::MemPowerSpec powerSpec;
110 powerSpec.idd0 =
p.IDD0 * 1000;
111 powerSpec.idd02 =
p.IDD02 * 1000;
112 powerSpec.idd2p0 =
p.IDD2P0 * 1000;
113 powerSpec.idd2p02 =
p.IDD2P02 * 1000;
114 powerSpec.idd2p1 =
p.IDD2P1 * 1000;
115 powerSpec.idd2p12 =
p.IDD2P12 * 1000;
116 powerSpec.idd2n =
p.IDD2N * 1000;
117 powerSpec.idd2n2 =
p.IDD2N2 * 1000;
118 powerSpec.idd3p0 =
p.IDD3P0 * 1000;
119 powerSpec.idd3p02 =
p.IDD3P02 * 1000;
120 powerSpec.idd3p1 =
p.IDD3P1 * 1000;
121 powerSpec.idd3p12 =
p.IDD3P12 * 1000;
122 powerSpec.idd3n =
p.IDD3N * 1000;
123 powerSpec.idd3n2 =
p.IDD3N2 * 1000;
124 powerSpec.idd4r =
p.IDD4R * 1000;
125 powerSpec.idd4r2 =
p.IDD4R2 * 1000;
126 powerSpec.idd4w =
p.IDD4W * 1000;
127 powerSpec.idd4w2 =
p.IDD4W2 * 1000;
128 powerSpec.idd5 =
p.IDD5 * 1000;
129 powerSpec.idd52 =
p.IDD52 * 1000;
130 powerSpec.idd6 =
p.IDD6 * 1000;
131 powerSpec.idd62 =
p.IDD62 * 1000;
132 powerSpec.vdd =
p.VDD;
133 powerSpec.vdd2 =
p.VDD2;
137Data::MemorySpecification
140 Data::MemorySpecification memSpec;
150 return p.VDD2 == 0 ? false :
true;
156 uint32_t burst_cycles =
divCeil(
p.tBURST_MAX,
p.tCK);
157 uint8_t data_rate =
p.burst_length / burst_cycles;
159 if (data_rate != 1 && data_rate != 2 && data_rate != 4 && data_rate != 8)
160 fatal(
"Got unexpected data rate %d, should be 1 or 2 or 4 or 8\n");
static bool hasTwoVDD(const DRAMInterfaceParams &p)
Determine if DRAM has two voltage domains (or one)
static Data::MemTimingSpec getTimingParams(const DRAMInterfaceParams &p)
Transforms the timing parameters defined in DRAMInterfaceParams to the memSpec of DRAMPower.
static Data::MemPowerSpec getPowerParams(const DRAMInterfaceParams &p)
Transforms the power and current parameters defined in DRAMInterfaceParams to the memSpec of DRAMPowe...
DRAMPower(const DRAMInterfaceParams &p, bool include_io)
static Data::MemArchitectureSpec getArchParams(const DRAMInterfaceParams &p)
Transform the architechture parameters defined in DRAMInterfaceParams to the memSpec of DRAMPower.
static uint8_t getDataRate(const DRAMInterfaceParams &p)
Determine data rate, either one or two.
static Data::MemorySpecification getMemSpec(const DRAMInterfaceParams &p)
Return an instance of MemSpec based on the DRAMInterfaceParams.
static constexpr T divCeil(const T &a, const U &b)
#define fatal(...)
This implements a cprintf based fatal() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.