module counter_v (Q, CLOCK, RESET, CLOCK_E); output [3:0] Q; input CLOCK; input RESET; input CLOCK_E; reg [3:0] tmp; always @(posedge CLOCK) begin if ( !RESET ) tmp = 4'b000; else if( CLOCK_E ) tmp = tmp + 1; end assign Q = tmp; endmodule
入力は、クロック(CLOCK)、クロックイネーブル(CLOCK_E)、リセット(RESET) の3つ。出力は、カウンタの出力で Q[3:0] です。なお、RESET は負論理、 CLOCK_E および Q は正論理としています。
次は、 機能シミュレーションです。
Back
CMS CAD Group
CMS Home Page
Our mail address is kuga@cms.kyutech.ac.jp