《[ch7]VerilogHDL行为语句》由会员分享,可在线阅读,更多相关《[ch7]VerilogHDL行为语句(57页珍藏版)》请在金锄头文库上搜索。
1、Verilog HDL 行为语句电 子 信 息 通 信 学 科27 Verilog HDL 行为为 语语 句类别语句可综合性过程语句InitialalwaysOK块语句串行块 begin-endOK并行块fork-join赋值语句持续赋值 assignOK过程赋值 =,b) f b) f c) f b) f ; / 无端口列表端口及数据类类型声明语语句;其他语语句; endtask例: module test (a,b,code,c)input 3:0 a,b; input 1:0 code;output reg 4:0 c;task add;input 3:0 a,b;output 4:0
2、out;integer i;beginfor (i=3; i=0;i=i-1)out i = aiend endtaskalways (a or b or code) . endmodule577.7 任务与务与 函数数 (函数数)function使用格式: function 函数名;端口声明;局部变变量定义义;其他语语句; endfunction例: module test (in1,in2,out);input in1, in2;output out;assign out = EXOR_FUNC (in1,in2);function EXOR_FUNC;input in1, in2;if (in1in2) EXOR_FUNC = 1;else EXOR_FUNC = 0; endfunctionendmodule