Altifigence Academy

29 / 36 · 実習

シフトレジスタ実習

直列入力とqを同時に追います。

このコースで学ぶこと

At each rising edge, the previous two low bits of q move left and din enters bit 0. Feed 1, 0, 1, 1 and compare each step.

はじめる前に

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

SystemVerilog source

SystemVerilog
module top (
    input logic clk,
    input logic rst,
    input logic din,
    output logic [2:0] q
);
    // Old q[1:0] and din are captured together at each rising edge.
    always_ff @(posedge clk)
        if (rst) q <= 3'b000;
        else q <= {q[1:0], din};
endmodule

例を実行する

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

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

Input stimulus

json
[
  {
    "inputs": {
      "din": [
        false
      ]
    }
  },
  {
    "inputs": {
      "din": [
        true
      ]
    }
  },
  {
    "inputs": {
      "din": [
        false
      ]
    }
  },
  {
    "inputs": {
      "din": [
        true
      ]
    }
  },
  {
    "inputs": {
      "din": [
        true
      ]
    }
  }
]

結果を比較する

5サイクル後はq=011。立上り後の順序は000→001→010→101→011です。

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

Lesson files

shift-top.sv ↓shift-inputs.json ↓

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