文章目录
硬件描述语言(HDL)是用来描述 数字电路和设计 数字逻辑系统的语言。 Verilog HDL是硬件描述语言的一种,用于数字电子系统设计,是目前应用最为广泛的一种硬件语言。
一、可综合的语法子集
可综合的语法是指硬件能够实现的语法,这些语法可以通过综合工具编译最终生成用于烧录到FPGA的配置数据流。
所有综合工具都支持的结构:always,assign,begin,end,case,wire,tri,reg,integer,default,for,function,and,nand,or,nor,xor,xnor,not,if,inout,input,module,negedge,posedge,output,parameter…
1.1 模块声明类
模块的端口声明了模块的输入输出口。例:
module adder(count,sum,a,b,cin);
input [2:0] a,b;
input cin;
output count;
output [2:0] sum;
assign {
count,sum} = a + b + cin;
endmodule
1.2 端口声明
每一个module都会有输入和输出信号用于和外部器件或者其它模块通信。这些输入输出端口可以分为三类:input,ou