48 powerlib(libDRAMPower(getMemSpec(p), include_io))
52 Data::MemArchitectureSpec
55 Data::MemArchitectureSpec archSpec;
56 archSpec.burstLength = p->burst_length;
57 archSpec.nbrOfBanks = p->banks_per_rank;
59 archSpec.nbrOfRanks = 1;
63 archSpec.nbrOfColumns = 0;
64 archSpec.nbrOfRows = 0;
65 archSpec.width = p->device_bus_width;
66 archSpec.nbrOfBankGroups = p->bank_groups_per_rank;
67 archSpec.dll = p->dll;
68 archSpec.twoVoltageDomains =
hasTwoVDD(p);
70 archSpec.termination =
false;
81 Data::MemTimingSpec timingSpec;
82 timingSpec.RC =
divCeil((p->tRAS + p->tRP), p->tCK);
83 timingSpec.RCD =
divCeil(p->tRCD, p->tCK);
84 timingSpec.RL =
divCeil(p->tCL, p->tCK);
85 timingSpec.RP =
divCeil(p->tRP, p->tCK);
86 timingSpec.RFC =
divCeil(p->tRFC, p->tCK);
87 timingSpec.RAS =
divCeil(p->tRAS, p->tCK);
90 timingSpec.WL = timingSpec.RL - 1;
92 timingSpec.RTP =
divCeil(p->tRTP, p->tCK);
93 timingSpec.WR =
divCeil(p->tWR, p->tCK);
94 timingSpec.XP =
divCeil(p->tXP, p->tCK);
95 timingSpec.XPDLL =
divCeil(p->tXPDLL, p->tCK);
96 timingSpec.XS =
divCeil(p->tXS, p->tCK);
97 timingSpec.XSDLL =
divCeil(p->tXSDLL, p->tCK);
101 assert(timingSpec.clkPeriod != 0);
102 timingSpec.clkMhz = (1 / timingSpec.clkPeriod) * 1000;
110 Data::MemPowerSpec powerSpec;
111 powerSpec.idd0 = p->IDD0 * 1000;
112 powerSpec.idd02 = p->IDD02 * 1000;
113 powerSpec.idd2p0 = p->IDD2P0 * 1000;
114 powerSpec.idd2p02 = p->IDD2P02 * 1000;
115 powerSpec.idd2p1 = p->IDD2P1 * 1000;
116 powerSpec.idd2p12 = p->IDD2P12 * 1000;
117 powerSpec.idd2n = p->IDD2N * 1000;
118 powerSpec.idd2n2 = p->IDD2N2 * 1000;
119 powerSpec.idd3p0 = p->IDD3P0 * 1000;
120 powerSpec.idd3p02 = p->IDD3P02 * 1000;
121 powerSpec.idd3p1 = p->IDD3P1 * 1000;
122 powerSpec.idd3p12 = p->IDD3P12 * 1000;
123 powerSpec.idd3n = p->IDD3N * 1000;
124 powerSpec.idd3n2 = p->IDD3N2 * 1000;
125 powerSpec.idd4r = p->IDD4R * 1000;
126 powerSpec.idd4r2 = p->IDD4R2 * 1000;
127 powerSpec.idd4w = p->IDD4W * 1000;
128 powerSpec.idd4w2 = p->IDD4W2 * 1000;
129 powerSpec.idd5 = p->IDD5 * 1000;
130 powerSpec.idd52 = p->IDD52 * 1000;
131 powerSpec.idd6 = p->IDD6 * 1000;
132 powerSpec.idd62 = p->IDD62 * 1000;
133 powerSpec.vdd = p->VDD;
134 powerSpec.vdd2 = p->VDD2;
138 Data::MemorySpecification
141 Data::MemorySpecification memSpec;
151 return p->VDD2 == 0 ?
false :
true;
157 uint32_t burst_cycles =
divCeil(p->tBURST, p->tCK);
158 uint8_t data_rate = p->burst_length / burst_cycles;
160 if (data_rate != 1 && data_rate != 2 && data_rate != 4)
161 fatal(
"Got unexpected data rate %d, should be 1 or 2 or 4\n");
static Data::MemPowerSpec getPowerParams(const DRAMCtrlParams *p)
Transforms the power and current parameters defined in DRAMCtrlParam to the memSpec of DRAMPower...
static Data::MemArchitectureSpec getArchParams(const DRAMCtrlParams *p)
Transform the architechture parameters defined in DRAMCtrlParams to the memSpec of DRAMPower...
static uint8_t getDataRate(const DRAMCtrlParams *p)
Determine data rate, either one or two.
DRAMPower(const DRAMCtrlParams *p, bool include_io)
T divCeil(const T &a, const U &b)
static Data::MemTimingSpec getTimingParams(const DRAMCtrlParams *p)
Transforms the timing parameters defined in DRAMCtrlParams to the memSpec of DRAMPower.
static bool hasTwoVDD(const DRAMCtrlParams *p)
Determine if DRAM has two voltage domains (or one)
static Data::MemorySpecification getMemSpec(const DRAMCtrlParams *p)
Return an instance of MemSpec based on the DRAMCtrlParams.