1/*************************************************************************************** 2* Copyright (c) 2024 Beijing Institute of Open Source Chip (BOSC) 3* Copyright (c) 2020-2024 Institute of Computing Technology, Chinese Academy of Sciences 4* Copyright (c) 2020-2021 Peng Cheng Laboratory 5* 6* XiangShan is licensed under Mulan PSL v2. 7* You can use this software according to the terms and conditions of the Mulan PSL v2. 8* You may obtain a copy of Mulan PSL v2 at: 9* http://license.coscl.org.cn/MulanPSL2 10* 11* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 12* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 13* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 14* 15* See the Mulan PSL v2 for more details. 16***************************************************************************************/ 17 18package top 19 20import chisel3._ 21import chisel3.util._ 22import chisel3.experimental.dataview._ 23import difftest.DifftestModule 24import xiangshan._ 25import utils._ 26import huancun.{HCCacheParameters, HCCacheParamsKey, HuanCun, PrefetchRecv, TPmetaResp} 27import coupledL2.EnableCHI 28import coupledL2.tl2chi.CHILogger 29import openLLC.{OpenLLC, OpenLLCParamKey, OpenNCB} 30import openLLC.TargetBinder._ 31import cc.xiangshan.openncb._ 32import utility._ 33import utility.sram.SramBroadcastBundle 34import system._ 35import device._ 36import chisel3.stage.ChiselGeneratorAnnotation 37import org.chipsalliance.cde.config._ 38import freechips.rocketchip.diplomacy._ 39import freechips.rocketchip.tile._ 40import freechips.rocketchip.tilelink._ 41import freechips.rocketchip.interrupts._ 42import freechips.rocketchip.amba.axi4._ 43import freechips.rocketchip.jtag.JTAGIO 44import chisel3.experimental.{annotate, ChiselAnnotation} 45import sifive.enterprise.firrtl.NestedPrefixModulesAnnotation 46import scala.collection.mutable.{Map} 47 48import difftest.common.DifftestWiring 49import difftest.util.Profile 50 51abstract class BaseXSSoc()(implicit p: Parameters) extends LazyModule 52 with BindingScope 53{ 54 // val misc = LazyModule(new SoCMisc()) 55 lazy val dts = DTS(bindingTree) 56 lazy val json = JSON(bindingTree) 57} 58 59class XSTop()(implicit p: Parameters) extends BaseXSSoc() with HasSoCParameter 60{ 61 val nocMisc = if (enableCHI) Some(LazyModule(new MemMisc())) else None 62 val socMisc = if (!enableCHI) Some(LazyModule(new SoCMisc())) else None 63 val misc: MemMisc = if (enableCHI) nocMisc.get else socMisc.get 64 65 ResourceBinding { 66 val width = ResourceInt(2) 67 val model = "xiangshan," + os.read(os.resource / "publishVersion") 68 val compatible = "freechips,rocketchip-unknown" 69 Resource(ResourceAnchors.root, "model").bind(ResourceString(model)) 70 Resource(ResourceAnchors.root, "compat").bind(ResourceString(compatible + "-dev")) 71 Resource(ResourceAnchors.soc, "compat").bind(ResourceString(compatible + "-soc")) 72 Resource(ResourceAnchors.root, "width").bind(width) 73 Resource(ResourceAnchors.soc, "width").bind(width) 74 Resource(ResourceAnchors.cpus, "width").bind(ResourceInt(1)) 75 def bindManagers(xbar: TLNexusNode) = { 76 ManagerUnification(xbar.edges.in.head.manager.managers).foreach{ manager => 77 manager.resources.foreach(r => r.bind(manager.toResource)) 78 } 79 } 80 if (!enableCHI) { 81 bindManagers(misc.l3_xbar.get.asInstanceOf[TLNexusNode]) 82 bindManagers(misc.peripheralXbar.get.asInstanceOf[TLNexusNode]) 83 } 84 } 85 86 println(s"FPGASoC cores: $NumCores banks: $L3NBanks block size: $L3BlockSize bus size: $L3OuterBusWidth") 87 88 val core_with_l2 = tiles.map(coreParams => 89 LazyModule(new XSTile()(p.alter((site, here, up) => { 90 case XSCoreParamsKey => coreParams 91 case PerfCounterOptionsKey => up(PerfCounterOptionsKey).copy(perfDBHartID = coreParams.HartId) 92 }))) 93 ) 94 95 val l3cacheOpt = soc.L3CacheParamsOpt.map(l3param => 96 LazyModule(new HuanCun()(new Config((_, _, _) => { 97 case HCCacheParamsKey => l3param.copy( 98 hartIds = tiles.map(_.HartId), 99 FPGAPlatform = debugOpts.FPGAPlatform 100 ) 101 case MaxHartIdBits => p(MaxHartIdBits) 102 case LogUtilsOptionsKey => p(LogUtilsOptionsKey) 103 case PerfCounterOptionsKey => p(PerfCounterOptionsKey) 104 }))) 105 ) 106 107 val chi_llcBridge_opt = Option.when(enableCHI)( 108 LazyModule(new OpenNCB()(p.alter((site, here, up) => { 109 case NCBParametersKey => new NCBParameters( 110 outstandingDepth = 64, 111 axiMasterOrder = EnumAXIMasterOrder.WriteAddress, 112 readCompDMT = false, 113 writeCancelable = false, 114 writeNoError = true, 115 axiBurstAlwaysIncr = true, 116 chiDataCheck = EnumCHIDataCheck.OddParity 117 ) 118 }))) 119 ) 120 121 val chi_mmioBridge_opt = Seq.fill(NumCores)(Option.when(enableCHI)( 122 LazyModule(new OpenNCB()(p.alter((site, here, up) => { 123 case NCBParametersKey => new NCBParameters( 124 outstandingDepth = 32, 125 axiMasterOrder = EnumAXIMasterOrder.None, 126 readCompDMT = false, 127 writeCancelable = false, 128 writeNoError = true, 129 asEndpoint = false, 130 acceptOrderEndpoint = true, 131 acceptMemAttrDevice = true, 132 readReceiptAfterAcception = true, 133 axiBurstAlwaysIncr = true, 134 chiDataCheck = EnumCHIDataCheck.OddParity 135 ) 136 }))) 137 )) 138 139 // receive all prefetch req from cores 140 val memblock_pf_recv_nodes: Seq[Option[BundleBridgeSink[PrefetchRecv]]] = core_with_l2.map(_.core_l3_pf_port).map{ 141 x => x.map(_ => BundleBridgeSink(Some(() => new PrefetchRecv))) 142 } 143 144 val l3_pf_sender_opt = soc.L3CacheParamsOpt.getOrElse(HCCacheParameters()).prefetch match { 145 case Some(pf) => Some(BundleBridgeSource(() => new PrefetchRecv)) 146 case None => None 147 } 148 val nmiIntNode = IntSourceNode(IntSourcePortSimple(1, NumCores, (new NonmaskableInterruptIO).elements.size)) 149 val nmi = InModuleBody(nmiIntNode.makeIOs()) 150 151 for (i <- 0 until NumCores) { 152 core_with_l2(i).clint_int_node := misc.clint.intnode 153 core_with_l2(i).plic_int_node :*= misc.plic.intnode 154 core_with_l2(i).debug_int_node := misc.debugModule.debug.dmOuter.dmOuter.intnode 155 core_with_l2(i).nmi_int_node := nmiIntNode 156 misc.plic.intnode := IntBuffer() := core_with_l2(i).beu_int_source 157 if (!enableCHI) { 158 misc.peripheral_ports.get(i) := core_with_l2(i).tl_uncache 159 } 160 core_with_l2(i).memory_port.foreach(port => (misc.core_to_l3_ports.get)(i) :=* port) 161 memblock_pf_recv_nodes(i).map(recv => { 162 println(s"Connecting Core_${i}'s L1 pf source to L3!") 163 recv := core_with_l2(i).core_l3_pf_port.get 164 }) 165 misc.debugModuleXbarOpt.foreach(_ := core_with_l2(i).sep_dm_opt.get) 166 } 167 168 l3cacheOpt.map(_.ctlnode.map(_ := misc.peripheralXbar.get)) 169 l3cacheOpt.map(_.intnode.map(int => { 170 misc.plic.intnode := IntBuffer() := int 171 })) 172 173 val core_rst_nodes = if(l3cacheOpt.nonEmpty && l3cacheOpt.get.rst_nodes.nonEmpty){ 174 l3cacheOpt.get.rst_nodes.get 175 } else { 176 core_with_l2.map(_ => BundleBridgeSource(() => Reset())) 177 } 178 179 core_rst_nodes.zip(core_with_l2.map(_.core_reset_sink)).foreach({ 180 case (source, sink) => sink := source 181 }) 182 183 l3cacheOpt match { 184 case Some(l3) => 185 misc.l3_out :*= l3.node :*= misc.l3_banked_xbar.get 186 l3.pf_recv_node.map(recv => { 187 println("Connecting L1 prefetcher to L3!") 188 recv := l3_pf_sender_opt.get 189 }) 190 l3.tpmeta_recv_node.foreach(recv => { 191 for ((core, i) <- core_with_l2.zipWithIndex) { 192 println(s"Connecting core_$i\'s L2 TPmeta request to L3!") 193 recv := core.core_l3_tpmeta_source_port.get 194 } 195 }) 196 l3.tpmeta_send_node.foreach(send => { 197 val broadcast = LazyModule(new ValidIOBroadcast[TPmetaResp]()) 198 broadcast.node := send 199 for ((core, i) <- core_with_l2.zipWithIndex) { 200 println(s"Connecting core_$i\'s L2 TPmeta response to L3!") 201 core.core_l3_tpmeta_sink_port.get := broadcast.node 202 } 203 }) 204 case None => 205 } 206 207 chi_llcBridge_opt match { 208 case Some(ncb) => 209 misc.soc_xbar.get := ncb.axi4node 210 case None => 211 } 212 213 chi_mmioBridge_opt.foreach { e => 214 e match { 215 case Some(ncb) => 216 misc.soc_xbar.get := ncb.axi4node 217 case None => 218 } 219 } 220 221 class XSTopImp(wrapper: LazyModule) extends LazyRawModuleImp(wrapper) { 222 soc.XSTopPrefix.foreach { prefix => 223 val mod = this.toNamed 224 annotate(new ChiselAnnotation { 225 def toFirrtl = NestedPrefixModulesAnnotation(mod, prefix, true) 226 }) 227 } 228 229 FileRegisters.add("dts", dts) 230 FileRegisters.add("graphml", graphML) 231 FileRegisters.add("json", json) 232 FileRegisters.add("plusArgs", freechips.rocketchip.util.PlusArgArtefacts.serialize_cHeader()) 233 234 val dma = socMisc.map(m => IO(Flipped(new VerilogAXI4Record(m.dma.elts.head.params)))) 235 val peripheral = IO(new VerilogAXI4Record(misc.peripheral.elts.head.params)) 236 val memory = IO(new VerilogAXI4Record(misc.memory.elts.head.params)) 237 238 socMisc match { 239 case Some(m) => 240 m.dma.elements.head._2 <> dma.get.viewAs[AXI4Bundle] 241 dontTouch(dma.get) 242 case None => 243 } 244 245 memory.viewAs[AXI4Bundle] <> misc.memory.elements.head._2 246 peripheral.viewAs[AXI4Bundle] <> misc.peripheral.elements.head._2 247 248 val io = IO(new Bundle { 249 val clock = Input(Clock()) 250 val reset = Input(AsyncReset()) 251 val sram_config = Input(UInt(16.W)) 252 val extIntrs = Input(UInt(NrExtIntr.W)) 253 val pll0_lock = Input(Bool()) 254 val pll0_ctrl = Output(Vec(6, UInt(32.W))) 255 val systemjtag = new Bundle { 256 val jtag = Flipped(new JTAGIO(hasTRSTn = false)) 257 val reset = Input(AsyncReset()) // No reset allowed on top 258 val mfr_id = Input(UInt(11.W)) 259 val part_number = Input(UInt(16.W)) 260 val version = Input(UInt(4.W)) 261 } 262 val debug_reset = Output(Bool()) 263 val rtc_clock = Input(Bool()) 264 val cacheable_check = new TLPMAIO() 265 val riscv_halt = Output(Vec(NumCores, Bool())) 266 val riscv_critical_error = Output(Vec(NumCores, Bool())) 267 val riscv_rst_vec = Input(Vec(NumCores, UInt(soc.PAddrBits.W))) 268 val traceCoreInterface = Vec(NumCores, new Bundle { 269 val fromEncoder = Input(new Bundle { 270 val enable = Bool() 271 val stall = Bool() 272 }) 273 val toEncoder = Output(new Bundle { 274 val cause = UInt(TraceCauseWidth.W) 275 val tval = UInt(TraceTvalWidth.W) 276 val priv = UInt(TracePrivWidth.W) 277 val iaddr = UInt((TraceTraceGroupNum * TraceIaddrWidth).W) 278 val itype = UInt((TraceTraceGroupNum * TraceItypeWidth).W) 279 val iretire = UInt((TraceTraceGroupNum * TraceIretireWidthCompressed).W) 280 val ilastsize = UInt((TraceTraceGroupNum * TraceIlastsizeWidth).W) 281 }) 282 }) 283 }) 284 285 val reset_sync = withClockAndReset(io.clock, io.reset) { ResetGen() } 286 val jtag_reset_sync = withClockAndReset(io.systemjtag.jtag.TCK, io.systemjtag.reset) { ResetGen() } 287 val chi_openllc_opt = Option.when(enableCHI)( 288 withClockAndReset(io.clock, io.reset) { 289 Module(new OpenLLC()(p.alter((site, here, up) => { 290 case OpenLLCParamKey => soc.OpenLLCParamsOpt.get.copy( 291 hartIds = tiles.map(_.HartId), 292 FPGAPlatform = debugOpts.FPGAPlatform 293 ) 294 }))) 295 } 296 ) 297 298 // override LazyRawModuleImp's clock and reset 299 childClock := io.clock 300 childReset := reset_sync 301 302 // output 303 io.debug_reset := misc.module.debug_module_io.debugIO.ndreset 304 305 // input 306 dontTouch(io) 307 dontTouch(memory) 308 misc.module.ext_intrs := io.extIntrs 309 misc.module.rtc_clock := io.rtc_clock 310 misc.module.pll0_lock := io.pll0_lock 311 misc.module.cacheable_check <> io.cacheable_check 312 313 io.pll0_ctrl <> misc.module.pll0_ctrl 314 315 val msiInfo = WireInit(0.U.asTypeOf(ValidIO(UInt(soc.IMSICParams.MSI_INFO_WIDTH.W)))) 316 317 318 for ((core, i) <- core_with_l2.zipWithIndex) { 319 core.module.io.hartId := i.U 320 core.module.io.msiInfo := msiInfo 321 core.module.io.clintTime := misc.module.clintTime 322 io.riscv_halt(i) := core.module.io.cpu_halt 323 io.riscv_critical_error(i) := core.module.io.cpu_crtical_error 324 // trace Interface 325 val traceInterface = core.module.io.traceCoreInterface 326 traceInterface.fromEncoder := io.traceCoreInterface(i).fromEncoder 327 io.traceCoreInterface(i).toEncoder.priv := traceInterface.toEncoder.priv 328 io.traceCoreInterface(i).toEncoder.cause := traceInterface.toEncoder.trap.cause 329 io.traceCoreInterface(i).toEncoder.tval := traceInterface.toEncoder.trap.tval 330 io.traceCoreInterface(i).toEncoder.iaddr := VecInit(traceInterface.toEncoder.groups.map(_.bits.iaddr)).asUInt 331 io.traceCoreInterface(i).toEncoder.itype := VecInit(traceInterface.toEncoder.groups.map(_.bits.itype)).asUInt 332 io.traceCoreInterface(i).toEncoder.iretire := VecInit(traceInterface.toEncoder.groups.map(_.bits.iretire)).asUInt 333 io.traceCoreInterface(i).toEncoder.ilastsize := VecInit(traceInterface.toEncoder.groups.map(_.bits.ilastsize)).asUInt 334 335 core.module.io.dft.foreach(dontTouch(_) := 0.U.asTypeOf(new SramBroadcastBundle)) 336 core.module.io.dft_reset.foreach(dontTouch(_) := 0.U.asTypeOf(new DFTResetSignals)) 337 core.module.io.reset_vector := io.riscv_rst_vec(i) 338 } 339 340 withClockAndReset(io.clock, io.reset) { 341 Option.when(enableCHI)(true.B).foreach { _ => 342 for ((core, i) <- core_with_l2.zipWithIndex) { 343 val mmioLogger = CHILogger(s"L2[${i}]_MMIO", true) 344 val llcLogger = CHILogger(s"L2[${i}]_LLC", true) 345 dontTouch(core.module.io.chi.get) 346 bind( 347 route( 348 core.module.io.chi.get, Map((AddressSet(0x0L, 0x00007fffffffL), NumCores + i)) ++ AddressSet(0x0L, 349 0xffffffffffffL).subtract(AddressSet(0x0L, 0x00007fffffffL)).map(addr => (addr, NumCores * 2)).toMap 350 ), 351 Map((NumCores + i) -> mmioLogger.io.up, (NumCores * 2) -> llcLogger.io.up) 352 ) 353 chi_mmioBridge_opt(i).get.module.io.chi.connect(mmioLogger.io.down) 354 chi_openllc_opt.get.io.rn(i) <> llcLogger.io.down 355 require(core.module.io.chi.get.getWidth == llcLogger.io.up.getWidth) 356 require(llcLogger.io.down.getWidth == chi_openllc_opt.get.io.rn(i).getWidth) 357 } 358 val memLogger = CHILogger(s"LLC_MEM", true) 359 chi_openllc_opt.get.io.sn.connect(memLogger.io.up) 360 chi_llcBridge_opt.get.module.io.chi.connect(memLogger.io.down) 361 chi_openllc_opt.get.io.nodeID := (NumCores * 2).U 362 chi_openllc_opt.foreach { l3 => 363 l3.io.debugTopDown.robHeadPaddr := core_with_l2.map(_.module.io.debugTopDown.robHeadPaddr) 364 } 365 core_with_l2.zip(chi_openllc_opt.get.io.debugTopDown.addrMatch).foreach { case (tile, l3Match) => 366 tile.module.io.debugTopDown.l3MissMatch := l3Match 367 } 368 core_with_l2.zip(chi_openllc_opt).foreach { case (tile, l3) => 369 tile.module.io.l3Miss := l3.io.l3Miss 370 } 371 } 372 } 373 374 if(l3cacheOpt.isEmpty || l3cacheOpt.get.rst_nodes.isEmpty){ 375 // tie off core soft reset 376 for(node <- core_rst_nodes){ 377 node.out.head._1 := false.B.asAsyncReset 378 } 379 } 380 381 l3cacheOpt match { 382 case Some(l3) => 383 l3.pf_recv_node match { 384 case Some(recv) => 385 l3_pf_sender_opt.get.out.head._1.addr_valid := VecInit(memblock_pf_recv_nodes.map(_.get.in.head._1.addr_valid)).asUInt.orR 386 for (i <- 0 until NumCores) { 387 when(memblock_pf_recv_nodes(i).get.in.head._1.addr_valid) { 388 l3_pf_sender_opt.get.out.head._1.addr := memblock_pf_recv_nodes(i).get.in.head._1.addr 389 l3_pf_sender_opt.get.out.head._1.l2_pf_en := memblock_pf_recv_nodes(i).get.in.head._1.l2_pf_en 390 } 391 } 392 case None => 393 } 394 l3.module.io.debugTopDown.robHeadPaddr := core_with_l2.map(_.module.io.debugTopDown.robHeadPaddr) 395 core_with_l2.zip(l3.module.io.debugTopDown.addrMatch).foreach { case (tile, l3Match) => tile.module.io.debugTopDown.l3MissMatch := l3Match } 396 core_with_l2.foreach(_.module.io.l3Miss := l3.module.io.l3Miss) 397 case None => 398 } 399 400 (chi_openllc_opt, l3cacheOpt) match { 401 case (None, None) => 402 core_with_l2.foreach(_.module.io.debugTopDown.l3MissMatch := false.B) 403 core_with_l2.foreach(_.module.io.l3Miss := false.B) 404 case _ => 405 } 406 407 core_with_l2.zipWithIndex.foreach { case (tile, i) => 408 tile.module.io.nodeID.foreach { case nodeID => 409 nodeID := i.U 410 dontTouch(nodeID) 411 } 412 } 413 414 misc.module.debug_module_io.resetCtrl.hartIsInReset := core_with_l2.map(_.module.io.hartIsInReset) 415 misc.module.debug_module_io.clock := io.clock 416 misc.module.debug_module_io.reset := reset_sync 417 418 misc.module.debug_module_io.debugIO.reset := misc.module.reset 419 misc.module.debug_module_io.debugIO.clock := io.clock 420 // TODO: delay 3 cycles? 421 misc.module.debug_module_io.debugIO.dmactiveAck := misc.module.debug_module_io.debugIO.dmactive 422 // jtag connector 423 misc.module.debug_module_io.debugIO.systemjtag.foreach { x => 424 x.jtag <> io.systemjtag.jtag 425 x.reset := jtag_reset_sync 426 x.mfr_id := io.systemjtag.mfr_id 427 x.part_number := io.systemjtag.part_number 428 x.version := io.systemjtag.version 429 } 430 431 withClockAndReset(io.clock, reset_sync) { 432 // Modules are reset one by one 433 // reset ----> SYNC --> {SoCMisc, L3 Cache, Cores} 434 val resetChain = Seq(Seq(misc.module) ++ l3cacheOpt.map(_.module)) 435 ResetGen(resetChain, reset_sync, !debugOpts.ResetGen) 436 // Ensure that cores could be reset when DM disable `hartReset` or l3cacheOpt.isEmpty. 437 val dmResetReqVec = misc.module.debug_module_io.resetCtrl.hartResetReq.getOrElse(0.U.asTypeOf(Vec(core_with_l2.map(_.module).length, Bool()))) 438 val syncResetCores = if(l3cacheOpt.nonEmpty) l3cacheOpt.map(_.module).get.reset.asBool else misc.module.reset.asBool 439 (core_with_l2.map(_.module)).zip(dmResetReqVec).map { case(core, dmResetReq) => 440 ResetGen(Seq(Seq(core)), (syncResetCores || dmResetReq).asAsyncReset, !debugOpts.ResetGen) 441 } 442 } 443 444 } 445 446 lazy val module = new XSTopImp(this) 447} 448 449class XSTileDiffTop(implicit p: Parameters) extends Module { 450 override val desiredName: String = "XSDiffTop" 451 val l_soc = LazyModule(new XSTop()) 452 val soc = Module(l_soc.module) 453 454 // Expose XSTop IOs outside, i.e. io 455 def exposeIO(data: Data, name: String): Unit = { 456 val dummy = IO(chiselTypeOf(data)).suggestName(name) 457 dummy <> data 458 } 459 def exposeOptionIO(data: Option[Data], name: String): Unit = { 460 if (data.isDefined) { 461 val dummy = IO(chiselTypeOf(data.get)).suggestName(name) 462 dummy <> data.get 463 } 464 } 465 exposeIO(l_soc.nmi,"nmi") 466 exposeIO(soc.memory, "memory") 467 exposeIO(soc.peripheral,"peripheral") 468 exposeIO(soc.io,"io") 469 exposeOptionIO(soc.dma, "dma") 470 471 DifftestWiring.createAndConnectExtraIOs() 472 Profile.generateJson("XiangShan") 473} 474 475object TopMain extends App { 476 val (config, firrtlOpts, firtoolOpts) = ArgParser.parse(args) 477 478 // tools: init to close dpi-c when in fpga 479 val envInFPGA = config(DebugOptionsKey).FPGAPlatform 480 val enableDifftest = config(DebugOptionsKey).EnableDifftest || config(DebugOptionsKey).AlwaysBasicDiff 481 val enableChiselDB = config(DebugOptionsKey).EnableChiselDB 482 val enableConstantin = config(DebugOptionsKey).EnableConstantin 483 Constantin.init(enableConstantin && !envInFPGA) 484 ChiselDB.init(enableChiselDB && !envInFPGA) 485 486 if (config(SoCParamsKey).UseXSNoCDiffTop) { 487 Generator.execute(firrtlOpts, DisableMonitors(p => new XSNoCDiffTop()(p))(config), firtoolOpts) 488 } else if (config(SoCParamsKey).UseXSTileDiffTop) { 489 Generator.execute(firrtlOpts, DisableMonitors(p => new XSTileDiffTop()(p))(config), firtoolOpts) 490 } else { 491 val soc = if (config(SoCParamsKey).UseXSNoCTop) 492 DisableMonitors(p => LazyModule(new XSNoCTop()(p)))(config) 493 else 494 DisableMonitors(p => LazyModule(new XSTop()(p)))(config) 495 496 Generator.execute(firrtlOpts, soc.module, firtoolOpts) 497 498 // generate difftest bundles (w/o DifftestTopIO) 499 if (enableDifftest) { 500 DifftestModule.finish("XiangShan", false) 501 } 502 } 503 504 FileRegisters.write(fileDir = "./build", filePrefix = "XSTop.") 505} 506