more timing improvements
This commit is contained in:
1 parent
e626d0c4f8
commit
119099984d
4 files changed
+27
-16
No files matched your search
+11
-9
@@ -20,8 +20,8 @@
|
||||
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
void GetRext() {
|
||||
if (auto r = FindRext()) {
|
||||
void GetRext(u32 freq) {
|
||||
if (auto r = FindRext(freq)) {
|
||||
rext = r->rext;
|
||||
return;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace ams::ldr::hoc::pcv::mariko {
|
||||
}
|
||||
|
||||
void AutoLatency(volatile u32 &latency, u32 freq, u32 latencyStep) {
|
||||
if (freq > 1600'000 && freq <= 1862'400) { /* 1866tRWL */
|
||||
if (freq > 1600'000 && freq <= 1896'000) { /* 1866tRWL */
|
||||
latency += latencyStep * 2;
|
||||
} else { /* 2133tRWL */
|
||||
latency += latencyStep * 3;
|
||||
@@ -130,7 +130,7 @@ namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
HandleLatency(freq);
|
||||
|
||||
GetRext();
|
||||
GetRext(freq);
|
||||
|
||||
/* At 1333WL, for some reason (incorrect ram timing config in mtc table?), tRP causes crashes at high reductions - 2 seems to be the most common limit. */
|
||||
/* This is a lazy workaround until I find the issue... */
|
||||
@@ -162,17 +162,19 @@ namespace ams::ldr::hoc::pcv::mariko {
|
||||
tRPab = tRPpb + 3;
|
||||
|
||||
tR2P = CEIL((RL * 0.426) - 2.0);
|
||||
tR2W = FLOOR(FLOOR((5.0 / tCK_avg) + ((FLOOR(48.0 / WL) - 0.478) * 3.0)) / 1.501) + RL - (tRTW * 3) + finetRTW;
|
||||
tR2W = RL + 2 * (FLOOR(48.0 / WL) - 2) + CEIL((5.1022 / tCK_avg) + 0.2750) - FLOOR((1.4996 / tCK_avg) + 0.0020) - (tRTW * 3) + finetRTW;
|
||||
tRTM = FLOOR((10.0 + RL) + (3.502 / tCK_avg)) + FLOOR(7.489 / tCK_avg);
|
||||
tRATM = CEIL((tRTM - 10.0) + (RL * 0.426));
|
||||
|
||||
rdv = RL + FLOOR((5.105 / tCK_avg) + 17.017);
|
||||
qpop = rdv - 14;
|
||||
quse_width = CEIL(MAX(4.7760 / tCK_avg + 4.110, 5.1060 / tCK_avg + 3.170)) - FLOOR(2.55 / tCK_avg);
|
||||
quse = FLOOR(RL + ((5.082 / tCK_avg) + FLOOR(2.560 / tCK_avg))) - CEIL(4.820 / tCK_avg);
|
||||
u32 quseSum = CEIL(((4.897 / tCK_avg) - FLOOR(2.538 / tCK_avg)) + 3.782)
|
||||
+ FLOOR(RL + ((5.082 / tCK_avg) + FLOOR(2.560 / tCK_avg))) - CEIL(4.820 / tCK_avg);
|
||||
quse_width = CEIL(MAX((4.7760 / tCK_avg) + 4.110, (5.1060 / tCK_avg) + 3.170)) - FLOOR(2.55 / tCK_avg);
|
||||
quse = quseSum - quse_width;
|
||||
einput_duration = FLOOR(9.936 / tCK_avg) + 5.0 + quse_width;
|
||||
einput = quse - CEIL(9.928 / tCK_avg);
|
||||
u32 qrst_duration = FLOOR(1.375 / tCK_avg + 4.555);
|
||||
u32 qrst_duration = FLOOR((1.375 / tCK_avg) + 4.555);
|
||||
u32 qrstLow = MAX(static_cast<s32>(einput - qrst_duration - 2), static_cast<s32>(0));
|
||||
qrst = PACK_U32(qrst_duration, qrstLow);
|
||||
ibdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(1, quse - qrst_duration - 2.0);
|
||||
@@ -191,7 +193,7 @@ namespace ams::ldr::hoc::pcv::mariko {
|
||||
u32 obdlyLow = MAX(WL - FLOOR((126.0 / CEIL(tCK_avg + 8.601))), 0.0);
|
||||
obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow);
|
||||
|
||||
pdex2rw = CEIL(7.4870 / tCK_avg + 1.0257) + FLOOR(1.7410 / tCK_avg + 0.03) + FLOOR(1.0 / tCK_avg);
|
||||
pdex2rw = CEIL((7.4870 / tCK_avg) + 1.0257) + FLOOR((1.7410 / tCK_avg) + 0.03) + FLOOR(1.0 / tCK_avg);
|
||||
|
||||
tCLKSTOP = FLOOR(MIN(8.488 / tCK_avg, 23.0)) + 8.0;
|
||||
|
||||
|
||||
@@ -56,19 +56,19 @@ namespace ams::ldr::hoc::pcv::mariko {
|
||||
WRITE_PARAM_ALL_REG(table, emc_cfg, 0xF3200000);
|
||||
}
|
||||
|
||||
u32 trefbw = refresh_raw + 0x40;
|
||||
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
|
||||
|
||||
const u32 dyn_self_ref_control = (static_cast<u32>(7605.0 / tCK_avg) + 260) | (table->burst_regs.emc_dyn_self_ref_control & 0xffff0000);
|
||||
|
||||
CalculateTimings(tCK_avg, table->rate_khz);
|
||||
|
||||
u32 trefbw = refresh_raw + 0x40;
|
||||
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
|
||||
|
||||
const u32 ras_cyc = MIN(GET_CYCLE_CEIL(tRAS), static_cast<u32>(0x7F));
|
||||
const u32 rp_cyc = GET_CYCLE_CEIL(tRPpb);
|
||||
|
||||
WRITE_PARAM_ALL_REG(table, emc_rd_rcd, GET_CYCLE_CEIL(tRCD));
|
||||
WRITE_PARAM_ALL_REG(table, emc_wr_rcd, GET_CYCLE_CEIL(tRCD));
|
||||
WRITE_PARAM_ALL_REG(table, emc_rc, MIN(GET_CYCLE_CEIL(tRC), ras_cyc + rp_cyc));
|
||||
WRITE_PARAM_ALL_REG(table, emc_rc, MIN(GET_CYCLE_CEIL(tRC), ras_cyc + rp_cyc));
|
||||
WRITE_PARAM_ALL_REG(table, emc_ras, ras_cyc);
|
||||
WRITE_PARAM_ALL_REG(table, emc_rrd, GET_CYCLE_CEIL(tRRD));
|
||||
WRITE_PARAM_ALL_REG(table, emc_rfcpb, GET_CYCLE_CEIL(tRFCpb));
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
const ReplacePatch g_rext_table[] = {
|
||||
{1'633'000, 0x17}, {1'666'000, 0x18}, {1'700'000, 0x18},
|
||||
{1'733'000, 0x18}, {1'766'000, 0x18}, {1'800'000, 0x1A},
|
||||
{1'833'000, 0x1A}, {1'866'000, 0x1A}, {1'900'000, 0x19},
|
||||
{1'933'000, 0x19}, {1'966'000, 0x19}, {2'000'000, 0x19},
|
||||
{2'033'000, 0x19}, {2'066'000, 0x19}, {2'100'000, 0x1A},
|
||||
{2'133'000, 0x1A}, {2'166'000, 0x19}, {2'200'000, 0x19},
|
||||
{2'233'000, 0x19}, {2'266'000, 0x1A}, {2'300'000, 0x1B},
|
||||
{2'333'000, 0x1B}, {2'366'000, 0x1B}, {2'400'000, 0x1B},
|
||||
@@ -31,13 +36,17 @@ namespace ams::ldr::hoc::pcv::mariko {
|
||||
{2'933'000, 0x1C}, {2'966'000, 0x1D}, {3'000'000, 0x1D},
|
||||
{3'033'000, 0x1D}, {3'066'000, 0x1D}, {3'100'000, 0x1D},
|
||||
{3'133'000, 0x1D}, {3'166'000, 0x1C}, {3'200'000, 0x1C},
|
||||
{3'233'000, 0x1E}, {3'266'000, 0x1F}, {3'300'000, 0x1E},
|
||||
{3'333'000, 0x1F}, {3'366'000, 0x1F}, {3'400'000, 0x1F},
|
||||
{3'433'000, 0x1F}, {3'466'000, 0x1F}, {3'500'000, 0x1E},
|
||||
};
|
||||
|
||||
|
||||
const u32 g_rext_table_size = sizeof(g_rext_table) / sizeof(g_rext_table[0]);
|
||||
|
||||
const ReplacePatch *FindRext() {
|
||||
const ReplacePatch *FindRext(u32 rate_khz) {
|
||||
for (u32 i = 0; i < g_rext_table_size; i++) {
|
||||
if (g_rext_table[i].freq >= C.marikoEmcMaxClock) {
|
||||
if (g_rext_table[i].freq >= rate_khz) {
|
||||
return &g_rext_table[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
extern const ReplacePatch g_rext_table[];
|
||||
extern const u32 g_rext_table_size;
|
||||
const ReplacePatch *FindRext();
|
||||
const ReplacePatch *FindRext(u32 rate_khz);
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user