提交 9f335956 编写于 作者: L Lingrui98

ftq: fix a stupid bug

上级 294cfa77
......@@ -20,10 +20,12 @@ object FtqPtr extends HasXSParameter {
object GetPcByFtq extends HasXSParameter {
def apply(ftqPC: UInt, ftqOffset: UInt, hasLastPrev: Bool, lastPacketPC: UInt) = {
assert(ftqPC.getWidth == VAddrBits)
assert(lastPacketPC.getWidth == VAddrBits)
assert(ftqOffset.getWidth == log2Up(PredictWidth))
val idxBits = ftqPC.head(VAddrBits - ftqOffset.getWidth - instOffsetBits)
val lastIdxBits = lastPacketPC.head(VAddrBits - ftqOffset.getWidth - instOffsetBits)
val selLastPacket = hasLastPrev && (ftqOffset === 0.U)
val packetIdx = Mux(selLastPacket, lastPacketPC, idxBits)
val packetIdx = Mux(selLastPacket, lastIdxBits, idxBits)
Cat(
packetIdx, // packet pc
Mux(selLastPacket, Fill(ftqOffset.getWidth, 1.U(1.W)), ftqOffset),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册