xref: /XiangShan/src/main/scala/utils/DataDontCareNode.scala (revision c6d439803a044ea209139672b25e35fe8d7f4aa0)
1*c6d43980SLemover/***************************************************************************************
2*c6d43980SLemover* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
3*c6d43980SLemover*
4*c6d43980SLemover* XiangShan is licensed under Mulan PSL v2.
5*c6d43980SLemover* You can use this software according to the terms and conditions of the Mulan PSL v2.
6*c6d43980SLemover* You may obtain a copy of Mulan PSL v2 at:
7*c6d43980SLemover*          http://license.coscl.org.cn/MulanPSL2
8*c6d43980SLemover*
9*c6d43980SLemover* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
10*c6d43980SLemover* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
11*c6d43980SLemover* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
12*c6d43980SLemover*
13*c6d43980SLemover* See the Mulan PSL v2 for more details.
14*c6d43980SLemover***************************************************************************************/
15*c6d43980SLemover
16279a83c2SAllenpackage utils
17279a83c2SAllen
18279a83c2SAllenimport chisel3._
19279a83c2SAllenimport chipsalliance.rocketchip.config.Parameters
20279a83c2SAllenimport chisel3.util.DecoupledIO
21279a83c2SAllenimport freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp}
22279a83c2SAllenimport freechips.rocketchip.tilelink.{TLBundle, TLClientNode, TLIdentityNode, TLMasterParameters, TLMasterPortParameters}
23279a83c2SAllen
24279a83c2SAllenclass DataDontCareNode(a: Boolean = false, b: Boolean = false, c: Boolean = false, d: Boolean = false)(implicit p: Parameters) extends LazyModule  {
25279a83c2SAllen
26279a83c2SAllen  val node = TLIdentityNode()
27279a83c2SAllen
28279a83c2SAllen  val n = TLClientNode(Seq(TLMasterPortParameters.v1(
29279a83c2SAllen    Seq(
30279a83c2SAllen      TLMasterParameters.v1("DataDontCareNode")
31279a83c2SAllen    )
32279a83c2SAllen  )))
33279a83c2SAllen
345c5bd416Sljw  lazy val module = new LazyModuleImp(this) with HasTLDump{
35279a83c2SAllen    val (out, _) = node.out(0)
36279a83c2SAllen    val (in, _) = node.in(0)
37279a83c2SAllen
38279a83c2SAllen    if (a) {
39279a83c2SAllen      out.a.bits.data := DontCare
40279a83c2SAllen    }
41279a83c2SAllen    if (b) {
42279a83c2SAllen      in.b.bits.data := DontCare
43279a83c2SAllen    }
44279a83c2SAllen    if (c) {
45279a83c2SAllen      out.c.bits.data := DontCare
46279a83c2SAllen    }
47279a83c2SAllen    if (d) {
48279a83c2SAllen      in.d.bits.data := DontCare
49279a83c2SAllen    }
50279a83c2SAllen  }
51279a83c2SAllen}
52279a83c2SAllen
53279a83c2SAllenobject DataDontCareNode {
54279a83c2SAllen  def apply(a: Boolean = false, b: Boolean = false, c: Boolean = false, d: Boolean = false)(implicit p: Parameters): TLIdentityNode = {
55279a83c2SAllen    val dataDontCareNode = LazyModule(new DataDontCareNode(a, b, c, d))
56279a83c2SAllen    dataDontCareNode.node
57279a83c2SAllen  }
58279a83c2SAllen}
59