Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
XiangShan
提交
6e330dbc
X
XiangShan
项目概览
OpenXiangShan
/
XiangShan
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
6e330dbc
编写于
12月 23, 2020
作者:
Y
Yinan Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
roq: use reg to keep track of the number of valid entries
上级
ec3a4e63
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
34 addition
and
9 deletion
+34
-9
src/main/scala/xiangshan/backend/roq/Roq.scala
src/main/scala/xiangshan/backend/roq/Roq.scala
+34
-9
未找到文件。
src/main/scala/xiangshan/backend/roq/Roq.scala
浏览文件 @
6e330dbc
...
@@ -115,6 +115,8 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
...
@@ -115,6 +115,8 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
val
enqPtr
=
RegInit
(
0.
U
.
asTypeOf
(
new
RoqPtr
))
val
enqPtr
=
RegInit
(
0.
U
.
asTypeOf
(
new
RoqPtr
))
val
deqPtrVec
=
RegInit
(
VecInit
((
0
until
CommitWidth
).
map
(
_
.
U
.
asTypeOf
(
new
RoqPtr
))))
val
deqPtrVec
=
RegInit
(
VecInit
((
0
until
CommitWidth
).
map
(
_
.
U
.
asTypeOf
(
new
RoqPtr
))))
val
walkPtrVec
=
Reg
(
Vec
(
CommitWidth
,
new
RoqPtr
))
val
walkPtrVec
=
Reg
(
Vec
(
CommitWidth
,
new
RoqPtr
))
val
validCounter
=
RegInit
(
0.
U
(
log2Ceil
(
RoqSize
).
W
))
val
allowEnqueue
=
RegInit
(
true
.
B
)
val
enqPtrVec
=
VecInit
((
0
until
RenameWidth
).
map
(
i
=>
enqPtr
+
PopCount
(
io
.
enq
.
needAlloc
.
take
(
i
))))
val
enqPtrVec
=
VecInit
((
0
until
RenameWidth
).
map
(
i
=>
enqPtr
+
PopCount
(
io
.
enq
.
needAlloc
.
take
(
i
))))
val
deqPtr
=
deqPtrVec
(
0
)
val
deqPtr
=
deqPtrVec
(
0
)
...
@@ -171,6 +173,7 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
...
@@ -171,6 +173,7 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
when
(
io
.
commits
.
valid
.
asUInt
.
orR
)
{
hasNoSpecExec
:=
false
.
B
}
when
(
io
.
commits
.
valid
.
asUInt
.
orR
)
{
hasNoSpecExec
:=
false
.
B
}
for
(
i
<-
0
until
RenameWidth
)
{
for
(
i
<-
0
until
RenameWidth
)
{
// we don't determine whether io.redirect.valid here since redirect has higher priority
when
(
io
.
enq
.
req
(
i
).
valid
&&
io
.
enq
.
canAccept
)
{
when
(
io
.
enq
.
req
(
i
).
valid
&&
io
.
enq
.
canAccept
)
{
// store uop in data module and microOp Vec
// store uop in data module and microOp Vec
commitData
.
io
.
wen
(
i
)
:=
true
.
B
commitData
.
io
.
wen
(
i
)
:=
true
.
B
...
@@ -185,13 +188,10 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
...
@@ -185,13 +188,10 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
io
.
enq
.
resp
(
i
)
:=
enqPtrVec
(
i
)
io
.
enq
.
resp
(
i
)
:=
enqPtrVec
(
i
)
}
}
val
validEntries
=
distanceBetween
(
enqPtr
,
deqPtr
)
val
firedDispatch
=
Mux
(
io
.
enq
.
canAccept
,
PopCount
(
Cat
(
io
.
enq
.
req
.
map
(
_
.
valid
))),
0.
U
)
val
firedDispatch
=
Mux
(
io
.
enq
.
canAccept
,
PopCount
(
Cat
(
io
.
enq
.
req
.
map
(
_
.
valid
))),
0.
U
)
io
.
enq
.
canAccept
:=
(
validEntries
<=
(
RoqSize
-
RenameWidth
).
U
)
&&
!
hasBlockBackward
io
.
enq
.
canAccept
:=
allowEnqueue
&&
!
hasBlockBackward
io
.
enq
.
isEmpty
:=
isEmpty
io
.
enq
.
isEmpty
:=
isEmpty
XSDebug
(
p
"(ready, valid): ${io.enq.canAccept}, ${Binary(Cat(io.enq.req.map(_.valid)))}\n"
)
XSDebug
(
p
"(ready, valid): ${io.enq.canAccept}, ${Binary(Cat(io.enq.req.map(_.valid)))}\n"
)
enqPtr
:=
enqPtr
+
firedDispatch
when
(
firedDispatch
=/=
0.
U
)
{
when
(
firedDispatch
=/=
0.
U
)
{
XSInfo
(
"dispatched %d insts\n"
,
firedDispatch
)
XSInfo
(
"dispatched %d insts\n"
,
firedDispatch
)
}
}
...
@@ -359,9 +359,6 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
...
@@ -359,9 +359,6 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
}
}
// move tail ptr
// move tail ptr
when
(
state
===
s_idle
)
{
deqPtrVec
:=
VecInit
(
deqPtrVec
.
map
(
_
+
commitCnt
))
}
val
retireCounter
=
Mux
(
state
===
s_idle
,
commitCnt
,
0.
U
)
val
retireCounter
=
Mux
(
state
===
s_idle
,
commitCnt
,
0.
U
)
XSInfo
(
retireCounter
>
0.
U
,
"retired %d insts\n"
,
retireCounter
)
XSInfo
(
retireCounter
>
0.
U
,
"retired %d insts\n"
,
retireCounter
)
...
@@ -378,7 +375,6 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
...
@@ -378,7 +375,6 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
}
}
val
currentWalkPtr
=
Mux
(
state
===
s_walk
||
state
===
s_extrawalk
,
walkPtr
,
enqPtr
-
1.
U
)
val
currentWalkPtr
=
Mux
(
state
===
s_walk
||
state
===
s_extrawalk
,
walkPtr
,
enqPtr
-
1.
U
)
walkCounter
:=
distanceBetween
(
currentWalkPtr
,
io
.
redirect
.
bits
.
roqIdx
)
+
io
.
redirect
.
bits
.
flushItself
()
-
Mux
(
state
===
s_walk
,
commitCnt
,
0.
U
)
walkCounter
:=
distanceBetween
(
currentWalkPtr
,
io
.
redirect
.
bits
.
roqIdx
)
+
io
.
redirect
.
bits
.
flushItself
()
-
Mux
(
state
===
s_walk
,
commitCnt
,
0.
U
)
enqPtr
:=
io
.
redirect
.
bits
.
roqIdx
+
Mux
(
io
.
redirect
.
bits
.
flushItself
(),
0.
U
,
1.
U
)
}
}
// no enough space for walk, allocate extra space
// no enough space for walk, allocate extra space
...
@@ -392,10 +388,39 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
...
@@ -392,10 +388,39 @@ class Roq(numWbPorts: Int) extends XSModule with HasCircularQueuePtrHelper {
// when exception occurs, cancels all
// when exception occurs, cancels all
when
(
io
.
redirectOut
.
valid
)
{
when
(
io
.
redirectOut
.
valid
)
{
state
:=
s_idle
state
:=
s_idle
enqPtr
:=
0.
U
.
asTypeOf
(
new
RoqPtr
)
}
/**
* pointers
*/
when
(
io
.
redirectOut
.
valid
)
{
deqPtrVec
:=
VecInit
((
0
until
CommitWidth
).
map
(
_
.
U
.
asTypeOf
(
new
RoqPtr
)))
deqPtrVec
:=
VecInit
((
0
until
CommitWidth
).
map
(
_
.
U
.
asTypeOf
(
new
RoqPtr
)))
}.
elsewhen
(
state
===
s_idle
)
{
deqPtrVec
:=
deqPtrVec
.
map
(
_
+
commitCnt
)
}
}
when
(
io
.
redirectOut
.
valid
)
{
enqPtr
:=
0.
U
.
asTypeOf
(
new
RoqPtr
)
}.
elsewhen
(
io
.
redirect
.
valid
)
{
enqPtr
:=
io
.
redirect
.
bits
.
roqIdx
+
Mux
(
io
.
redirect
.
bits
.
flushItself
(),
0.
U
,
1.
U
)
}.
otherwise
{
enqPtr
:=
enqPtr
+
firedDispatch
}
val
lastCycleRedirect
=
RegNext
(
io
.
redirect
.
valid
)
val
nextValidCounter
=
Mux
(
io
.
redirectOut
.
valid
,
0.
U
,
Mux
(
lastCycleRedirect
,
distanceBetween
(
enqPtr
,
deqPtr
),
Mux
(
state
===
s_idle
,
(
validCounter
-
commitCnt
)
+
firedDispatch
,
validCounter
)
)
)
validCounter
:=
nextValidCounter
allowEnqueue
:=
nextValidCounter
<=
(
RoqSize
-
RenameWidth
).
U
/**
/**
* States
* States
* We put all the stage changes here.
* We put all the stage changes here.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录