学海荡舟手机网
导航

主页 > 电子设备技术 > 电器电路基础 > > 详细内容

Verilog-2001的模块定义

      相比于Verilog-1995,Verilog-2001允许更加灵活的模块定义方式,语法如下:
    module module_name
    #(parameter_declaration, parameter_declaration,... )
    (port_declaration port_name, port_name,..., port_declaration port_name, port_name,...);
    module it
    endmodule
          而Verilog-1995的语法如下
    module module_name (port_name, port_name, ... );
    port_declaration port_name, port_name,...;
    port_declaration port_name, port_name,...;
    module items
    endmodule
   
    (port_declaration port_name, port_name)的一个实例如下:
    parameter SIZE = 4096;
    input [log2(SIZE)-1:0] addr;
   
    Verilog-2001风格的模块示例如下:
    module reg4 (output wire [3:0] q,input wire [3:0] d,clk);
    input clk;
    …
    endmodule
    用户可以继续使用Verilog-1995的风格,也可以采用Verilog-2001的风格。

相关文章