Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
XiangShan
提交
945f1332
X
XiangShan
项目概览
OpenXiangShan
/
XiangShan
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
945f1332
编写于
11月 05, 2020
作者:
A
Allen
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:RISCVERS/XiangShan into l1plusCache
上级
3469bd46
235e71e4
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
78 addition
and
43 deletion
+78
-43
.github/workflows/emu.yml
.github/workflows/emu.yml
+2
-2
.gitmodules
.gitmodules
+5
-1
Makefile
Makefile
+1
-1
build.sc
build.sc
+23
-11
chiseltest
chiseltest
+1
-0
rocket-chip
rocket-chip
+1
-1
src/main/scala/xiangshan/frontend/PreDecode.scala
src/main/scala/xiangshan/frontend/PreDecode.scala
+1
-1
src/main/scala/xiangshan/frontend/RAS.scala
src/main/scala/xiangshan/frontend/RAS.scala
+2
-2
src/main/scala/xiangshan/mem/lsqueue/separated/LoadQueue.scala
...ain/scala/xiangshan/mem/lsqueue/separated/LoadQueue.scala
+8
-2
src/main/scala/xiangshan/mem/lsqueue/separated/StoreQueue.scala
...in/scala/xiangshan/mem/lsqueue/separated/StoreQueue.scala
+13
-7
src/main/scala/xstransforms/ShowPrintTransform.scala
src/main/scala/xstransforms/ShowPrintTransform.scala
+1
-1
src/test/csrc/emu.cpp
src/test/csrc/emu.cpp
+3
-3
src/test/csrc/ram.cpp
src/test/csrc/ram.cpp
+6
-7
src/test/scala/cache/L2CacheTest.scala
src/test/scala/cache/L2CacheTest.scala
+2
-0
src/test/vsrc/ram.v
src/test/vsrc/ram.v
+9
-4
未找到文件。
.github/workflows/emu.yml
浏览文件 @
945f1332
...
...
@@ -70,7 +70,7 @@ jobs:
echo $AM_HOME
echo $NEMU_HOME
echo $NOOP_HOME
make -C $AM_HOME/apps/microbench ARCH=riscv64-noop AM_HOME=$AM_HOME NEMU_HOME=$NEMU_HOME NOOP_HOME=$NOOP_HOME mainargs=test run
make -C $AM_HOME/apps/microbench ARCH=riscv64-noop AM_HOME=$AM_HOME NEMU_HOME=$NEMU_HOME NOOP_HOME=$NOOP_HOME mainargs=test run
2> /dev/null
riscv-tests
:
runs-on
:
self-hosted
...
...
@@ -87,5 +87,5 @@ jobs:
echo $NEMU_HOME
echo $NOOP_HOME
echo $RVTEST_HOME
make -C $RVTEST_HOME/isa/ SUITES+=rv64ui SUITES+=rv64um SUITES+=rv64ua NEMU_HOME=$NEMU_HOME NOOP_HOME=$NOOP_HOME noop_run
make -C $RVTEST_HOME/isa/ SUITES+=rv64ui SUITES+=rv64um SUITES+=rv64ua NEMU_HOME=$NEMU_HOME NOOP_HOME=$NOOP_HOME noop_run
2> /dev/null
.gitmodules
浏览文件 @
945f1332
[submodule "rocket-chip"]
path = rocket-chip
url = https://github.com/chipsalliance/rocket-chip.git
branch =
2bdb03dbca3f77ad4c378cc1b95ab4961bc1448a
branch =
d6bd3c61993637c3f10544c59e861fae8af29f39
[submodule "block-inclusivecache-sifive"]
path = block-inclusivecache-sifive
url = https://github.com/RISCVERS/block-inclusivecache-sifive.git
branch = 5491dcc937ed3c6f7722bef9db448653daab75e8
[submodule "chiseltest"]
path = chiseltest
url = https://github.com/ucb-bar/chisel-testers2.git
branch = 3e3ecc5b25b7b6bc48341ec07c7a54b7ad53bcb7
Makefile
浏览文件 @
945f1332
...
...
@@ -133,7 +133,7 @@ clean:
init
:
git submodule update
--init
# do not use a recursive init to pull some not used submodules
@
# do not use a recursive init to pull some not used submodules
cd
./rocket-chip/
&&
git submodule update
--init
api-config-chipsalliance hardfloat
.PHONY
:
verilog emu clean help init $(REF_SO)
build.sc
浏览文件 @
945f1332
...
...
@@ -5,7 +5,7 @@ import scalalib._
import
coursier.maven.MavenRepository
object
CustomZincWorkerModule
extends
ZincWorkerModule
{
def
repositories
()
=
Seq
(
def
repositories
()
=
super
.
repositories
++
Seq
(
MavenRepository
(
"https://maven.aliyun.com/repository/public"
),
MavenRepository
(
"https://maven.aliyun.com/repository/apache-snapshots"
)
)
...
...
@@ -25,8 +25,8 @@ trait CommonModule extends ScalaModule {
override
def
scalacPluginIvyDeps
=
Agg
(
macroParadise
)
}
val
rocketC
hisel
=
Agg
(
ivy
"edu.berkeley.cs::chisel3:3.
3.1
"
val
c
hisel
=
Agg
(
ivy
"edu.berkeley.cs::chisel3:3.
4.0
"
)
object
`rocket-chip`
extends
SbtModule
with
CommonModule
{
...
...
@@ -34,7 +34,7 @@ object `rocket-chip` extends SbtModule with CommonModule {
override
def
ivyDeps
=
super
.
ivyDeps
()
++
Agg
(
ivy
"${scalaOrganization()}:scala-reflect:${scalaVersion()}"
,
ivy
"org.json4s::json4s-jackson:3.6.1"
)
++
rocketC
hisel
)
++
c
hisel
object
`api-config-chipsalliance`
extends
CommonModule
{
...
...
@@ -44,7 +44,7 @@ object `rocket-chip` extends SbtModule with CommonModule {
object
macros
extends
SbtModule
with
CommonModule
object
hardfloat
extends
SbtModule
with
CommonModule
{
override
def
ivyDeps
=
super
.
ivyDeps
()
++
rocketC
hisel
override
def
ivyDeps
=
super
.
ivyDeps
()
++
c
hisel
}
override
def
moduleDeps
=
super
.
moduleDeps
++
Seq
(
...
...
@@ -54,30 +54,42 @@ object `rocket-chip` extends SbtModule with CommonModule {
}
object
`block-inclusivecache-sifive`
extends
CommonModule
{
override
def
ivyDeps
=
super
.
ivyDeps
()
++
rocketC
hisel
override
def
ivyDeps
=
super
.
ivyDeps
()
++
c
hisel
override
def
millSourcePath
=
super
.
millSourcePath
/
'design / '
craft
/
'inclusivecache
override def moduleDeps = super.moduleDeps ++ Seq(`rocket-chip`)
}
object chiseltest extends CommonModule with SbtModule {
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"edu.berkeley.cs::treadle:1.3.0",
ivy"org.scalatest::scalatest:3.0.8",
ivy"com.lihaoyi::utest:0.7.4"
) ++ chisel
object test extends Tests {
def ivyDeps = Agg(ivy"org.scalacheck::scalacheck:1.14.3")
def testFrameworks = Seq("org.scalatest.tools.Framework")
}
}
object XiangShan extends CommonModule with SbtModule {
override def millSourcePath = millOuterCtx.millSourcePath
override def forkArgs = Seq("-Xmx10G")
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"edu.berkeley.cs::chisel3:3.3.2"
override def ivyDeps = super.ivyDeps() ++ chisel
override def moduleDeps = super.moduleDeps ++ Seq(
`rocket-chip`,
`block-inclusivecache-sifive`,
chiseltest
)
override def moduleDeps = super.moduleDeps ++ Seq(`rocket-chip`, `block-inclusivecache-sifive`)
object test extends Tests {
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.scalatest::scalatest:3.0.4",
ivy"edu.berkeley.cs::chisel-iotesters:1.2+",
ivy"edu.berkeley.cs::chiseltest:0.2.1"
)
def testFrameworks = Seq(
...
...
chiseltest
@
3e3ecc5b
Subproject commit 3e3ecc5b25b7b6bc48341ec07c7a54b7ad53bcb7
rocket-chip
@
d6bd3c61
比较
2bdb03db
...
d6bd3c61
Subproject commit
2bdb03dbca3f77ad4c378cc1b95ab4961bc1448a
Subproject commit
d6bd3c61993637c3f10544c59e861fae8af29f39
src/main/scala/xiangshan/frontend/PreDecode.scala
浏览文件 @
945f1332
...
...
@@ -14,7 +14,7 @@ trait HasPdconst{ this: XSModule =>
val
brType
::
Nil
=
ListLookup
(
instr
,
List
(
BrType
.
notBr
),
PreDecodeInst
.
brTable
)
val
rd
=
Mux
(
isRVC
(
instr
),
instr
(
12
),
instr
(
11
,
7
))
val
rs
=
Mux
(
isRVC
(
instr
),
Mux
(
brType
===
BrType
.
jal
,
0.
U
,
instr
(
11
,
7
)),
instr
(
19
,
15
))
val
isCall
=
(
brType
===
BrType
.
jal
||
brType
===
BrType
.
jalr
)
&&
isLink
(
rd
)
val
isCall
=
(
brType
===
BrType
.
jal
&&
!
isRVC
(
instr
)
||
brType
===
BrType
.
jalr
)
&&
isLink
(
rd
)
// Only for RV64
val
isRet
=
brType
===
BrType
.
jalr
&&
isLink
(
rs
)
&&
!
isCall
List
(
brType
,
isCall
,
isRet
)
}
...
...
src/main/scala/xiangshan/frontend/RAS.scala
浏览文件 @
945f1332
...
...
@@ -104,7 +104,7 @@ class RAS extends BasePredictor
//update commit ras
val
commit_push
=
!
commit_is_full
&&
io
.
recover
.
valid
&&
io
.
recover
.
bits
.
pd
.
isCall
val
commit_pop
=
!
commit_is_empty
&&
io
.
recover
.
valid
&&
io
.
recover
.
bits
.
pd
.
isRet
val
commit_new_addr
=
io
.
recover
.
bits
.
pc
+
4.
U
//TODO: consider RVC
val
commit_new_addr
=
Mux
(
io
.
recover
.
bits
.
pd
.
isRVC
,
io
.
recover
.
bits
.
pc
+
2.
U
,
io
.
recover
.
bits
.
pc
+
4.
U
)
val
commit_ras_write
=
WireInit
(
0.
U
.
asTypeOf
(
rasEntry
()))
val
commit_alloc_new
=
commit_new_addr
=/=
commit_ras_top_addr
when
(
commit_push
)
{
...
...
@@ -200,4 +200,4 @@ class RAS extends BasePredictor
// }
// }
}
\ No newline at end of file
}
src/main/scala/xiangshan/mem/lsqueue/separated/LoadQueue.scala
浏览文件 @
945f1332
...
...
@@ -300,6 +300,14 @@ class LoadQueue extends XSModule with HasDCacheParameters with HasCircularQueueP
}
})
// move tailPtr
// allocatedMask: dequeuePtr can go to the next 1-bit
val
allocatedMask
=
VecInit
((
0
until
LoadQueueSize
).
map
(
i
=>
allocated
(
i
)
||
!
enqDeqMask
(
i
)))
// find the first one from deqPtr (ringBufferTail)
val
nextTail1
=
getFirstOneWithFlag
(
allocatedMask
,
tailMask
,
ringBufferTailExtended
.
flag
)
val
nextTail
=
Mux
(
Cat
(
allocatedMask
).
orR
,
nextTail1
,
ringBufferHeadExtended
)
ringBufferTailExtended
:=
nextTail
// When load commited, mark it as !allocated, this entry will be recycled later
(
0
until
CommitWidth
).
map
(
i
=>
{
when
(
loadCommit
(
i
))
{
...
...
@@ -307,8 +315,6 @@ class LoadQueue extends XSModule with HasDCacheParameters with HasCircularQueueP
XSDebug
(
"load commit %d: idx %d %x\n"
,
i
.
U
,
mcommitIdx
(
i
),
uop
(
mcommitIdx
(
i
)).
cf
.
pc
)
}
})
// move tailPtr
ringBufferTailExtended
:=
ringBufferTailExtended
+
PopCount
(
loadCommit
)
// rollback check
val
rollback
=
Wire
(
Vec
(
StorePipelineWidth
,
Valid
(
new
Redirect
)))
...
...
src/main/scala/xiangshan/mem/lsqueue/separated/StoreQueue.scala
浏览文件 @
945f1332
...
...
@@ -180,6 +180,15 @@ class StoreQueue extends XSModule with HasDCacheParameters with HasCircularQueue
}
})
// remove retired insts from sq, add retired store to sbuffer
// move tailPtr
// allocatedMask: dequeuePtr can go to the next 1-bit
val
allocatedMask
=
VecInit
((
0
until
StoreQueueSize
).
map
(
i
=>
allocated
(
i
)
||
!
enqDeqMask
(
i
)))
// find the first one from deqPtr (ringBufferTail)
val
nextTail1
=
getFirstOneWithFlag
(
allocatedMask
,
tailMask
,
ringBufferTailExtended
.
flag
)
val
nextTail
=
Mux
(
Cat
(
allocatedMask
).
orR
,
nextTail1
,
ringBufferHeadExtended
)
ringBufferTailExtended
:=
nextTail
// load forward query
// check over all lq entries and forward data from the first matched store
...
...
@@ -241,13 +250,13 @@ class StoreQueue extends XSModule with HasDCacheParameters with HasCircularQueue
}
})
// remove retired insts from sq, add retired store to sbuffer
val
storeCommitSelVec
=
VecInit
((
0
until
StoreQueueSize
).
map
(
i
=>
{
allocated
(
i
)
&&
commited
(
i
)
}))
val
(
storeCommitValid
,
storeCommitSel
)
=
selectFirstTwo
(
storeCommitSelVec
,
tailMask
)
// get no more than 2 commited store from storeCommitedQueue
// send selected store inst to sbuffer
val
dequeueValid
=
Wire
(
Vec
(
2
,
Bool
()))
(
0
until
2
).
map
(
i
=>
{
val
ptr
=
storeCommitSel
(
i
)
val
mmio
=
data
(
ptr
).
mmio
...
...
@@ -263,14 +272,11 @@ class StoreQueue extends XSModule with HasDCacheParameters with HasCircularQueue
io
.
sbuffer
(
i
).
bits
.
meta
.
mask
:=
data
(
ptr
).
mask
// update sq meta if store inst is send to sbuffer
dequeueValid
(
i
)
:=
storeCommitValid
(
i
)
&&
(
mmio
||
io
.
sbuffer
(
i
).
ready
)
when
(
dequeueValid
(
i
))
{
when
(
storeCommitValid
(
i
)
&&
(
mmio
||
io
.
sbuffer
(
i
).
ready
))
{
allocated
(
ptr
)
:=
false
.
B
}
})
// move tailPtr
ringBufferTailExtended
:=
ringBufferTailExtended
+
PopCount
(
dequeueValid
)
// Memory mapped IO / other uncached operations
// setup misc mem access req
...
...
src/main/scala/xstransforms/ShowPrintTransform.scala
浏览文件 @
945f1332
...
...
@@ -40,7 +40,7 @@ class ShowPrintTransform extends Transform with DependencyAPIMigration {
def
findSubModules
(
m
:
DefModule
)
:
Unit
=
{
def
viewStmt
(
s
:
Statement
)
:
Statement
=
s
match
{
case
DefInstance
(
_
,
name
,
module
)
=>
case
DefInstance
(
_
,
name
,
module
,
_
)
=>
ancestors
(
module
)
=
ancestors
(
m
.
name
)
+
m
.
name
queue
+=
module
s
...
...
src/test/csrc/emu.cpp
浏览文件 @
945f1332
...
...
@@ -81,6 +81,9 @@ Emulator::Emulator(int argc, const char *argv[]):
srand48
(
args
.
seed
);
Verilated
::
randReset
(
2
);
// init core
reset_ncycles
(
10
);
// init ram
extern
void
init_ram
(
const
char
*
img
);
init_ram
(
args
.
image
);
...
...
@@ -104,9 +107,6 @@ Emulator::Emulator(int argc, const char *argv[]):
enable_waveform
=
false
;
#endif
// init core
reset_ncycles
(
10
);
if
(
args
.
snapshot_path
!=
NULL
)
{
printf
(
"loading from snapshot `%s`...
\n
"
,
args
.
snapshot_path
);
snapshot_load
(
args
.
snapshot_path
);
...
...
src/test/csrc/ram.cpp
浏览文件 @
945f1332
...
...
@@ -115,16 +115,15 @@ void init_ram(const char *img) {
//new end
}
extern
"C"
void
ram_helper
(
uint64_t
rIdx
,
uint64_t
*
rdata
,
uint64_t
wIdx
,
uint64_t
wdata
,
uint64_t
wmask
,
uint8_t
wen
)
{
extern
"C"
uint64_t
ram_read_helper
(
uint64_t
rIdx
)
{
if
(
rIdx
>=
RAMSIZE
/
sizeof
(
uint64_t
))
{
printf
(
"ERROR: ram idx = 0x%x out of bound!
\n
"
,
rIdx
);
// TODO: don't allow out of bound when crossbar is ready
//assert(rIdx < RAMSIZE / sizeof(uint64_t));
*
rdata
=
0xabcd12345678dcbaUL
;
return
;
assert
(
rIdx
<
RAMSIZE
/
sizeof
(
uint64_t
));
}
*
rdata
=
ram
[
rIdx
];
return
ram
[
rIdx
];
}
extern
"C"
void
ram_write_helper
(
uint64_t
wIdx
,
uint64_t
wdata
,
uint64_t
wmask
,
uint8_t
wen
)
{
if
(
wen
)
{
assert
(
wIdx
<
RAMSIZE
/
sizeof
(
uint64_t
));
ram
[
wIdx
]
=
(
ram
[
wIdx
]
&
~
wmask
)
|
(
wdata
&
wmask
);
...
...
src/test/scala/cache/L2CacheTest.scala
浏览文件 @
945f1332
...
...
@@ -5,6 +5,7 @@ import chisel3._
import
chisel3.util._
import
chiseltest.experimental.TestOptionBuilder._
import
chiseltest.internal.VerilatorBackendAnnotation
import
chiseltest.internal.LineCoverageAnnotation
import
chiseltest._
import
chisel3.experimental.BundleLiterals._
import
firrtl.stage.RunFirrtlTransformAnnotation
...
...
@@ -257,6 +258,7 @@ class L2CacheTest extends FlatSpec with ChiselScalatestTester with Matchers{
val
annos
=
Seq
(
VerilatorBackendAnnotation
,
LineCoverageAnnotation
,
RunFirrtlTransformAnnotation
(
new
PrintModuleName
)
)
...
...
src/test/vsrc/ram.v
浏览文件 @
945f1332
import
"DPI-C"
function
void
ram_helper
import
"DPI-C"
function
void
ram_
write_
helper
(
input
longint
rIdx
,
output
longint
rdata
,
input
longint
wIdx
,
input
longint
wdata
,
input
longint
wmask
,
input
bit
wen
);
import
"DPI-C"
function
longint
ram_read_helper
(
input
longint
rIdx
);
module
RAMHelper
(
input
clk
,
input
[
63
:
0
]
rIdx
,
...
...
@@ -18,8 +21,10 @@ module RAMHelper(
input
wen
);
assign
rdata
=
ram_read_helper
(
rIdx
);
always
@
(
posedge
clk
)
begin
ram_
helper
(
rIdx
,
rdata
,
wIdx
,
wdata
,
wmask
,
wen
);
ram_
write_helper
(
wIdx
,
wdata
,
wmask
,
wen
);
end
endmodule
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录