From ce2ded19ae10bf190fc9e2af584d1b1a27589526 Mon Sep 17 00:00:00 2001 From: Jonathan Woodruff Date: Mon, 20 Jan 2025 15:15:14 +0000 Subject: [PATCH] Optimise timing/scheduling by always returning the head of the RAS stack. This means that two returns decoded in the same cycle are likely to result in a misprediction. The trouble here was that the Decode loop wouldn't build with slight changes due to a scheduling conflict through the RAS due to the dependence of the next ras.first method on the earlier ras.pop method. This was indeed an unpleasant combinational path between concurrently decoding instructions. This change allows all RAS predictions to be independent (by assuming no pushes or pops occur earlier in the bundle than a return). --- src_Core/RISCY_OOO/procs/lib/Ras.bsv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src_Core/RISCY_OOO/procs/lib/Ras.bsv b/src_Core/RISCY_OOO/procs/lib/Ras.bsv index defb506..5f4289f 100644 --- a/src_Core/RISCY_OOO/procs/lib/Ras.bsv +++ b/src_Core/RISCY_OOO/procs/lib/Ras.bsv @@ -95,7 +95,9 @@ module mkRas(ReturnAddrStack) provisos(NumAlias#(TExp#(TLog#(RasEntries)), RasEn Vector#(SupSize, RAS) rasIfc; for(Integer i = 0; i < valueof(SupSize); i = i+1) begin rasIfc[i] = (interface RAS; - method CapMem first = stack[head[i]][0]; + // first should use head[i], but this is better for timing. + // head[0] misbehaves with two pops in the same cycle. + method CapMem first = stack[head[0]][0]; method ActionValue#(RasIndex) pop(Bool doPop); RasIndex h = head[i]; if (doPop) begin