0

(1/10) 秒の精度で 0:00.0 から 9:99.9 までカウントできるストップウォッチを作成しようとしています。

私のストップウォッチは、クロックとイネーブル信号で動作する独自のバイナリ カウンター (Vivado の IP カタログで提供) を各桁に与えることで機能します。特定の桁がゼロにリセットされると (たとえば、9 から 0 に遷移する)、次の桁にパルスが送信され、1 ずつカウントアップするように指示されます。

各桁に独自のモジュールを割り当て、上部のモジュールを介してポートを相互に接続しました。

問題は、デシ秒スポットが完全にカウントアップすることですが、次の桁はゼロのままです。設計をシミュレートした後、最初の桁で送信された信号が次の桁で受信されていないことがわかりました。

モジュールのインスタンス化の構文とポート接続を確認しましたが、エラーはありませんでした。最初の桁の出力パルスをいくつかの LED にマッピングしたところ、完全に正常に点灯しました。したがって、エラーは 2 桁目の受信側にあると想定しています。しかし、なぜこれが起こっているのかわかりません。

桁 1 モジュール:

// module that contains both digit 1 counter and decimal converter
module digit_1(
    input clk_10_Hz, clk_100_Hz, reset,
    output [7:0] digit_1_out,
    output [3:0] Q_1
    );

    c_counter_binary_9_count COUNTER_9 (.CLK(clk_100_Hz),.CE(clk_10_Hz),.SCLR(reset),.Q(Q_1));
    digit_1_bcd_to_decimal CONVERTER_DIGIT_1 (.Q_1,.clk_100_Hz,.digit_1_out);

endmodule

桁 2 モジュール:

// module that contains both digit 2 counter and decimal converter
module digit_2(
    input clk_100_Hz, reset,
    input [3:0] Q_1,
    output [7:0] digit_2_out,
    output [3:0] Q_2
    );

reg THRESH1;
reg test_CE_2;

c_counter_binary_9_count COUNTER_9 (.CLK(clk_100_Hz),.CE(test_CE_2),.SCLR(reset),.Q(Q_2));
digit_2_bcd_to_decimal CONVERTER_DIGIT_2 (.Q_2,.clk_100_Hz,.digit_2_out);

// ensures that clock pulse will only be length of 100 Hz clock pulse 
always @ (negedge clk_100_Hz)
    if (Q_1 == 4'h9)
        THRESH1 = 1;
    else
        THRESH1 = 0;

always @ (posedge clk_100_Hz)
    if (THRESH1)
        begin
        if (Q_1 == 4'h0)
            test_CE_2 = 1;
        else
            test_CE_2 = 0;
        end
    else
        test_CE_2 = 0;

endmodule

トップモジュール:

// TOP module - combines all the other modules with each other
module stop_watch(
    input clk_100_MHz, reset, enable,
    output [7:0] an, display
    );

    wire clk_10_Hz, clk_100_Hz, clk_250_Hz;
    wire [7:0] digit_1_out ,digit_2_out,digit_3_out,digit_4_out; // connects digit outputs with display selector

    wire [3:0] Q_1, Q_2, Q_3; // connects outpus of binary counter with inputs of others

    clock CLOCK (.clk_100_MHz,.enable,.clk_10_Hz,.clk_100_Hz,.clk_250_Hz);

    digit_1 DIGIT_1 (.clk_10_Hz,.clk_100_Hz,.reset,.Q_1,.digit_1_out);
    digit_2 DIGIT_2 (.clk_100_Hz,.reset,.Q_1,.Q_2,.digit_2_out);
    digit_3 DIGIT_3 (.clk_100_Hz,.reset,.Q_2,.Q_3,.digit_3_out);
    digit_4 DIGIT_4 (.clk_100_Hz,.reset,.Q_3,.digit_4_out);

    anode_frequency ANODE_FREQUENCY (.clk_250_Hz,.an);
    display_selector DISPLAY_SELECTOR (.an,.digit_1_out,.digit_2_out,.digit_3_out,.digit_4_out,.display);

endmodule

コード全体は約 400 行なので、必要な部分だけを入れましたが、要求があればコード全体を入れることもできます。

Vivado 2014.1 を使用しており、FPGA ボードは NEXYS 4 です。

4

1 に答える 1