Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
XiangShan
提交
a0db5a4b
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 搜索 >>
未验证
提交
a0db5a4b
编写于
6月 20, 2022
作者:
Y
Yinan Xu
提交者:
GitHub
6月 20, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
decode: parallel fusion decoder and rat read (#1588)
上级
2f0b133c
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
220 addition
and
240 deletion
+220
-240
src/main/scala/xiangshan/backend/CtrlBlock.scala
src/main/scala/xiangshan/backend/CtrlBlock.scala
+9
-14
src/main/scala/xiangshan/backend/decode/DecodeStage.scala
src/main/scala/xiangshan/backend/decode/DecodeStage.scala
+20
-1
src/main/scala/xiangshan/backend/decode/DecodeUnit.scala
src/main/scala/xiangshan/backend/decode/DecodeUnit.scala
+1
-1
src/main/scala/xiangshan/backend/decode/FusionDecoder.scala
src/main/scala/xiangshan/backend/decode/FusionDecoder.scala
+176
-213
src/main/scala/xiangshan/backend/rename/Rename.scala
src/main/scala/xiangshan/backend/rename/Rename.scala
+14
-11
未找到文件。
src/main/scala/xiangshan/backend/CtrlBlock.scala
浏览文件 @
a0db5a4b
...
...
@@ -374,12 +374,14 @@ class CtrlBlockImp(outer: CtrlBlock)(implicit p: Parameters) extends LazyModuleI
decode
.
io
.
in
<>
io
.
frontend
.
cfVec
decode
.
io
.
csrCtrl
:=
RegNext
(
io
.
csrCtrl
)
decode
.
io
.
intRat
<>
rat
.
io
.
intReadPorts
decode
.
io
.
fpRat
<>
rat
.
io
.
fpReadPorts
// memory dependency predict
// when decode, send fold pc to mdp
for
(
i
<-
0
until
DecodeWidth
)
{
val
mdp_foldpc
=
Mux
(
decode
.
io
.
out
(
i
).
fire
()
,
decode
.
io
.
out
(
i
).
fire
,
decode
.
io
.
in
(
i
).
bits
.
foldpc
,
rename
.
io
.
in
(
i
).
bits
.
cf
.
foldpc
)
...
...
@@ -400,19 +402,7 @@ class CtrlBlockImp(outer: CtrlBlock)(implicit p: Parameters) extends LazyModuleI
lfst
.
io
.
dispatch
<>
dispatch
.
io
.
lfst
rat
.
io
.
robCommits
:=
rob
.
io
.
commits
for
((
r
,
i
)
<-
rat
.
io
.
intReadPorts
.
zipWithIndex
)
{
val
raddr
=
decode
.
io
.
out
(
i
).
bits
.
ctrl
.
lsrc
.
take
(
2
)
:+
decode
.
io
.
out
(
i
).
bits
.
ctrl
.
ldest
r
.
map
(
_
.
addr
).
zip
(
raddr
).
foreach
(
x
=>
x
.
_1
:=
x
.
_2
)
rename
.
io
.
intReadPorts
(
i
)
:=
r
.
map
(
_
.
data
)
r
.
foreach
(
_
.
hold
:=
!
rename
.
io
.
in
(
i
).
ready
)
}
rat
.
io
.
intRenamePorts
:=
rename
.
io
.
intRenamePorts
for
((
r
,
i
)
<-
rat
.
io
.
fpReadPorts
.
zipWithIndex
)
{
val
raddr
=
decode
.
io
.
out
(
i
).
bits
.
ctrl
.
lsrc
.
take
(
3
)
:+
decode
.
io
.
out
(
i
).
bits
.
ctrl
.
ldest
r
.
map
(
_
.
addr
).
zip
(
raddr
).
foreach
(
x
=>
x
.
_1
:=
x
.
_2
)
rename
.
io
.
fpReadPorts
(
i
)
:=
r
.
map
(
_
.
data
)
r
.
foreach
(
_
.
hold
:=
!
rename
.
io
.
in
(
i
).
ready
)
}
rat
.
io
.
fpRenamePorts
:=
rename
.
io
.
fpRenamePorts
rat
.
io
.
debug_int_rat
<>
io
.
debug_int_rat
rat
.
io
.
debug_fp_rat
<>
io
.
debug_fp_rat
...
...
@@ -421,12 +411,17 @@ class CtrlBlockImp(outer: CtrlBlock)(implicit p: Parameters) extends LazyModuleI
for
(
i
<-
0
until
RenameWidth
)
{
PipelineConnect
(
decode
.
io
.
out
(
i
),
rename
.
io
.
in
(
i
),
rename
.
io
.
in
(
i
).
ready
,
stage2Redirect
.
valid
||
pendingRedirect
)
rename
.
io
.
intReadPorts
(
i
)
:=
rat
.
io
.
intReadPorts
(
i
).
map
(
_
.
data
)
rename
.
io
.
fpReadPorts
(
i
)
:=
rat
.
io
.
fpReadPorts
(
i
).
map
(
_
.
data
)
if
(
i
<
RenameWidth
-
1
)
{
rename
.
io
.
fusionInfo
(
i
)
:=
RegEnable
(
decode
.
io
.
fusionInfo
(
i
),
decode
.
io
.
out
(
i
).
fire
)
}
rename
.
io
.
waittable
(
i
)
:=
RegEnable
(
waittable
.
io
.
rdata
(
i
),
decode
.
io
.
out
(
i
).
fire
)
}
rename
.
io
.
redirect
<>
stage2Redirect
rename
.
io
.
robCommits
<>
rob
.
io
.
commits
rename
.
io
.
ssit
<>
ssit
.
io
.
rdata
rename
.
io
.
waittable
<>
RegNext
(
waittable
.
io
.
rdata
)
// pipeline between rename and dispatch
for
(
i
<-
0
until
RenameWidth
)
{
...
...
src/main/scala/xiangshan/backend/decode/DecodeStage.scala
浏览文件 @
a0db5a4b
...
...
@@ -21,13 +21,18 @@ import chisel3._
import
chisel3.util._
import
xiangshan._
import
utils._
import
xiangshan.backend.rename.RatReadPort
class
DecodeStage
(
implicit
p
:
Parameters
)
extends
XSModule
with
HasPerfEvents
{
val
io
=
IO
(
new
Bundle
()
{
// from Ibuffer
val
in
=
Vec
(
DecodeWidth
,
Flipped
(
DecoupledIO
(
new
CtrlFlow
)))
// to
DecBuffer
// to
Rename
val
out
=
Vec
(
DecodeWidth
,
DecoupledIO
(
new
CfCtrl
))
val
fusionInfo
=
Vec
(
DecodeWidth
-
1
,
new
FusionDecodeInfo
)
// RAT read
val
intRat
=
Vec
(
RenameWidth
,
Vec
(
3
,
Flipped
(
new
RatReadPort
)))
val
fpRat
=
Vec
(
RenameWidth
,
Vec
(
4
,
Flipped
(
new
RatReadPort
)))
// csr control
val
csrCtrl
=
Input
(
new
CustomCSRCtrlIO
)
})
...
...
@@ -43,6 +48,19 @@ class DecodeStage(implicit p: Parameters) extends XSModule with HasPerfEvents {
io
.
out
(
i
).
valid
:=
io
.
in
(
i
).
valid
io
.
out
(
i
).
bits
:=
decoders
(
i
).
io
.
deq
.
cf_ctrl
io
.
in
(
i
).
ready
:=
io
.
out
(
i
).
ready
// We use the lsrc/ldest before fusion decoder to read RAT for better timing.
io
.
intRat
(
i
)(
0
).
addr
:=
decoders
(
i
).
io
.
deq
.
cf_ctrl
.
ctrl
.
lsrc
(
0
)
io
.
intRat
(
i
)(
1
).
addr
:=
decoders
(
i
).
io
.
deq
.
cf_ctrl
.
ctrl
.
lsrc
(
1
)
io
.
intRat
(
i
)(
2
).
addr
:=
decoders
(
i
).
io
.
deq
.
cf_ctrl
.
ctrl
.
ldest
io
.
intRat
(
i
).
foreach
(
_
.
hold
:=
!
io
.
out
(
i
).
ready
)
// Floating-point instructions can not be fused now.
io
.
fpRat
(
i
)(
0
).
addr
:=
decoders
(
i
).
io
.
deq
.
cf_ctrl
.
ctrl
.
lsrc
(
0
)
io
.
fpRat
(
i
)(
1
).
addr
:=
decoders
(
i
).
io
.
deq
.
cf_ctrl
.
ctrl
.
lsrc
(
1
)
io
.
fpRat
(
i
)(
2
).
addr
:=
decoders
(
i
).
io
.
deq
.
cf_ctrl
.
ctrl
.
lsrc
(
2
)
io
.
fpRat
(
i
)(
3
).
addr
:=
decoders
(
i
).
io
.
deq
.
cf_ctrl
.
ctrl
.
ldest
io
.
fpRat
(
i
).
foreach
(
_
.
hold
:=
!
io
.
out
(
i
).
ready
)
}
// instruction fusion
...
...
@@ -76,6 +94,7 @@ class DecodeStage(implicit p: Parameters) extends XSModule with HasPerfEvents {
v
:=
false
.
B
}
}
io
.
fusionInfo
:=
fusionDecoder
.
io
.
info
val
hasValid
=
VecInit
(
io
.
in
.
map
(
_
.
valid
)).
asUInt
.
orR
XSPerfAccumulate
(
"utilization"
,
PopCount
(
io
.
in
.
map
(
_
.
valid
)))
...
...
src/main/scala/xiangshan/backend/decode/DecodeUnit.scala
浏览文件 @
a0db5a4b
...
...
@@ -46,7 +46,7 @@ abstract trait DecodeConstants {
// | | | | | | | | | | | | selImm
List
(
SrcType
.
DC
,
SrcType
.
DC
,
SrcType
.
DC
,
FuType
.
alu
,
ALUOpType
.
sll
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
SelImm
.
INVALID_INSTR
)
// Use SelImm to indicate invalid instr
val
table
:
Array
[(
BitPat
,
List
[
BitPat
])]
val
table
:
Array
[(
BitPat
,
List
[
BitPat
])]
}
trait
DecodeUnitConstants
...
...
src/main/scala/xiangshan/backend/decode/FusionDecoder.scala
浏览文件 @
a0db5a4b
此差异已折叠。
点击以展开。
src/main/scala/xiangshan/backend/rename/Rename.scala
浏览文件 @
a0db5a4b
...
...
@@ -21,7 +21,7 @@ import chisel3._
import
chisel3.util._
import
xiangshan._
import
utils._
import
xiangshan.backend.decode.
{
Imm_I
,
Imm_LUI_LOAD
,
Imm_U
}
import
xiangshan.backend.decode.
{
FusionDecodeInfo
,
Imm_I
,
Imm_LUI_LOAD
,
Imm_U
}
import
xiangshan.backend.rob.RobPtr
import
xiangshan.backend.rename.freelist._
import
xiangshan.mem.mdp._
...
...
@@ -32,6 +32,7 @@ class Rename(implicit p: Parameters) extends XSModule with HasPerfEvents {
val
robCommits
=
Flipped
(
new
RobCommitIO
)
// from decode
val
in
=
Vec
(
RenameWidth
,
Flipped
(
DecoupledIO
(
new
CfCtrl
)))
val
fusionInfo
=
Vec
(
DecodeWidth
-
1
,
Flipped
(
new
FusionDecodeInfo
))
// ssit read result
val
ssit
=
Flipped
(
Vec
(
RenameWidth
,
Output
(
new
SSITEntry
)))
// waittable read result
...
...
@@ -104,7 +105,6 @@ class Rename(implicit p: Parameters) extends XSModule with HasPerfEvents {
val
hasValid
=
Cat
(
io
.
in
.
map
(
_
.
valid
)).
orR
val
isMove
=
io
.
in
.
map
(
_
.
bits
.
ctrl
.
isMove
)
val
intPsrc
=
Wire
(
Vec
(
RenameWidth
,
UInt
()))
val
intSpecWen
=
Wire
(
Vec
(
RenameWidth
,
Bool
()))
val
fpSpecWen
=
Wire
(
Vec
(
RenameWidth
,
Bool
()))
...
...
@@ -135,15 +135,18 @@ class Rename(implicit p: Parameters) extends XSModule with HasPerfEvents {
uops
(
i
).
robIdx
:=
robIdxHead
+
PopCount
(
io
.
in
.
take
(
i
).
map
(
_
.
valid
))
val
intPhySrcVec
=
io
.
intReadPorts
(
i
).
take
(
2
)
val
intOldPdest
=
io
.
intReadPorts
(
i
).
last
intPsrc
(
i
)
:=
intPhySrcVec
(
0
)
val
fpPhySrcVec
=
io
.
fpReadPorts
(
i
).
take
(
3
)
val
fpOldPdest
=
io
.
fpReadPorts
(
i
).
last
uops
(
i
).
psrc
(
0
)
:=
Mux
(
uops
(
i
).
ctrl
.
srcType
(
0
)
===
SrcType
.
reg
,
intPhySrcVec
(
0
),
fpPhySrcVec
(
0
))
uops
(
i
).
psrc
(
1
)
:=
Mux
(
uops
(
i
).
ctrl
.
srcType
(
1
)
===
SrcType
.
reg
,
intPhySrcVec
(
1
),
fpPhySrcVec
(
1
))
uops
(
i
).
psrc
(
2
)
:=
fpPhySrcVec
(
2
)
uops
(
i
).
old_pdest
:=
Mux
(
uops
(
i
).
ctrl
.
rfWen
,
intOldPdest
,
fpOldPdest
)
uops
(
i
).
psrc
(
0
)
:=
Mux
(
uops
(
i
).
ctrl
.
srcType
(
0
)
===
SrcType
.
reg
,
io
.
intReadPorts
(
i
)(
0
),
io
.
fpReadPorts
(
i
)(
0
))
uops
(
i
).
psrc
(
1
)
:=
Mux
(
uops
(
i
).
ctrl
.
srcType
(
1
)
===
SrcType
.
reg
,
io
.
intReadPorts
(
i
)(
1
),
io
.
fpReadPorts
(
i
)(
1
))
// int psrc2 should be bypassed from next instruction if it is fused
if
(
i
<
RenameWidth
-
1
)
{
when
(
io
.
fusionInfo
(
i
).
rs2FromRs2
||
io
.
fusionInfo
(
i
).
rs2FromRs1
)
{
uops
(
i
).
psrc
(
1
)
:=
Mux
(
io
.
fusionInfo
(
i
).
rs2FromRs2
,
io
.
intReadPorts
(
i
+
1
)(
1
),
io
.
intReadPorts
(
i
+
1
)(
0
))
}.
elsewhen
(
io
.
fusionInfo
(
i
).
rs2FromZero
)
{
uops
(
i
).
psrc
(
1
)
:=
0.
U
}
}
uops
(
i
).
psrc
(
2
)
:=
io
.
fpReadPorts
(
i
)(
2
)
uops
(
i
).
old_pdest
:=
Mux
(
uops
(
i
).
ctrl
.
rfWen
,
io
.
intReadPorts
(
i
).
last
,
io
.
fpReadPorts
(
i
).
last
)
uops
(
i
).
eliminatedMove
:=
isMove
(
i
)
// update pdest
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录