前言

在设计流程中,可能有的模块是不使用的,但某时候可能需要使用。

不同代码段的选择就可以使用条件编译。

 verilog条件编译

流程

使用`define和`ifdef `else `endif语句实现此功能。

`timescale 1ns/1ps
`define SIM_USE //定义SIM_USE,如果取消定义,注释此句即可
module xxx (
    input     i_clk       ,
    input     i_rst_n     ,
    output    xxx           
);

`ifdef SIM_USE
    xxxxxxxx //如果定义了SIM_USE,则会编译这段代码
`else 
    xxxxxxxx //如果没有定义SIM_USE,则编译这段代码
`endif 



endmodule // end the xxx model

以上。

相关文章:

  • 2022-02-07
  • 2022-12-23
  • 2022-02-07
  • 2022-02-07
猜你喜欢
  • 2021-07-25
  • 2022-02-07
相关资源
相似解决方案