-
Notifications
You must be signed in to change notification settings - Fork 257
Expand file tree
/
Copy pathNutShellSim.scala
More file actions
52 lines (43 loc) · 1.7 KB
/
NutShellSim.scala
File metadata and controls
52 lines (43 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**************************************************************************************
* Copyright (c) 2020 Institute of Computing Technology, CAS
* Copyright (c) 2020 University of Chinese Academy of Sciences
*
* NutShell is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR
* FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
***************************************************************************************/
package sim
import bus.axi4._
import chisel3._
import device.AXI4RAM
import difftest._
import nutcore.NutCoreConfig
import system._
class NutShellSim extends Module with HasDiffTestInterfaces {
lazy val config = NutCoreConfig(FPGAPlatform = false)
val soc = Module(new NutShell()(config))
val mem = Module(new AXI4RAM(memByte = 2L * 1024 * 1024 * 1024, useBlackBox = true))
// Be careful with the commit checking of emu.
// A large delay will make emu incorrectly report getting stuck.
val memdelay = Module(new AXI4Delayer(0))
val mmio = Module(new SimMMIO)
soc.io.frontend <> mmio.io.dma
memdelay.io.in <> soc.io.mem
mem.io.in <> memdelay.io.out
mmio.io.rw <> soc.io.mmio
soc.io.meip := mmio.io.meip
override def cpuName: Option[String] = Some("NutShell")
val uart = IO(new UARTIO)
uart <> mmio.io.uart
override def connectTopIOs(difftest: DifftestTopIO): Seq[Data] = {
difftest.uart <> uart
Seq.empty
}
}