今度は ChatGPT に Verilog コードを聞いてみた

 今度は Verilog のコードを聞いて見ました。

質問はこれです。
Verilog counter code

帰ってきた結果です。
module counter(clk, rst, en, count);
 input clk, rst, en;
 output [3:0] count;
 reg [3:0] count;
 always @(posedge clk) begin
  if (rst) begin
   count <= 0;
  end else if (en) begin
   count <= count + 1;
  end
 end
endmodule

ちゃんとリセットもイネーブルの信号も入っています。

この記事へのコメント