xref: /XiangShan/src/main/scala/xiangshan/transforms/PrintControl.scala (revision 039cdc35f5f3b68b6295ec5ace90f22a77322e02)
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 xiangshan.transforms
18
19import firrtl.annotations.NoTargetAnnotation
20import firrtl.options.{HasShellOptions, ShellOption}
21
22case class DisablePrintfAnnotation(m: String) extends NoTargetAnnotation
23object DisablePrintfAnnotation extends HasShellOptions{
24
25  val options = Seq(
26    new ShellOption[String](
27      longOption = "disable-module-print",
28      toAnnotationSeq = s => Seq(DisablePrintfAnnotation(s)),
29      helpText =
30        "The verilog 'printf' in the <module> and it's submodules will be removed\n",
31      shortOption = Some("dm"),
32      helpValueName = Some("<module>")
33    )
34  )
35
36}
37
38case class EnablePrintfAnnotation(m: String) extends NoTargetAnnotation
39object EnablePrintfAnnotation extends HasShellOptions {
40  val options = Seq(
41    new ShellOption[String](
42      longOption = "enable-module-print",
43      toAnnotationSeq = s => Seq(EnablePrintfAnnotation(s)),
44      helpText =
45        "The verilog 'printf' except the <module> and it's submodules will be removed\n",
46      shortOption = Some("em"),
47      helpValueName = Some("<module>")
48    )
49  )
50
51}
52
53case class DisableAllPrintAnnotation() extends NoTargetAnnotation
54object DisableAllPrintAnnotation extends HasShellOptions {
55  val options = Seq(
56    new ShellOption[Unit](
57      longOption = "disable-all",
58      toAnnotationSeq = _ => Seq(DisableAllPrintAnnotation()),
59      helpText =
60        "All the verilog 'printf' will be removed\n",
61      shortOption = Some("dall")
62    )
63  )
64}
65
66case class RemoveAssertAnnotation() extends NoTargetAnnotation
67object RemoveAssertAnnotation extends HasShellOptions{
68  val options = Seq(
69    new ShellOption[Unit](
70      longOption = "remove-assert",
71      toAnnotationSeq = _ => Seq(RemoveAssertAnnotation()),
72      helpText = "All the 'assert' will be removed\n",
73      shortOption = None
74    )
75  )
76}
77