Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
XiangShan
提交
6c4d7a40
X
XiangShan
项目概览
OpenXiangShan
/
XiangShan
9 个月 前同步成功
通知
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 搜索 >>
未验证
提交
6c4d7a40
编写于
3月 19, 2021
作者:
Y
Yinan Xu
提交者:
GitHub
3月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add XSCoreWithL2 to wrap XSCore,L2 into a module (#696)
上级
8f6a1237
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
30 deletion
+50
-30
src/main/scala/top/Top.scala
src/main/scala/top/Top.scala
+50
-30
未找到文件。
src/main/scala/top/Top.scala
浏览文件 @
6c4d7a40
...
...
@@ -15,6 +15,48 @@ import sifive.blocks.inclusivecache._
import
xiangshan.cache.prefetch.L2Prefetcher
class
XSCoreWithL2
()(
implicit
p
:
config.Parameters
)
extends
LazyModule
with
HasXSParameter
{
val
core
=
LazyModule
(
new
XSCore
())
val
l2prefetcher
=
LazyModule
(
new
L2Prefetcher
())
val
l2cache
=
LazyModule
(
new
InclusiveCache
(
CacheParameters
(
level
=
2
,
ways
=
L2NWays
,
sets
=
L2NSets
,
blockBytes
=
L2BlockSize
,
beatBytes
=
L1BusWidth
/
8
,
// beatBytes = l1BusDataWidth / 8
cacheName
=
s
"L2"
),
InclusiveCacheMicroParameters
(
writeBytes
=
32
)
))
private
val
l2xbar
=
TLXbar
()
l2xbar
:=
TLBuffer
()
:=
core
.
memBlock
.
dcache
.
clientNode
l2xbar
:=
TLBuffer
()
:=
core
.
l1pluscache
.
clientNode
l2xbar
:=
TLBuffer
()
:=
core
.
ptw
.
node
l2xbar
:=
TLBuffer
()
:=
l2prefetcher
.
clientNode
l2cache
.
node
:=
TLBuffer
()
:=
l2xbar
lazy
val
module
=
new
XSCoreWithL2Imp
(
this
)
}
class
XSCoreWithL2Imp
(
outer
:
XSCoreWithL2
)
extends
LazyModuleImp
(
outer
)
with
HasXSParameter
{
val
io
=
IO
(
new
Bundle
{
val
hartId
=
Input
(
UInt
(
64.
W
))
val
externalInterrupt
=
new
ExternalInterruptIO
})
outer
.
core
.
module
.
io
.
hartId
:=
io
.
hartId
outer
.
core
.
module
.
io
.
externalInterrupt
:=
io
.
externalInterrupt
outer
.
l2prefetcher
.
module
.
io
.
enable
:=
RegNext
(
outer
.
core
.
module
.
io
.
l2_pf_enable
)
outer
.
l2prefetcher
.
module
.
io
.
in
<>
outer
.
l2cache
.
module
.
io
}
abstract
class
BaseXSSoc
()(
implicit
p
:
config.Parameters
)
extends
LazyModule
with
HasSoCParameter
{
val
bankedNode
=
BankBinder
(
L3NBanks
,
L3BlockSize
)
val
peripheralXbar
=
TLXbar
()
...
...
@@ -129,32 +171,12 @@ class XSTop()(implicit p: config.Parameters) extends BaseXSSoc()
println
(
s
"FPGASoC cores: $NumCores banks: $L3NBanks block size: $L3BlockSize bus size: $L3BusWidth"
)
val
core
=
Seq
.
fill
(
NumCores
)(
LazyModule
(
new
XSCore
()))
val
l2prefetcher
=
Seq
.
fill
(
NumCores
)(
LazyModule
(
new
L2Prefetcher
()))
val
l2cache
=
Seq
.
fill
(
NumCores
)(
LazyModule
(
new
InclusiveCache
(
CacheParameters
(
level
=
2
,
ways
=
L2NWays
,
sets
=
L2NSets
,
blockBytes
=
L2BlockSize
,
beatBytes
=
L1BusWidth
/
8
,
// beatBytes = l1BusDataWidth / 8
cacheName
=
s
"L2"
),
InclusiveCacheMicroParameters
(
writeBytes
=
32
)
)))
val
l2xbar
=
Seq
.
fill
(
NumCores
)(
TLXbar
())
val
core_with_l2
=
Seq
.
fill
(
NumCores
)(
LazyModule
(
new
XSCoreWithL2
))
for
(
i
<-
0
until
NumCores
)
{
peripheralXbar
:=
TLBuffer
()
:=
core
(
i
).
frontend
.
instrUncache
.
clientNode
peripheralXbar
:=
TLBuffer
()
:=
core
(
i
).
memBlock
.
uncache
.
clientNode
l2xbar
(
i
)
:=
TLBuffer
()
:=
core
(
i
).
memBlock
.
dcache
.
clientNode
l2xbar
(
i
)
:=
TLBuffer
()
:=
core
(
i
).
l1pluscache
.
clientNode
l2xbar
(
i
)
:=
TLBuffer
()
:=
core
(
i
).
ptw
.
node
l2xbar
(
i
)
:=
TLBuffer
()
:=
l2prefetcher
(
i
).
clientNode
l2cache
(
i
).
node
:=
TLBuffer
()
:=
l2xbar
(
i
)
l3_xbar
:=
TLBuffer
()
:=
l2cache
(
i
).
node
peripheralXbar
:=
TLBuffer
()
:=
core_with_l2
(
i
).
core
.
frontend
.
instrUncache
.
clientNode
peripheralXbar
:=
TLBuffer
()
:=
core_with_l2
(
i
).
core
.
memBlock
.
uncache
.
clientNode
l3_xbar
:=
TLBuffer
()
:=
core_with_l2
(
i
).
l2cache
.
node
}
private
val
clint
=
LazyModule
(
new
TLTimer
(
...
...
@@ -195,12 +217,10 @@ class XSTop()(implicit p: config.Parameters) extends BaseXSSoc()
plic
.
module
.
io
.
extra
.
get
.
intrVec
<>
RegNext
(
RegNext
(
io
.
extIntrs
))
for
(
i
<-
0
until
NumCores
)
{
core
(
i
).
module
.
io
.
hartId
:=
i
.
U
core
(
i
).
module
.
io
.
externalInterrupt
.
mtip
:=
clint
.
module
.
io
.
mtip
(
i
)
core
(
i
).
module
.
io
.
externalInterrupt
.
msip
:=
clint
.
module
.
io
.
msip
(
i
)
core
(
i
).
module
.
io
.
externalInterrupt
.
meip
:=
plic
.
module
.
io
.
extra
.
get
.
meip
(
i
)
l2prefetcher
(
i
).
module
.
io
.
enable
:=
RegNext
(
core
(
i
).
module
.
io
.
l2_pf_enable
)
l2prefetcher
(
i
).
module
.
io
.
in
<>
l2cache
(
i
).
module
.
io
core_with_l2
(
i
).
module
.
io
.
hartId
:=
i
.
U
core_with_l2
(
i
).
module
.
io
.
externalInterrupt
.
mtip
:=
clint
.
module
.
io
.
mtip
(
i
)
core_with_l2
(
i
).
module
.
io
.
externalInterrupt
.
msip
:=
clint
.
module
.
io
.
msip
(
i
)
core_with_l2
(
i
).
module
.
io
.
externalInterrupt
.
meip
:=
plic
.
module
.
io
.
extra
.
get
.
meip
(
i
)
}
dontTouch
(
io
.
extIntrs
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录