verilog并行语句
并行语句是硬件描述语言的一大特点,最大特点是并行执行,不会因书写顺序的前后产生执行的先后。主要有4种
1、连续赋值语句
2、模块例化语句
3、initial语句
4、always语句
并行语句是Verilog HDL作为硬件描述语言的一大特性,VerilogHDL语言就是由并行语句组成的。
module module_name
{
端口声明,
端口声明,
端口声明
};
//变量定义
//并行语句;
endmodule;
module parallel_adder(
input[7:0]da_one,
input[7:0]db_one,
input[7:0]da_two,
input[7:0]db_two,
input[7:0]da_three,
input[7:0]db_three,
output[7:0]sum_one,
output[7:0]sum_two,
output[7:0]sum_three
);
//实现第一个加法器操作
assign sum_one = da_one + db_one;
//实现第二个加法器操作
assign sum_one = da_two + db_two;
//实现第三个加法器操作
assign sum_three = da_three + db_three;
endmodule
以上加法器为同时并行运行。
连续赋值语句
assign 。。。1
assign 。。。2
assign 。。。3
assign 。。。4
assign 。。。5
以上5个赋值语句是同时并行执行的
模块例化语句
可以让一个复杂的系统由子模块组成,实现并行工作。
VerilogHDL自带模块一般为门级电路模块,这些模块以原语形式出现,根据输入输出特性分为6类
1、多输入门电路:and与门、nand与非门、or或门、nor或非门、xor异或门、xnor同或门。
2、多输出门电路: buf缓冲门、nor非门
3、三态门: bufifo、bufifl、notfifo、notfifl
4、上拉、下拉电阻: pullup、pulldown
5、MOS开关: cmos、nmos、pmos、rcmos、rnmos、rpmos
6、双向开关: tran、tranif0、tranif1、rtran、rtranif0、rtranif1