简体   繁体   English

在chisel中,如何判断一个模块的Bundle是否实际生成为verilog

[英]In chisel, how to judge whether the Bundle of a module is actually generated as a verilog

In chisel, If I define the bundle of a module like this.在凿子中,如果我像这样定义模块的包。

class tmp extends Module{
  val io  = IO(new Bundle  {
    val enable = Input(Bool())
    val data = Input(UInt(4.W))
    val out = Output(UInt(4.W))
    val tmp = Output(UInt(32.W))
  })
  io.out := RegEnable(io.data, io.enable)
  io.tmp := RegEnable(!io.data, io.enable)
}

Then I call it in the upper module然后我在上层模块中调用

class q extends Module{
  val io  = IO(new Bundle{
    val in = Input(UInt(4.W))
    val out = Output(UInt(32.W))
})
  val q = Module(new tmp)
  q.io.enable := true
  q.io.data := io.in
  io.out := q.io.out
}

the tmp bundle of the tmp module will not be generated as verilog. tmp 模块的 tmp 包不会作为 verilog 生成。 How do I know that bundles like tmp are not generated without looking at verilog.我怎么知道不查看 verilog 就不会生成像 tmp 这样的包。

This is because of the way your code is written.这是因为您的代码的编写方式。 You essentially just created another class to send in inputs and receive the output of the tmp module.您实际上只是创建了另一个类来发送输入并接收 tmp 模块的输出。 Therefore Chisel optimizes the inputs and output of tmp to a bunch of wires which are being driven by the input and output pins of q module.因此,Chisel 将 tmp 的输入和输出优化为由 q 模块的输入和输出引脚驱动的一堆电线。 If you want to keep the tmp module then I would suggest you to not drive the io pins of the module from any other class.如果您想保留 tmp 模块,那么我建议您不要从任何其他类驱动模块的 io 引脚。 Rather just keep it that way and once the verilog is generated you can write a testbench to drive the io pins of tmp module.而是保持这种方式,一旦生成了 verilog,您就可以编写一个测试平台来驱动 tmp 模块的 io 引脚。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM