Error (10028): Can't resolve multiple constant drivers for net "start" at sys_control.v(17).
源代码如下:
module sys_control(rok,clk,reset,start,trans);
input rok,reset,clk;
output start,trans;
reg start,trans;
reg flag_rok;
always@(posedge reset)
begin start<=0;trans<=1;end
always@(negedge rok,posedge clk)
begin
if(clk)flag_rok<=1'b1;
else if(~rok) flag_rok<=1'b0;
end
always@(posedge clk)
begin
start<=~flag_rok;//有错
trans<=~start;
end
endmodule
这是什么原因啊?
不可以在两个always中对同一个信号赋值,这是多驱。
楼主的代码不是一般的错.
可以参考以下代码:
always@(negedge reset or posedge clk)
if (!reset)
start <= 0;
else
start <= ~flag_rok;