Comments (3)
object XiangShan extends CommonModule with SbtModule {
override def millSourcePath = millOuterCtx.millSourcePathoverride def forkArgs = Seq("-Xmx10G")
override def ivyDeps = super.ivyDeps() ++ chisel
override def moduleDeps = super.moduleDeps ++ Seq(
rocket-chip
,
block-inclusivecache-sifive
,
chiseltest
)object test extends Tests {
override def forkArgs = Seq("-Xmx10G")
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.scalatest::scalatest:3.2.0"
)def testFrameworks = Seq( "org.scalatest.tools.Framework" ) def testOnly(args: String*) = T.command { super.runMain("org.scalatest.tools.Runner", args: _*) }
}
}
在 build.sc 里面xiangshan 依赖 是上面这么写,然后makefile里面 调用的是 XiangShan.test.runMain, 这个 是个 Xiangshan 类的类成员 test的 函数,然而 依赖放在 xiangshan这个类里面的, 我想请教一下 类的 类成员是如何从类得到依赖的, 还是 利用了scala 有什么特殊特性
build.sc并不是scala源文件,而是mill build配置文件,因此要按照 mill 而不是scala的规则去使用,我们对test部分的编写参考自mill官方文档 Addding a Test Suite 部分,mill相关问题请查阅mill文档。
from xiangshan.
TL;DR
我想请教一下 类的 类成员是如何从类得到依赖的, 还是 利用了scala 有什么特殊特性
I believe this piece code can solve your question:
https://github.com/com-lihaoyi/mill/blob/655ccdc04a10a120deb50fe1b643ecbec8a661bb/scalalib/src/ScalaModule.scala#L19-L25
This is a question related to build system:
Xiangshan use 2 build systems:
- GNU Make
- mill
There are 2 important part of a build system:
- Frontend:
Actually build system is a DAG to describe a series of atomic tasks which consumes some inputs and generate a reproducible outputs.
Frontend defines its language describe this DAG and each task.
For more informations, GNU Make, mill - Backend:
Backend will execute those atomic actions, it will detect input changes, if some inputs are modified, task should be evaluated. if not changed, it will use caches last time, all mill build cache lays in./out
folder.
So let's go back to your question:
在 build.sc 里面xiangshan 依赖 是上面这么写,然后makefile里面 调用的是 XiangShan.test.runMain, 这个 是个 Xiangshan 类的类成员 test的 函数,然而 依赖放在 xiangshan这个类里面的, 我想请教一下 类的 类成员是如何从类得到依赖的, 还是 利用了scala 有什么特殊特性
Xiangshan has 2 types of dependences: maven(ivy) and source dependence:
override def moduleDeps = super.moduleDeps ++ Seq(
rocket-chip,
block-inclusivecache-sifive,
chiseltest
)
These are source dependence. Generally using this methodology is because Xiangshan did some changes to those library or those library didn't publish itself to maven.
Xiangshan depend on chisel3 in ivy:
override def ivyDeps = super.ivyDeps() ++ chisel
which means during the runtime, chisel will be downloaded from correspond maven repositories.
In mill, ivy will be cached by coursier, those package caches will be stored in ~/.cache/coursier
, since it can be share among projects.
from xiangshan.
trait ScalaModule extends JavaModule { outer =>
trait Tests extends super.Tests with ScalaModule {
override def scalaOrganization = outer.scalaOrganization()
def scalaVersion = outer.scalaVersion()
override def scalacPluginIvyDeps = outer.scalacPluginIvyDeps
override def scalacPluginClasspath = outer.scalacPluginClasspath
override def scalacOptions = outer.scalacOptions
}}
这段代码感觉能够解释我的疑问了, scala 这个语言特性 能够直接定义 类.成员成员类 组合特质。 和一般语言差别太大了,多谢解答
from xiangshan.
Related Issues (20)
- Can not generate RTL when NUM_CORES >= 3
- 使用命令时遇到错误“已放弃(核心已转储) ” HOT 1
- Eeception while compile using "make emu EMU_THREADS=8 MFC=1 CONFIG=KunminghuV2Config" HOT 1
- Compile Exception while using "make emu EMU_THREADS=8 MFC=1 CONFIG=KunminghuV2Config", HOT 5
- Difftest failed on a RISC-V Vector memcpy workload with misaligned(in vlen granularity, not element) unit stride load HOT 1
- Assertion failed at UserYanker.scala:63 assert (!out.r.valid || r_valid) // Q must be ready faster than the response HOT 1
- make verilog NUM_CORES=4 gets error HOT 7
- In VCS simulation, multi-core simulation of some harts ended prematurely due to incorrect execution of SEQZ instruction HOT 1
- ./build/emu HOT 10
- xsdebug HOT 9
- invalid opcode HOT 4
- error massage HOT 3
- What is the stable version of Nanhu-V2 verified on FPGA? HOT 9
- DispatchQueue numDeq and deqNext generation HOT 2
- Using docker to check data.txt generated by compiling app, but cannot find compiled instruction after burning HOT 4
- rvv-bench: XiangShan performance problems HOT 1
- How to enable the DebugModule of StandAloneDebugModule with the AXI version HOT 1
- How to use other versions of Linux kernel for Xiangshan projects? HOT 4
- How can I check the CPU frequency of the two cores of Xiangshan? HOT 5
- Run spec2006 using opensbi-kernel-for-xs tutorial HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xiangshan.