Altifigence Academy

9 / 36 · 実習

MUXシミュレーション実習

提供されたソースと入力ファイルで出力を比較します。

このコースで学ぶこと

When sel is 0, y follows a; when sel is 1, it follows b. sampled_y stores y at the rising clock edge and holds that value until the next rising edge.

はじめる前に

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

SystemVerilog source

SystemVerilog
module top (
    input logic clk,
    input logic a,
    input logic b,
    input logic sel,
    output logic y,
    output logic sampled_y
);
    assign y = sel ? b : a;
    // Explicit observation register: y remains purely combinational.
    // The register makes this design eligible for logic-netlist-1 simulation.
    always_ff @(posedge clk) sampled_y <= y;
endmodule

例を実行する

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

設定
レジスタ初期値(LSBから)[false]
リセットポート空欄にする
最大サイクル数 / 時間8 / 8000ps

Input stimulus

json
[
  {
    "inputs": {
      "a": [
        false
      ],
      "b": [
        false
      ],
      "sel": [
        false
      ]
    }
  },
  {
    "inputs": {
      "a": [
        false
      ],
      "b": [
        false
      ],
      "sel": [
        true
      ]
    }
  },
  {
    "inputs": {
      "a": [
        false
      ],
      "b": [
        true
      ],
      "sel": [
        false
      ]
    }
  },
  {
    "inputs": {
      "a": [
        false
      ],
      "b": [
        true
      ],
      "sel": [
        true
      ]
    }
  },
  {
    "inputs": {
      "a": [
        true
      ],
      "b": [
        false
      ],
      "sel": [
        false
      ]
    }
  },
  {
    "inputs": {
      "a": [
        true
      ],
      "b": [
        false
      ],
      "sel": [
        true
      ]
    }
  },
  {
    "inputs": {
      "a": [
        true
      ],
      "b": [
        true
      ],
      "sel": [
        false
      ]
    }
  },
  {
    "inputs": {
      "a": [
        true
      ],
      "b": [
        true
      ],
      "sel": [
        true
      ]
    }
  }
]

結果を比較する

8サイクル後はy=1、sampled_y=1。3000psでy=1とsampled_y=0を比較してください。

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

Lesson files

mux-top.sv ↓mux-inputs.json ↓

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