FPGA入门教程 FPGA架构教程 Verilog教程Verilog-2001 SystemC教程
返回首页
当前位置: FPGA主页 > FPGA教程 > Verilog-2001 >

2.Verilog-2001的模块定义

时间:2009-12-17 21:43来源:未知 作者:admin 点击:
相比于Verilog-1995,Verilog-2001允许更加灵活的模块定义方式,语法如下: module module_name #(parameter_declaration, parameter_declaration,... ) (port_declaration port_name, port_name,..., port_declaration port_name, po

     相比于Verilog-1995,Verilog-2001允许更加灵活的模块定义方式,语法如下:
     module module_name
     #(parameter_declaration, parameter_declaration,... )
     (port_declaration port_name, port_name,..., port_declaration port_name, port_name,...);
     module items
     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的风格。

(责任编辑:admin)
顶一下
(0)
0%
踩一下
(1)
100%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名:密码: 验证码:点击我更换图片
推荐内容