Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
XiangShan
提交
4effcbc4
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,发现更多精彩内容 >>
提交
4effcbc4
编写于
8月 28, 2020
作者:
Y
Yinan Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lsroq: optimize forwardMask and forwardData
上级
c0c07cc2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
32 deletion
+19
-32
src/main/scala/xiangshan/mem/Lsroq.scala
src/main/scala/xiangshan/mem/Lsroq.scala
+19
-32
未找到文件。
src/main/scala/xiangshan/mem/Lsroq.scala
浏览文件 @
4effcbc4
...
...
@@ -401,7 +401,7 @@ class Lsroq extends XSModule {
// (2) if they have different flags, we need to check range(tail, lsroqSize) and range(0, lsroqIdx)
// Forward1: Mux(same_flag, range(tail, lsroqIdx), range(tail, lsroqSize))
// Forward2: Mux(same_flag, 0.U, range(0, lsroqIdx) )
// i.e. forward1 is the target entries with the same flag bits and forward2
// i.e. forward1 is the target entries with the same flag bits and forward2
otherwise
val
forwardMask1
=
WireInit
(
VecInit
(
Seq
.
fill
(
8
)(
false
.
B
)))
val
forwardData1
=
WireInit
(
VecInit
(
Seq
.
fill
(
8
)(
0.
U
(
8.
W
))))
val
forwardMask2
=
WireInit
(
VecInit
(
Seq
.
fill
(
8
)(
false
.
B
)))
...
...
@@ -413,44 +413,31 @@ class Lsroq extends XSModule {
val
needForward1
=
Mux
(
differentFlag
,
~
tailMask
,
tailMask
^
forwardMask
)
val
needForward2
=
Mux
(
differentFlag
,
forwardMask
,
0.
U
(
LsroqSize
.
W
))
// forward lookup vec2
(
0
until
LsroqSize
).
map
(
j
=>
{
when
(
needForward2
(
j
)
&&
valid
(
j
)
&&
allocated
(
j
)
&&
store
(
j
)
&&
io
.
forward
(
i
).
paddr
(
PAddrBits
-
1
,
3
)
===
data
(
j
).
paddr
(
PAddrBits
-
1
,
3
)
)
{
(
0
until
8
).
map
(
k
=>
{
when
(
data
(
j
).
mask
(
k
))
{
// entry with larger index should have higher priority since it's data is younger
for
(
j
<-
0
until
LsroqSize
)
{
val
needCheck
=
valid
(
j
)
&&
allocated
(
j
)
&&
store
(
j
)
&&
io
.
forward
(
i
).
paddr
(
PAddrBits
-
1
,
3
)
===
data
(
j
).
paddr
(
PAddrBits
-
1
,
3
)
(
0
until
XLEN
/
8
).
foreach
(
k
=>
{
when
(
needCheck
&&
data
(
j
).
mask
(
k
))
{
when
(
needForward2
(
j
))
{
forwardMask2
(
k
)
:=
true
.
B
forwardData2
(
k
)
:=
data
(
j
).
data
(
8
*
(
k
+
1
)
-
1
,
8
*
k
)
XSDebug
(
"forwarding "
+
k
+
"th byte %x from ptr %d pc %x\n"
,
data
(
j
).
data
(
8
*
(
k
+
1
)
-
1
,
8
*
k
),
j
.
U
,
uop
(
j
).
cf
.
pc
)
XSDebug
(
p
"forwarding $k-th byte ${Hexadecimal(data(j).data(8 * (k + 1) - 1, 8 * k))} "
+
p
"from ptr $j pc ${Hexadecimal(uop(j).cf.pc)}\n"
)
}
})
}
})
// forward lookup vec1
(
0
until
LsroqSize
).
map
(
j
=>
{
when
(
needForward1
(
j
)
&&
valid
(
j
)
&&
allocated
(
j
)
&&
store
(
j
)
&&
io
.
forward
(
i
).
paddr
(
PAddrBits
-
1
,
3
)
===
data
(
j
).
paddr
(
PAddrBits
-
1
,
3
)
)
{
(
0
until
8
).
map
(
k
=>
{
when
(
data
(
j
).
mask
(
k
))
{
// forward1 is older than forward2 and should have higher priority
when
(
needForward1
(
j
))
{
forwardMask1
(
k
)
:=
true
.
B
forwardData1
(
k
)
:=
data
(
j
).
data
(
8
*
(
k
+
1
)
-
1
,
8
*
k
)
XSDebug
(
"forwarding "
+
k
+
"th byte %x from ptr %d pc %x\n"
,
data
(
j
).
data
(
8
*
(
k
+
1
)
-
1
,
8
*
k
),
j
.
U
,
uop
(
j
).
cf
.
pc
)
XSDebug
(
p
"forwarding $k-th byte ${Hexadecimal(data(j).data(8 * (k + 1) - 1, 8 * k))} "
+
p
"from ptr $j pc ${Hexadecimal(uop(j).cf.pc)}\n"
)
}
})
}
})
}
})
}
// merge forward lookup results
(
0
until
8
).
map
(
k
=>
{
(
0
until
XLEN
/
8
).
map
(
k
=>
{
io
.
forward
(
i
).
forwardMask
(
k
)
:=
forwardMask1
(
k
)
||
forwardMask2
(
k
)
io
.
forward
(
i
).
forwardData
(
k
)
:=
Mux
(
forwardMask1
(
k
),
forwardData1
(
k
),
forwardData2
(
k
))
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录