Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
XiangShan
提交
594ba8ac
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 搜索 >>
提交
594ba8ac
编写于
8月 24, 2021
作者:
W
William Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mem: let lq refill width be equal to l1d bus width
上级
103b6914
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
14 deletion
+32
-14
src/main/scala/xiangshan/cache/DCacheWrapper.scala
src/main/scala/xiangshan/cache/DCacheWrapper.scala
+1
-1
src/main/scala/xiangshan/cache/L1Cache.scala
src/main/scala/xiangshan/cache/L1Cache.scala
+4
-0
src/main/scala/xiangshan/cache/MissQueue.scala
src/main/scala/xiangshan/cache/MissQueue.scala
+17
-3
src/main/scala/xiangshan/mem/lsqueue/LoadQueue.scala
src/main/scala/xiangshan/mem/lsqueue/LoadQueue.scala
+1
-1
src/main/scala/xiangshan/mem/lsqueue/LoadQueueData.scala
src/main/scala/xiangshan/mem/lsqueue/LoadQueueData.scala
+9
-9
未找到文件。
src/main/scala/xiangshan/cache/DCacheWrapper.scala
浏览文件 @
594ba8ac
...
...
@@ -85,7 +85,7 @@ class DCacheLineResp(implicit p: Parameters) extends DCacheBundle
class
Refill
(
implicit
p
:
Parameters
)
extends
DCacheBundle
{
val
addr
=
UInt
(
PAddrBits
.
W
)
val
data
=
UInt
(
(
cfg
.
blockBytes
*
8
)
.
W
)
val
data
=
UInt
(
l1BusDataWidth
.
W
)
def
dump
()
=
{
XSDebug
(
"Refill: addr: %x data: %x\n"
,
addr
,
data
)
}
...
...
src/main/scala/xiangshan/cache/L1Cache.scala
浏览文件 @
594ba8ac
...
...
@@ -39,11 +39,13 @@ trait HasL1CacheParameters extends HasXSParameter
def
nSets
=
cacheParams
.
nSets
def
nWays
=
cacheParams
.
nWays
def
blockBytes
=
cacheParams
.
blockBytes
def
refillBytes
=
l1BusDataWidth
/
8
def
blockBits
=
blockBytes
*
8
def
idxBits
=
log2Up
(
cacheParams
.
nSets
)
def
wayBits
=
log2Up
(
nWays
)
def
blockOffBits
=
log2Up
(
cacheParams
.
blockBytes
)
def
refillOffBits
=
log2Up
(
l1BusDataWidth
/
8
)
def
untagBits
=
blockOffBits
+
idxBits
// 4K page
...
...
@@ -71,6 +73,7 @@ trait HasL1CacheParameters extends HasXSParameter
def
wordOffBits
=
log2Up
(
wordBytes
)
// the number of words in a block
def
blockWords
=
blockBytes
/
wordBytes
def
refillWords
=
refillBytes
/
wordBytes
def
idxMSB
=
untagBits
-
1
def
idxLSB
=
blockOffBits
...
...
@@ -81,6 +84,7 @@ trait HasL1CacheParameters extends HasXSParameter
def
get_idx
(
addr
:
UInt
)
=
addr
(
untagBits
-
1
,
blockOffBits
)
def
get_block
(
addr
:
UInt
)
=
addr
>>
blockOffBits
def
get_block_addr
(
addr
:
UInt
)
=
(
addr
>>
blockOffBits
)
<<
blockOffBits
def
get_refill_addr
(
addr
:
UInt
)
=
(
addr
>>
refillOffBits
)
<<
refillOffBits
def
get_beat
(
addr
:
UInt
)
=
addr
(
blockOffBits
-
1
,
beatOffBits
)
def
get_row
(
addr
:
UInt
)
=
addr
(
blockOffBits
-
1
,
rowOffBits
)
...
...
src/main/scala/xiangshan/cache/MissQueue.scala
浏览文件 @
594ba8ac
...
...
@@ -308,9 +308,23 @@ class MissEntry(edge: TLEdgeOut)(implicit p: Parameters) extends DCacheModule
// put should_refill_data out of RegNext
// so that when load miss are merged at refill_done
// we can still refill data back
io
.
refill
.
valid
:=
RegNext
(
state
===
s_refill_resp
&&
refill_done
)
&&
should_refill_data
io
.
refill
.
bits
.
addr
:=
req
.
addr
io
.
refill
.
bits
.
data
:=
refill_data
.
asUInt
//
// Now refill to load queue width l1BusDataWidth, to load queue refill req
// will be issued as soon as data is ready (stored in regs in miss queue)
val
refill_data_splited
=
WireInit
(
VecInit
(
Seq
.
tabulate
(
cfg
.
blockBytes
*
8
/
l1BusDataWidth
)(
i
=>
{
val
data
=
refill_data
.
asUInt
data
((
i
+
1
)
*
l1BusDataWidth
-
1
,
i
*
l1BusDataWidth
)
})))
// val refill_addr_splited = WireInit(VecInit(Seq.tabulate(cfg.blockBytes * 8 / l1BusDataWidth)(i =>
// req.addr + (i << refillOffBits)
// )))
io
.
refill
.
valid
:=
RegNext
(
state
===
s_refill_resp
&&
io
.
mem_grant
.
fire
())
&&
should_refill_data
io
.
refill
.
bits
.
addr
:=
RegNext
(
req
.
addr
+
(
refill_count
<<
refillOffBits
))
io
.
refill
.
bits
.
data
:=
refill_data_splited
(
RegNext
(
refill_count
))
when
(
io
.
refill
.
fire
()){
io
.
refill
.
bits
.
dump
()
XSDebug
(
"refill_count %d\n"
,
RegNext
(
refill_count
));
}
when
(
state
===
s_main_pipe_req
)
{
io
.
pipe_req
.
valid
:=
true
.
B
...
...
src/main/scala/xiangshan/mem/lsqueue/LoadQueue.scala
浏览文件 @
594ba8ac
...
...
@@ -708,7 +708,7 @@ class LoadQueue(implicit p: Parameters) extends XSModule
for
(
i
<-
0
until
LoadQueueSize
)
{
if
(
i
%
4
==
0
)
XSDebug
(
""
)
XSDebug
(
false
,
true
.
B
,
"%x [%x] "
,
uop
(
i
).
cf
.
pc
,
d
ataModule
.
io
.
debug
(
i
).
paddr
)
XSDebug
(
false
,
true
.
B
,
"%x [%x] "
,
uop
(
i
).
cf
.
pc
,
d
ebug_paddr
(
i
)
)
PrintFlag
(
allocated
(
i
),
"a"
)
PrintFlag
(
allocated
(
i
)
&&
datavalid
(
i
),
"v"
)
PrintFlag
(
allocated
(
i
)
&&
writebacked
(
i
),
"w"
)
...
...
src/main/scala/xiangshan/mem/lsqueue/LoadQueueData.scala
浏览文件 @
594ba8ac
...
...
@@ -71,7 +71,7 @@ class LQPaddrModule(numEntries: Int, numRead: Int, numWrite: Int)(implicit p: Pa
}
for
(
j
<-
0
until
numEntries
)
{
io
.
refillMmask
(
j
)
:=
get_
block_addr
(
io
.
refillMdata
)
===
get_block
_addr
(
data
(
j
))
io
.
refillMmask
(
j
)
:=
get_
refill_addr
(
io
.
refillMdata
)
===
get_refill
_addr
(
data
(
j
))
}
// DataModuleTemplate should not be used when there're any write conflicts
...
...
@@ -180,7 +180,7 @@ class CoredataModule(numEntries: Int, numRead: Int, numWrite: Int)(implicit p: P
val
wdata
=
Input
(
Vec
(
numWrite
,
UInt
(
XLEN
.
W
)))
// masked write
val
mwmask
=
Input
(
Vec
(
numEntries
,
Bool
()))
val
refillData
=
Input
(
UInt
(
(
cfg
.
blockBytes
*
8
)
.
W
))
val
refillData
=
Input
(
UInt
(
l1BusDataWidth
.
W
))
// fwdMask io
val
fwdMaskWdata
=
Input
(
Vec
(
numWrite
,
UInt
(
8.
W
)))
...
...
@@ -188,14 +188,14 @@ class CoredataModule(numEntries: Int, numRead: Int, numWrite: Int)(implicit p: P
// fwdMaskWaddr = waddr
// paddr io
//
3
bits in paddr need to be stored in CoredataModule for refilling
//
refillOffBits - wordOffBits
bits in paddr need to be stored in CoredataModule for refilling
val
paddrWdata
=
Input
(
Vec
(
numWrite
,
UInt
((
PAddrBits
).
W
)))
val
paddrWen
=
Input
(
Vec
(
numWrite
,
Bool
()))
})
val
data8
=
Seq
.
fill
(
8
)(
Module
(
new
MaskedSyncDataModuleTemplate
(
UInt
(
8.
W
),
numEntries
,
numRead
,
numWrite
,
numMWrite
=
block
Words
)))
val
data8
=
Seq
.
fill
(
8
)(
Module
(
new
MaskedSyncDataModuleTemplate
(
UInt
(
8.
W
),
numEntries
,
numRead
,
numWrite
,
numMWrite
=
refill
Words
)))
val
fwdMask
=
Reg
(
Vec
(
numEntries
,
UInt
(
8.
W
)))
val
wordIndex
=
Reg
(
Vec
(
numEntries
,
UInt
((
block
OffBits
-
wordOffBits
).
W
)))
val
wordIndex
=
Reg
(
Vec
(
numEntries
,
UInt
((
refill
OffBits
-
wordOffBits
).
W
)))
// read ports
for
(
i
<-
0
until
numRead
)
{
...
...
@@ -227,16 +227,16 @@ class CoredataModule(numEntries: Int, numRead: Int, numWrite: Int)(implicit p: P
// select refill data
// split dcache result into words
val
words
=
VecInit
((
0
until
block
Words
)
map
{
i
=>
io
.
refillData
(
DataBits
*
(
i
+
1
)
-
1
,
DataBits
*
i
)})
val
words
=
VecInit
((
0
until
refill
Words
)
map
{
i
=>
io
.
refillData
(
DataBits
*
(
i
+
1
)
-
1
,
DataBits
*
i
)})
// select refill data according to wordIndex (paddr)
for
(
i
<-
0
until
8
)
{
for
(
j
<-
0
until
block
Words
)
{
for
(
j
<-
0
until
refill
Words
)
{
data8
(
i
).
io
.
mwdata
(
j
)
:=
words
(
j
)(
8
*(
i
+
1
)-
1
,
8
*
i
)
}
}
// gen refill wmask
for
(
j
<-
0
until
block
Words
)
{
for
(
j
<-
0
until
refill
Words
)
{
for
(
k
<-
0
until
numEntries
)
{
val
wordMatch
=
wordIndex
(
k
)
===
j
.
U
for
(
i
<-
0
until
8
)
{
...
...
@@ -272,7 +272,7 @@ class LoadQueueData(size: Int, wbNumRead: Int, wbNumWrite: Int)(implicit p: Para
val
refill
=
new
Bundle
()
{
val
valid
=
Input
(
Bool
())
val
paddr
=
Input
(
UInt
(
PAddrBits
.
W
))
val
data
=
Input
(
UInt
(
(
cfg
.
blockBytes
*
8
)
.
W
))
val
data
=
Input
(
UInt
(
l1BusDataWidth
.
W
))
val
refillMask
=
Input
(
Vec
(
size
,
Bool
()))
val
matchMask
=
Output
(
Vec
(
size
,
Bool
()))
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录