From e4beff2a224f0afb40adeeed028f15ab5929bade Mon Sep 17 00:00:00 2001 From: Yinan Xu Date: Sun, 13 Dec 2020 11:41:33 +0800 Subject: [PATCH] freelist: generate 6 pdests first and then select from them --- .../scala/xiangshan/backend/rename/FreeList.scala | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/scala/xiangshan/backend/rename/FreeList.scala b/src/main/scala/xiangshan/backend/rename/FreeList.scala index c89bc8b03..ec397ac15 100644 --- a/src/main/scala/xiangshan/backend/rename/FreeList.scala +++ b/src/main/scala/xiangshan/backend/rename/FreeList.scala @@ -84,22 +84,19 @@ class FreeList extends XSModule with HasFreeListConsts with HasCircularQueuePtrH io.req.canAlloc := RegNext(freeRegs >= RenameWidth.U) XSDebug(p"free regs: $freeRegs\n") - - val newHeadPtrs = ((0 until RenameWidth) map {i => - if(i == 0) headPtr else headPtr + PopCount(io.req.allocReqs.take(i)) - }) :+ (headPtr + PopCount(io.req.allocReqs)) + val allocatePtrs = (0 until RenameWidth).map(i => headPtr + i.U) + val allocatePdests = VecInit(allocatePtrs.map(ptr => freeList(ptr.value))) for(i <- 0 until RenameWidth){ - val ptr = newHeadPtrs(i) - val idx = ptr.value - io.req.pdests(i) := freeList(idx) + io.req.pdests(i) := allocatePdests(/*if (i == 0) 0.U else */PopCount(io.req.allocReqs.take(i))) // when(io.cpReqs(i).valid){ // checkPoints(io.cpReqs(i).bits.value) := newHeadPtrs(i+1) // XSDebug(p"do checkPt at BrqIdx=${io.cpReqs(i).bits.value} ${newHeadPtrs(i+1)}\n") // } XSDebug(p"req:${io.req.allocReqs(i)} canAlloc:${io.req.canAlloc} pdest:${io.req.pdests(i)}\n") } - val headPtrNext = Mux(io.req.canAlloc && io.req.doAlloc, newHeadPtrs.last, headPtr) + val headPtrAllocate = headPtr + PopCount(io.req.allocReqs) + val headPtrNext = Mux(io.req.canAlloc && io.req.doAlloc, headPtrAllocate, headPtr) freeRegs := distanceBetween(tailPtr, headPtrNext) // when mispredict or exception happens, reset headPtr to tailPtr (freelist is full). -- GitLab