1.
module test(
input wire clk,
input wire b,
output reg a,
output reg c
);
always@(posedge clk)
begin
a=b;
c=a;
end
endmodule
上面的代码在vivado中综合后的电路为:
2.
module test(
input wire clk,
input wire b,
output reg a,
output reg c
);
always@(posedge clk)
begin
a<=b;
c<=a;
end
endmodule
上面的代码在vivado中综合后的电路为:
3.
module test(
input wire clk,
input wire b,
output reg a,
output reg c
);
always@(posedge clk)
begin
a=b;
c<=a;
end
endmodule
上面的代码在vivado中综合后的电路为:
4.
module test(
input wire clk,
input wire b,
output reg a,
output reg c
);
always@(posedge clk)
begin
a<=b;
c=a;
end
endmodule
上面的代码在vivado中综合后的电路为:
5.
module test(
input wire clk,
input wire [1:0]E,
input wire D,
output reg Q
);
always@(posedge clk)begin
if(E==2'd3)
Q=D;
end
endmodule
上面的代码在vivado中综合后的电路为:
6.
module test(
input wire E,
input wire D,
output reg Q
);
always@(*)begin
if(E)
Q<=D;
end
endmodule
上面的代码在vivado中综合后的电路为:
可以看到综合的结果是锁存器。
7.
always@(posedge clk)begin
if(cnt==1'd1)
begin
rd=1'd0;//注意下面对rd做了判断,这里的阻塞和非阻塞赋值会影响综合后的电路结果
if(rd==1'd0)//上面的阻塞和非阻塞会影响综合后的电路
flag=1'd1;
end
else
cnt=cnt+1'd1;
end