Код
module counter (clk,count);
input clk;
output[9:0] count;
reg [9:0] count;
initial count = 1'b1;
always @(posedge clk) begin
if (count == 255) count = 0;
else count = count << 1;
end
endmodule
input clk;
output[9:0] count;
reg [9:0] count;
initial count = 1'b1;
always @(posedge clk) begin
if (count == 255) count = 0;
else count = count << 1;
end
endmodule
Результатом работы которого является нечто:

Как видно, 6-й переход явно какой-то не такой.
А вот если я пишу так:
Код
module counter (clk,count);
input clk;
output[9:0] count;
reg [9:0] count;
initial count = 1'b1;
always @(posedge clk) begin
if (count == 255) count = 0;
else count = count + 1;
end
endmodule
input clk;
output[9:0] count;
reg [9:0] count;
initial count = 1'b1;
always @(posedge clk) begin
if (count == 255) count = 0;
else count = count + 1;
end
endmodule
Естественно, графы другие. Но таких явных нарушений в работе нет.
Где грабли?