Altifigence Academy

21 / 36 · 実習

カウンタシミュレーション実習

リセット後の増加と折り返しを観察します。

このコースで学ぶこと

Start at 3 and reset on the first rising edge. The sequence is then 0, 1, 2, 3, 0. A synchronous reset changes the value only at a clock edge.

はじめる前に

Digital Design Studio Desktopのプロジェクトと実行権限を準備してください。各例は別フォルダのrtl/top.svとして保存します。

SystemVerilog source

SystemVerilog
module top (
    input logic clk,
    input logic rst,
    output logic [1:0] count
);
    // Active-high synchronous reset: sampled only at the rising clock edge.
    always_ff @(posedge clk)
        if (rst) count <= 2'b00;
        else count <= count + 2'b01;
endmodule

例を実行する

New analysisでTwo-state single-clock v1を選び、Clock portをclk、周期を1000psにします。以下の値でPreflight、その後Run RTL simulationを実行し、結果を比較してください。

設定
レジスタ初期値(LSBから)[true,true]
リセットポートrst · Highで有効 · 1サイクル
最大サイクル数 / 時間5 / 5000ps

Input stimulus

json
[
  {
    "inputs": {}
  },
  {
    "inputs": {}
  },
  {
    "inputs": {}
  },
  {
    "inputs": {}
  },
  {
    "inputs": {}
  }
]

結果を比較する

5サイクル後はcount=00。500、1500、2500、3500、4500psで00→01→10→11→00を確認してください。

実習は0/1の単一クロックRTLです。#delay、initial、X/Zのテストベンチを追加しないでください。学習進捗はシミュレータ実行の証拠ではありません。

Lesson files

counter-top.sv ↓counter-inputs.json ↓

選択はこのブラウザに適用されます。フッターからいつでも変更できます。