存根(Stub)
您可以将组件层次结构清空作为一个存根(stub):
class SubSysModule extends Component {
val io = new Bundle {
val dx = slave(Stream(Bits(32 bits)))
val dy = master(Stream(Bits(32 bits)))
}
io.dy <-< io.dx
}
class TopLevel extends Component {
val dut = new SubSysModule().stub // instance an SubSysModule as empty stub
}
例如,它将生成以下 Verilog 代码:
module SubSysModule (
input io_dx_valid,
output io_dx_ready,
input [31:0] io_dx_payload,
output io_dy_valid,
input io_dy_ready,
output [31:0] io_dy_payload,
input clk,
input reset
);
assign io_dx_ready = 1'b0;
assign io_dy_valid = 1'b0;
assign io_dy_payload = 32'h0;
endmodule
您还可以清空顶部组件
SpinalVerilog(new Pinsec(500 MHz).stub)
stub 有什么作用?
首先遍历所有组件并找出时钟,然后保留时钟
然后删除所有子组件
then remove all assignment and logic we don’t want
给输出端口赋值0