always块也有两种
always@(*)
always@(posedge )
就是电平触发和沿触发
在verilog中赋值语句也有三种
连续赋值 (assign x = y;)。 不能在过程中使用(“always块”)。
阻塞赋值: (x = y;)。 只能在过程中使用。
非阻塞赋值: (x <= y;)。 只能在过程中使用。
Build an XOR gate three ways, using an assign statement, a combinational always block, and a clocked always block. Note that the clocked always block produces a different circuit from the other two: There is a flip-flop so the output is delayed.
用三种方式构建异或门:使用assign语句、组合always语句块和时钟always语句块。请注意,时钟always块产生的电路与其他两个不同:有一个触发器,因此输出被延迟。
// synthesis verilog_input_version verilog_2001
module top_module(
input clk,
input a,
input b,
output wire out_assign,
output reg out_always_comb,
output reg out_always_ff );
assign out_assign = a ^ b;
always@(*) out_always_comb = a ^ b;
always@(posedge clk) out_always_ff <= a ^ b;
endmodule
注意在上升沿触发的过程中会产生一定的延迟