sin/cos波を作成する SV-RNM

はじめに

SystemVerilog-RNMでsin/cos波を作成します。

サンプルコード

`timescale 1us/1us
module top;
    time ts = 1ms;  // サンプリング間隔
    real f = 60.0;  // 周波数

    real t;
    real sin;
    real cos;

    initial begin
        #100ms;
        $finish;
    end

    always #ts t = $realtime/1s;  // 1sで割ってtimescaleに合わせる

    assign sin = $sin(2*3.14*f*t);
    assign cos = $cos(2*3.14*f*t);
endmodule

実行結果

まとめ

sin波、cos波を作成しました。

コメント

タイトルとURLをコピーしました