1/*************************************************************************************** 2* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences 3* 4* XiangShan is licensed under Mulan PSL v2. 5* You can use this software according to the terms and conditions of the Mulan PSL v2. 6* You may obtain a copy of Mulan PSL v2 at: 7* http://license.coscl.org.cn/MulanPSL2 8* 9* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 10* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 11* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 12* 13* See the Mulan PSL v2 for more details. 14***************************************************************************************/ 15 16package utils 17 18import chisel3._ 19import chipsalliance.rocketchip.config.Parameters 20import chisel3.util.DecoupledIO 21import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp} 22import freechips.rocketchip.tilelink.{TLBundle, TLClientNode, TLIdentityNode, TLMasterParameters, TLMasterPortParameters} 23 24class DataDontCareNode(a: Boolean = false, b: Boolean = false, c: Boolean = false, d: Boolean = false)(implicit p: Parameters) extends LazyModule { 25 26 val node = TLIdentityNode() 27 28 val n = TLClientNode(Seq(TLMasterPortParameters.v1( 29 Seq( 30 TLMasterParameters.v1("DataDontCareNode") 31 ) 32 ))) 33 34 lazy val module = new LazyModuleImp(this) with HasTLDump{ 35 val (out, _) = node.out(0) 36 val (in, _) = node.in(0) 37 38 if (a) { 39 out.a.bits.data := DontCare 40 } 41 if (b) { 42 in.b.bits.data := DontCare 43 } 44 if (c) { 45 out.c.bits.data := DontCare 46 } 47 if (d) { 48 in.d.bits.data := DontCare 49 } 50 } 51} 52 53object DataDontCareNode { 54 def apply(a: Boolean = false, b: Boolean = false, c: Boolean = false, d: Boolean = false)(implicit p: Parameters): TLIdentityNode = { 55 val dataDontCareNode = LazyModule(new DataDontCareNode(a, b, c, d)) 56 dataDontCareNode.node 57 } 58} 59