1/*************************************************************************************** 2* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences 3* Copyright (c) 2020-2021 Peng Cheng Laboratory 4* 5* XiangShan is licensed under Mulan PSL v2. 6* You can use this software according to the terms and conditions of the Mulan PSL v2. 7* You may obtain a copy of Mulan PSL v2 at: 8* http://license.coscl.org.cn/MulanPSL2 9* 10* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13* 14* See the Mulan PSL v2 for more details. 15***************************************************************************************/ 16 17package device.standalone 18 19import chisel3._ 20import freechips.rocketchip.diplomacy._ 21import org.chipsalliance.cde.config.Parameters 22import freechips.rocketchip.devices.tilelink._ 23import freechips.rocketchip.interrupts._ 24import utility.IntBuffer 25 26class StandAlonePLIC ( 27 useTL: Boolean = false, 28 baseAddress: BigInt, 29 addrWidth: Int, 30 dataWidth: Int = 64, 31 hartNum: Int 32)(implicit p: Parameters) extends StandAloneDevice( 33 useTL, baseAddress, addrWidth, dataWidth, hartNum 34) with BindingScope { 35 36 private def plicParam = PLICParams(baseAddress) 37 def addressSet: AddressSet = plicParam.address 38 39 private val plic = LazyModule(new TLPLIC(plicParam, dataWidth / 8)) 40 plic.node := xbar 41 42 // interrupts 43 val plicIntNode = IntSinkNode(IntSinkPortSimple(hartNum * 2, 1)) 44 plicIntNode :*= IntBuffer() :*= plic.intnode 45 val int = InModuleBody(plicIntNode.makeIOs()) 46 47} 48