Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
XiangShan
提交
f38ea464
X
XiangShan
项目概览
OpenXiangShan
/
XiangShan
8 个月 前同步成功
通知
1183
Star
3914
Fork
526
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
XiangShan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f38ea464
编写于
6月 09, 2022
作者:
S
Steve Gou
提交者:
GitHub
6月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1574 from OpenXiangShan/fix-ifu-ready
<bug-fix>: fix IFU misOffset bug and optimize code
上级
bcdd2404
e8747464
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
14 deletion
+19
-14
src/main/scala/xiangshan/frontend/IFU.scala
src/main/scala/xiangshan/frontend/IFU.scala
+9
-9
src/main/scala/xiangshan/frontend/NewFtq.scala
src/main/scala/xiangshan/frontend/NewFtq.scala
+1
-0
src/main/scala/xiangshan/frontend/icache/ICache.scala
src/main/scala/xiangshan/frontend/icache/ICache.scala
+4
-2
src/main/scala/xiangshan/frontend/icache/ICacheMainPipe.scala
...main/scala/xiangshan/frontend/icache/ICacheMainPipe.scala
+1
-1
src/main/scala/xiangshan/frontend/icache/IPrefetch.scala
src/main/scala/xiangshan/frontend/icache/IPrefetch.scala
+4
-2
未找到文件。
src/main/scala/xiangshan/frontend/IFU.scala
浏览文件 @
f38ea464
...
...
@@ -155,7 +155,7 @@ class NewIFU(implicit p: Parameters) extends XSModule
val
f1_ready
,
f2_ready
,
f3_ready
=
WireInit
(
false
.
B
)
fromFtq
.
req
.
ready
:=
toICache
(
0
).
ready
&&
toICache
(
1
).
ready
&&
f
2_ready
&&
GTimer
()
>
500.
U
fromFtq
.
req
.
ready
:=
toICache
(
0
).
ready
&&
toICache
(
1
).
ready
&&
f
1_ready
//
&& GTimer() > 500.U
toICache
(
0
).
valid
:=
fromFtq
.
req
.
valid
//&& !f0_flush
toICache
(
0
).
bits
.
vaddr
:=
fromFtq
.
req
.
bits
.
startAddr
...
...
@@ -186,9 +186,9 @@ class NewIFU(implicit p: Parameters) extends XSModule
// val f1_situation = RegEnable(f0_situation, f0_fire)
val
f1_doubleLine
=
RegEnable
(
f0_doubleLine
,
f0_fire
)
val
f1_vSetIdx
=
RegEnable
(
f0_vSetIdx
,
f0_fire
)
val
f1_fire
=
f1_valid
&&
f
1
_ready
val
f1_fire
=
f1_valid
&&
f
2
_ready
f1_ready
:=
f
2_ready
||
!
f1_valid
f1_ready
:=
f
1_fire
||
!
f1_valid
from_bpu_f1_flush
:=
fromFtq
.
flushFromBpu
.
shouldFlushByStage3
(
f1_ftq_req
.
ftqIdx
)
&&
f1_valid
// from_bpu_f1_flush := false.B
...
...
@@ -220,9 +220,9 @@ class NewIFU(implicit p: Parameters) extends XSModule
// val f2_situation = RegEnable(f1_situation, f1_fire)
val
f2_doubleLine
=
RegEnable
(
f1_doubleLine
,
f1_fire
)
val
f2_vSetIdx
=
RegEnable
(
f1_vSetIdx
,
f1_fire
)
val
f2_fire
=
f2_valid
&&
f
2_ready
val
f2_fire
=
f2_valid
&&
f
3_ready
&&
icacheRespAllValid
f2_ready
:=
f
3_ready
&&
icacheRespAllValid
||
!
f2_valid
f2_ready
:=
f
2_fire
||
!
f2_valid
//TODO: addr compare may be timing critical
val
f2_icache_all_resp_wire
=
fromICache
(
0
).
valid
&&
(
fromICache
(
0
).
bits
.
vaddr
===
f2_ftq_req
.
startAddr
)
&&
((
fromICache
(
1
).
valid
&&
(
fromICache
(
1
).
bits
.
vaddr
===
f2_ftq_req
.
nextlineStart
))
||
!
f2_doubleLine
)
val
f2_icache_all_resp_reg
=
RegInit
(
false
.
B
)
...
...
@@ -330,7 +330,7 @@ class NewIFU(implicit p: Parameters) extends XSModule
val
f3_doubleLine
=
RegEnable
(
f2_doubleLine
,
f2_fire
)
val
f3_fire
=
io
.
toIbuffer
.
fire
()
f3_ready
:=
io
.
toIbuffer
.
ready
||
!
f3_valid
f3_ready
:=
f3_fire
||
!
f3_valid
val
f3_cut_data
=
RegEnable
(
f2_cut_data
,
f2_fire
)
...
...
@@ -435,8 +435,8 @@ class NewIFU(implicit p: Parameters) extends XSModule
io
.
iTLBInter
.
resp
.
bits
.
excp
.
af
.
instr
mmio_state
:=
Mux
(
tlbExept
,
m_waitCommit
,
m_sendPMP
)
mmio_resend_addr
:=
io
.
iTLBInter
.
resp
.
bits
.
paddr
mmio_resend_af
:=
mmio_resend_af
||
io
.
iTLBInter
.
resp
.
bits
.
excp
.
af
.
instr
mmio_resend_pf
:=
mmio_resend_pf
||
io
.
iTLBInter
.
resp
.
bits
.
excp
.
pf
.
instr
mmio_resend_af
:=
io
.
iTLBInter
.
resp
.
bits
.
excp
.
af
.
instr
mmio_resend_pf
:=
io
.
iTLBInter
.
resp
.
bits
.
excp
.
pf
.
instr
}
is
(
m_sendPMP
){
...
...
@@ -659,7 +659,7 @@ class NewIFU(implicit p: Parameters) extends XSModule
checkFlushWb
.
bits
.
ftqIdx
:=
wb_ftq_req
.
ftqIdx
checkFlushWb
.
bits
.
ftqOffset
:=
wb_ftq_req
.
ftqOffset
.
bits
checkFlushWb
.
bits
.
misOffset
.
valid
:=
ParallelOR
(
wb_check_result
.
fixedMissPred
)
||
wb_half_flush
checkFlushWb
.
bits
.
misOffset
.
bits
:=
Mux
(
wb_half_flush
,
(
PredictWidth
-
1
).
U
,
ParallelPriorityEncoder
(
wb_check_result
.
fixedMissPred
))
checkFlushWb
.
bits
.
misOffset
.
bits
:=
Mux
(
wb_half_flush
,
wb_lastIdx
,
ParallelPriorityEncoder
(
wb_check_result
.
fixedMissPred
))
checkFlushWb
.
bits
.
cfiOffset
.
valid
:=
ParallelOR
(
wb_check_result
.
fixedTaken
)
checkFlushWb
.
bits
.
cfiOffset
.
bits
:=
ParallelPriorityEncoder
(
wb_check_result
.
fixedTaken
)
checkFlushWb
.
bits
.
target
:=
Mux
(
wb_half_flush
,
wb_half_target
,
wb_check_result
.
fixedTarget
(
ParallelPriorityEncoder
(
wb_check_result
.
fixedMissPred
)))
...
...
src/main/scala/xiangshan/frontend/NewFtq.scala
浏览文件 @
f38ea464
...
...
@@ -1014,6 +1014,7 @@ class Ftq(implicit p: Parameters) extends XSModule with HasCircularQueuePtrHelpe
}
XSError
(
isBefore
(
bpuPtr
,
prefetchPtr
)
&&
!
isFull
(
bpuPtr
,
prefetchPtr
),
"\nprefetchPtr is before bpuPtr!\n"
)
XSError
(
isBefore
(
prefetchPtr
,
ifuPtr
)
&&
!
isFull
(
ifuPtr
,
prefetchPtr
),
"\nifuPtr is before prefetchPtr!\n"
)
}
else
{
io
.
toPrefetch
.
req
<>
DontCare
...
...
src/main/scala/xiangshan/frontend/icache/ICache.scala
浏览文件 @
f38ea464
...
...
@@ -188,6 +188,8 @@ class ICacheMetaArray()(implicit p: Parameters) extends ICacheArray
tagArray
}
io
.
read
.
ready
:=
!
io
.
write
.
valid
&&
tagArrays
.
map
(
_
.
io
.
r
.
req
.
ready
).
reduce
(
_
&&
_
)
//Parity Decode
val
read_metas
=
Wire
(
Vec
(
2
,
Vec
(
nWays
,
new
ICacheMetadata
())))
for
((
tagArray
,
i
)
<-
tagArrays
.
zipWithIndex
){
...
...
@@ -291,8 +293,6 @@ class ICacheDataArray(implicit p: Parameters) extends ICacheArray
val
cacheOp
=
Flipped
(
new
L1CacheInnerOpIO
)
// customized cache op port
}}
io
.
read
.
ready
:=
!
io
.
write
.
valid
val
port_0_read_0
=
io
.
read
.
valid
&&
!
io
.
read
.
bits
.
vSetIdx
(
0
)(
0
)
val
port_0_read_1
=
io
.
read
.
valid
&&
io
.
read
.
bits
.
vSetIdx
(
0
)(
0
)
val
port_1_read_1
=
io
.
read
.
valid
&&
io
.
read
.
bits
.
vSetIdx
(
1
)(
0
)
&&
io
.
read
.
bits
.
isDoubleLine
...
...
@@ -363,6 +363,8 @@ class ICacheDataArray(implicit p: Parameters) extends ICacheArray
codeArray
}
io
.
read
.
ready
:=
!
io
.
write
.
valid
&&
dataArrays
.
map
(
_
.
io
.
r
.
req
.
ready
).
reduce
(
_
&&
_
)
&&
codeArrays
.
map
(
_
.
io
.
r
.
req
.
ready
).
reduce
(
_
&&
_
)
//Parity Decode
val
read_datas
=
Wire
(
Vec
(
2
,
Vec
(
nWays
,
UInt
(
blockBits
.
W
)
)))
val
read_codes
=
Wire
(
Vec
(
2
,
Vec
(
nWays
,
UInt
(
dataCodeEntryBits
.
W
)
)))
...
...
src/main/scala/xiangshan/frontend/icache/ICacheMainPipe.scala
浏览文件 @
f38ea464
...
...
@@ -234,7 +234,7 @@ class ICacheMainPipe(implicit p: Parameters) extends ICacheModule
//TODO: fix GTimer() condition
fromIFU
.
map
(
_
.
ready
:=
fetch_req
(
0
).
ready
&&
fetch_req
(
1
).
ready
&&
!
missSwitchBit
&&
!
tlb_slot
.
valid
&&
s1_ready
&&
GTimer
()
>
500.
U
)
s1_ready
)
//
&& GTimer() > 500.U )
/**
******************************************************************************
* ICache Stage 1
...
...
src/main/scala/xiangshan/frontend/icache/IPrefetch.scala
浏览文件 @
f38ea464
...
...
@@ -89,6 +89,8 @@ class IPrefetchPipe(implicit p: Parameters) extends IPrefetchModule
val
p0_valid
=
fromFtq
.
req
.
valid
val
p0_vaddr
=
addrAlign
(
fromFtq
.
req
.
bits
.
target
,
blockBytes
,
VAddrBits
)
p0_fire
:=
p0_valid
&&
p1_ready
&&
toITLB
.
fire
()
&&
!
fromITLB
.
bits
.
miss
&&
toIMeta
.
ready
&&
enableBit
//discard req when source not ready
// p0_discard := p0_valid && ((toITLB.fire() && fromITLB.bits.miss) || !toIMeta.ready || !enableBit)
toIMeta
.
valid
:=
p0_valid
toIMeta
.
bits
.
vSetIdx
(
0
)
:=
get_idx
(
p0_vaddr
)
...
...
@@ -108,7 +110,7 @@ class IPrefetchPipe(implicit p: Parameters) extends IPrefetchModule
fromITLB
.
ready
:=
true
.
B
fromFtq
.
req
.
ready
:=
(!
enableBit
||
(
enableBit
&&
p3_ready
))
&&
GTimer
()
>
500.
U
fromFtq
.
req
.
ready
:=
true
.
B
//(!enableBit || (enableBit && p3_ready)) && toIMeta.ready //
&& GTimer() > 500.U
/** Prefetch Stage 1: cache probe filter */
val
p1_valid
=
generatePipeControl
(
lastFire
=
p0_fire
,
thisFire
=
p1_fire
||
p1_discard
,
thisFlush
=
false
.
B
,
lastFlush
=
false
.
B
)
...
...
@@ -178,7 +180,7 @@ class IPrefetchPipe(implicit p: Parameters) extends IPrefetchModule
val
p3_hit_dir
=
VecInit
((
0
until
nPrefetchEntries
).
map
(
i
=>
prefetch_dir
(
i
).
valid
&&
prefetch_dir
(
i
).
paddr
===
p3_paddr
)).
reduce
(
_
||
_
)
p3_discard
:=
p3_hit_dir
||
p3_check_in_mshr
p3_discard
:=
p3_hit_dir
||
p3_check_in_mshr
||
(
p3_valid
&&
enableBit
&&
!
toMissUnit
.
enqReq
.
ready
)
toMissUnit
.
enqReq
.
valid
:=
p3_valid
&&
enableBit
&&
!
p3_discard
toMissUnit
.
enqReq
.
bits
.
paddr
:=
p3_paddr
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录