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 utility._ 27import utility.sram.{SramMbistBundle, SramBroadcastBundle} 28import huancun.{HCCacheParameters, HCCacheParamsKey, HuanCun, PrefetchRecv, TPmetaResp} 29import coupledL2.EnableCHI 30import coupledL2.tl2chi.CHILogger 31import openLLC.{OpenLLC, OpenLLCParamKey, OpenNCB} 32import openLLC.TargetBinder._ 33import cc.xiangshan.openncb._ 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(new MsiInfoBundle))) 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.sramTest.mbist.foreach(dontTouch(_) := 0.U.asTypeOf(new SramMbistBundle)) 336 core.module.io.sramTest.mbistReset.foreach(dontTouch(_) := 0.U.asTypeOf(new DFTResetSignals)) 337 core.module.io.sramTest.sramCtl.foreach(dontTouch(_) := 0.U) 338 core.module.io.reset_vector := io.riscv_rst_vec(i) 339 } 340 341 withClockAndReset(io.clock, io.reset) { 342 Option.when(enableCHI)(true.B).foreach { _ => 343 for ((core, i) <- core_with_l2.zipWithIndex) { 344 val mmioLogger = CHILogger(s"L2[${i}]_MMIO", true) 345 val llcLogger = CHILogger(s"L2[${i}]_LLC", true) 346 dontTouch(core.module.io.chi.get) 347 bind( 348 route( 349 core.module.io.chi.get, Map((AddressSet(0x0L, 0x00007fffffffL), NumCores + i)) ++ AddressSet(0x0L, 350 0xffffffffffffL).subtract(AddressSet(0x0L, 0x00007fffffffL)).map(addr => (addr, NumCores * 2)).toMap 351 ), 352 Map((NumCores + i) -> mmioLogger.io.up, (NumCores * 2) -> llcLogger.io.up) 353 ) 354 chi_mmioBridge_opt(i).get.module.io.chi.connect(mmioLogger.io.down) 355 chi_openllc_opt.get.io.rn(i) <> llcLogger.io.down 356 require(core.module.io.chi.get.getWidth == llcLogger.io.up.getWidth) 357 require(llcLogger.io.down.getWidth == chi_openllc_opt.get.io.rn(i).getWidth) 358 } 359 val memLogger = CHILogger(s"LLC_MEM", true) 360 chi_openllc_opt.get.io.sn.connect(memLogger.io.up) 361 chi_llcBridge_opt.get.module.io.chi.connect(memLogger.io.down) 362 chi_openllc_opt.get.io.nodeID := (NumCores * 2).U 363 chi_openllc_opt.foreach { l3 => 364 l3.io.debugTopDown.robHeadPaddr := core_with_l2.map(_.module.io.debugTopDown.robHeadPaddr) 365 } 366 core_with_l2.zip(chi_openllc_opt.get.io.debugTopDown.addrMatch).foreach { case (tile, l3Match) => 367 tile.module.io.debugTopDown.l3MissMatch := l3Match 368 } 369 core_with_l2.map(_.module.io.l3Miss := (if (chi_openllc_opt.nonEmpty) chi_openllc_opt.get.io.l3Miss else false.B)) 370 } 371 } 372 373 if(l3cacheOpt.isEmpty || l3cacheOpt.get.rst_nodes.isEmpty){ 374 // tie off core soft reset 375 for(node <- core_rst_nodes){ 376 node.out.head._1 := false.B.asAsyncReset 377 } 378 } 379 380 l3cacheOpt match { 381 case Some(l3) => 382 l3.pf_recv_node match { 383 case Some(recv) => 384 l3_pf_sender_opt.get.out.head._1.addr_valid := VecInit(memblock_pf_recv_nodes.map(_.get.in.head._1.addr_valid)).asUInt.orR 385 for (i <- 0 until NumCores) { 386 when(memblock_pf_recv_nodes(i).get.in.head._1.addr_valid) { 387 l3_pf_sender_opt.get.out.head._1.addr := memblock_pf_recv_nodes(i).get.in.head._1.addr 388 l3_pf_sender_opt.get.out.head._1.l2_pf_en := memblock_pf_recv_nodes(i).get.in.head._1.l2_pf_en 389 } 390 } 391 case None => 392 } 393 l3.module.io.debugTopDown.robHeadPaddr := core_with_l2.map(_.module.io.debugTopDown.robHeadPaddr) 394 core_with_l2.zip(l3.module.io.debugTopDown.addrMatch).foreach { case (tile, l3Match) => tile.module.io.debugTopDown.l3MissMatch := l3Match } 395 core_with_l2.foreach(_.module.io.l3Miss := l3.module.io.l3Miss) 396 case None => 397 } 398 399 (chi_openllc_opt, l3cacheOpt) match { 400 case (None, None) => 401 core_with_l2.foreach(_.module.io.debugTopDown.l3MissMatch := false.B) 402 core_with_l2.foreach(_.module.io.l3Miss := false.B) 403 case _ => 404 } 405 406 core_with_l2.zipWithIndex.foreach { case (tile, i) => 407 tile.module.io.nodeID.foreach { case nodeID => 408 nodeID := i.U 409 dontTouch(nodeID) 410 } 411 } 412 413 misc.module.debug_module_io.resetCtrl.hartIsInReset := core_with_l2.map(_.module.io.hartIsInReset) 414 misc.module.debug_module_io.clock := io.clock 415 misc.module.debug_module_io.reset := reset_sync 416 417 misc.module.debug_module_io.debugIO.reset := misc.module.reset 418 misc.module.debug_module_io.debugIO.clock := io.clock 419 // TODO: delay 3 cycles? 420 misc.module.debug_module_io.debugIO.dmactiveAck := misc.module.debug_module_io.debugIO.dmactive 421 // jtag connector 422 misc.module.debug_module_io.debugIO.systemjtag.foreach { x => 423 x.jtag <> io.systemjtag.jtag 424 x.reset := jtag_reset_sync 425 x.mfr_id := io.systemjtag.mfr_id 426 x.part_number := io.systemjtag.part_number 427 x.version := io.systemjtag.version 428 } 429 430 withClockAndReset(io.clock, reset_sync) { 431 // Modules are reset one by one 432 // reset ----> SYNC --> {SoCMisc, L3 Cache, Cores} 433 val resetChain = Seq(Seq(misc.module) ++ l3cacheOpt.map(_.module)) 434 ResetGen(resetChain, reset_sync, !debugOpts.ResetGen) 435 // Ensure that cores could be reset when DM disable `hartReset` or l3cacheOpt.isEmpty. 436 val dmResetReqVec = misc.module.debug_module_io.resetCtrl.hartResetReq.getOrElse(0.U.asTypeOf(Vec(core_with_l2.map(_.module).length, Bool()))) 437 val syncResetCores = if(l3cacheOpt.nonEmpty) l3cacheOpt.map(_.module).get.reset.asBool else misc.module.reset.asBool 438 (core_with_l2.map(_.module)).zip(dmResetReqVec).map { case(core, dmResetReq) => 439 ResetGen(Seq(Seq(core)), (syncResetCores || dmResetReq).asAsyncReset, !debugOpts.ResetGen) 440 } 441 } 442 443 } 444 445 lazy val module = new XSTopImp(this) 446} 447 448class XSTileDiffTop(implicit p: Parameters) extends Module { 449 override val desiredName: String = "XSDiffTop" 450 val l_soc = LazyModule(new XSTop()) 451 val soc = Module(l_soc.module) 452 453 // Expose XSTop IOs outside, i.e. io 454 def exposeIO(data: Data, name: String): Unit = { 455 val dummy = IO(chiselTypeOf(data)).suggestName(name) 456 dummy <> data 457 } 458 def exposeOptionIO(data: Option[Data], name: String): Unit = { 459 if (data.isDefined) { 460 val dummy = IO(chiselTypeOf(data.get)).suggestName(name) 461 dummy <> data.get 462 } 463 } 464 exposeIO(l_soc.nmi,"nmi") 465 exposeIO(soc.memory, "memory") 466 exposeIO(soc.peripheral,"peripheral") 467 exposeIO(soc.io,"io") 468 exposeOptionIO(soc.dma, "dma") 469 470 DifftestWiring.createAndConnectExtraIOs() 471 Profile.generateJson("XiangShan") 472} 473 474object TopMain extends App { 475 val (config, firrtlOpts, firtoolOpts) = ArgParser.parse(args) 476 477 // tools: init to close dpi-c when in fpga 478 val envInFPGA = config(DebugOptionsKey).FPGAPlatform 479 val enableDifftest = config(DebugOptionsKey).EnableDifftest || config(DebugOptionsKey).AlwaysBasicDiff 480 val enableChiselDB = config(DebugOptionsKey).EnableChiselDB 481 val enableConstantin = config(DebugOptionsKey).EnableConstantin 482 Constantin.init(enableConstantin && !envInFPGA) 483 ChiselDB.init(enableChiselDB && !envInFPGA) 484 485 if (config(SoCParamsKey).UseXSNoCDiffTop) { 486 Generator.execute(firrtlOpts, DisableMonitors(p => new XSNoCDiffTop()(p))(config), firtoolOpts) 487 } else if (config(SoCParamsKey).UseXSTileDiffTop) { 488 Generator.execute(firrtlOpts, DisableMonitors(p => new XSTileDiffTop()(p))(config), firtoolOpts) 489 } else { 490 val soc = if (config(SoCParamsKey).UseXSNoCTop) 491 DisableMonitors(p => LazyModule(new XSNoCTop()(p)))(config) 492 else 493 DisableMonitors(p => LazyModule(new XSTop()(p)))(config) 494 495 Generator.execute(firrtlOpts, soc.module, firtoolOpts) 496 497 // generate difftest bundles (w/o DifftestTopIO) 498 if (enableDifftest) { 499 DifftestModule.finish("XiangShan", false) 500 } 501 } 502 503 FileRegisters.write(fileDir = "./build", filePrefix = "XSTop.") 504} 505