VerilogHDL学习

No.1 Verilog HDL程序结构

  1. Verilog 描述硬件的基本设计单元是模块 module

  2. 复杂的电子电路构建主要是通过模块之间的相互连接调用来实现的,在Verilog中将模块包含在关键字 module endmodule之间。

  3. Verilog中的模块类似于C语言中的函数,它可以提供输入、输出端口,并且可以通过例化调用其他模块(就这点而言可以理解成C++中的类实例化对象)


No.2 Verilog的程序结构

端口定义 数据类型说明 逻辑功能定义
input wire assign
output ... parameter ... function ...

No.3 模块声明与模块端口定义

module <module_name>(port_name1,...port_namen);
    .
    .
    .
endmodule

例子:

module test(a,b,c,d,e,f,g,h);
    input[7:0] a;       //没有明确的说明,网络是无符号的
    input[7:0] b;
    input signed[7:0] c; 
    input signed[7:0] d;//明确的网络说明,网络是有符号的
    output [7:0] e;
    output [7:0] f;
    output signed[7:0] g;
    output signed[7:0] h;
    wire signed[7:0] b; //从网络声明中端口b继承了有符号的属性
    wire [7:0] c;       //网络c继承了来自端口的有符号属性
    reg [7:0] g;        //从寄存器声明中端口f继承了有符号的属性
    reg signed[7:0] f;  //寄存器类型的g继承了...的有符号属性
endmodule
2019.7.7.21.08
Crf.Kevin

猜你喜欢

转载自www.cnblogs.com/congrifan/p/11261449.html