オペレーター RamLUT (imaFlex)

オペレーター Library: Memory

This operator implements a large lookup table (LUT) based on the Frame Grabber RAM, usually DRAM. One VisualApplets resource of type RAM is required (see 'Allocation of Device Resources'). Multiple resources of type RAM use the same physical RAM with the shared memory concept. Documentation for how to use the shared memory is available in the Application Note: Shared Memory.

オペレーター RamLUT は、出力上のカーネルをサポートしています。

Typical use cases for this operator are color space classification problems.

The operator facilitates the programming of the LUT content in two ways. For both ways, the LUT has to be programmed after the synthesis process at the time when the applet is used during runtime.

  1. LUTをプログラミングする1つ目の方法は、アドレス・値パラメータ InitAddress および InitData を提供するレジスタインターフェースです。 まず、パラメータ InitAddress を使用してアドレスを設定します。 次に、データをパラメータ InitData に書き込みます。 データを書き込むと、オペレーターが実際にLUTに書き込みを行い、以前の値が置き換えられます。 カーネルを使用する場合、最後のカーネル要素への書き込みによってオペレーターが実際にLUTに書き込みを行い、以前の値が置き換えられます。

  2. LUTをプログラミングする2つ目の方法は、コンテンツを含むファイルの使用です。 ファイルアクセスはレジスタアクセスよりも高速ですが、いくつか注意すべき点があります。ファイルはさまざまなフォーマットにすることができます。 フォーマットはパラメータ InitFileMode で定義する必要があります。

    • text_with_checks

      このモードでは、初期化ファイルはテキストファイルである必要があり、値の文字列は空白、タブストップ、ラインフィード(LF)、またはキャリッジリターンラインフィード(CRLF)のいずれかで区切られています。 オペレーターはこれらのファイルのエラーをチェックし、ファイルを使用できない場合はエラーを報告します。

      Each value represents a kernel element and needs to be a decimal number within the correct range.

      次の図は、4x3カーネルのファイルを示しています。

    • text_raw

      このモードは text_with_checks モードに似ていますが、エラーチェックの数が少なくなっています。 このモードでは、各値を個別の行で提供する必要があります。 このモードでのファイルの読み込みは、text_with_checks モードと比較して高速です。 上記の例は、text_raw モードでは次のようになります。

    • binary

      binary モードではバイナリファイルを想定しており、LUT要素の各カーネルエントリに8バイトが使用されます。 カーネルエントリの値が64ビット未満で表現できる場合、未使用のビットは無視されます。 これは、LUTに値を書き込むための最も高速な方法です。 上記の例は、binary モードでは次のようになります。

    3つのモードすべてにおいて、ファイル内のエントリ数がLUT要素数を超えてはならず、値の数はKernelSizeの倍数である必要があります。 したがって、ファイルには最大で 2^InputBitWidth * KernelSize の値が含まれている必要があります。

    初期化ファイルに 2^InputBitWidth * KernelSize の値が含まれている場合、アドレス0から開始してLUTメモリが完全に上書きされます。 この場合、パラメータ InitAddress は変更されません。

    初期化ファイルに含まれるエントリが少ない場合、部分的な初期化が実行されます。 その場合、InitAddress パラメータで指定されたアドレスから初期化が開始されます。 パラメータ InitAddress は、最後に書き込まれたLUTエントリの次の位置に自動的にインクリメントされます。 これにより、書き込まれたLUTエントリの数を監視できます。 ファイルに (2^InputBitWidth - InitAddress) * KernelSize よりも多くの値が含まれている場合、 LUTの最後のエントリの書き込み後に初期化が停止し、InitAddress が0に設定されます。

    パラメータ InitFilename は、初期値を収めたファイルを指定します。 最後に、パラメータ LoadInitFile に値 1 を書き込むと、ファイルの読み込みが開始され、受け入れられた場合はハードウェアへの値の書き込みが開始されます。 パラメータ LoadInitFile に 0 を書き込んでも、値の読み込みは発生しません。 これは、アプレットの初期化処理中に初期ファイルをハードウェアに読み込みたくない場合に便利です。

    シミュレーション中、初期ファイルの読み込みはランタイム時と同様に行われます。 部分的な設定の場合やエラーが発生した場合は、シミュレーションログ的出力を確認すると便利です (アクティブ化する必要がある場合があります。 Show Details 場所: シミュレーション ダイアログ)。

Note that the DRAM technology offers very poor performance for random access. In a worst case scenario when each consecutive access to the DRAM causes a page miss and requires a new row activation, the DRAM throughput suffers 90% loss of the maximal performance, resulting in about 10% bandwidth usage.

The input link can handle dynamic line widths, as well as empty lines and empty frames. Consequently, the output link can handle the same image dimensions.

帯域幅の最適化

For optimal performance, the used number of data bits should match as closely as possible the number provided in the module parameter RamDataWidth. The maximum bandwidth going through the operator is reached if the product of bit width and kernel size is equal to the internal RAM port width RamDataWidth.

利用可能なハードウェアプラットフォーム
imaFlex CXP-12 Penta
imaFlex CXP-12 Quad

I/O Properties

Property 値
Operator Type M
Input Link I、読み取りアドレス入力
Output Link O、画像データ出力

Supported Link Format

Link Parameter Input Link I Output Link O
Bit Width [1, RAM Address Width]1 [1, 64]2
Arithmetic 署名なし as I
Parallelism 1 as I
Kernel Columns 1 [1, Ram Data Width / Bit Width]
Kernel Rows 1 [1, Ram Data Width / Bit Width / Kernel Columns]
Img Protocol {VALT_IMAGE2D, VALT_LINE1D, VALT_PIXEL0D} as I
Color Format VAF_グレー as I
Color Flavor FL_NONE as I
Max. Img Width any as I
Max. Img Height any as I

1

The allowed input bit width depends on the physical memory of the frame grabber and on how many operators share the RAM. The RamAddressWidth parameter provides the maximum address bits that can be used. Note that this number may change depending on the number of RAM-based operators in the design.

2

The allowed output bit width depends on the physical memory of the frame grabber. The bit width is limited to 64 bit but several kernel components may be stored. The product of (bit width * kernel size) must not exceed the native RAM data width shown in parameter RamDataWidth.

パラメーター

RamDataWidth
タイプ 静的書き込みパラメータ
Default N/A
範囲 整数

このパラメータは、RAMインターフェイスで使用できるデータビット数を提供します。これは、カーネルが適切に使用されている場合に出力で提供できる最大ビット数です。

RamAddressWidth
タイプ 静的書き込みパラメータ
Default N/A
範囲 整数

このパラメータは、使用できるアドレスビット数を提供します。

InitAddress
タイプ dynamic write parameter
Default 0
範囲 [0, 2^InputBitWidth-1]

このパラメータは、パラメータ InitData で定義されたデータのアドレスを定義します。 上記の記述を参照してください。

InitData
タイプ dynamic write parameter
Default 0
範囲 [0, 2^OutputBitWidth-1]

このパラメータは、パラメータ InitAddress で定義されたアドレスに書き込まれるデータを定義します。 このパラメータへの書き込みにより、ハードウェアへの実際の書き込みが開始されます。 上記の記述を参照してください。

InitFileLoadMode
タイプ dynamic write parameter
Default text_with_checks
範囲 {text_with_checks, text_raw, binary}

このパラメータは、ルックアップテーブルにロードされるファイルのファイル形式とモードを定義します。 上記の記述を参照してください。

InitFileName
タイプ dynamic write parameter
Default InitRamLut.txt
範囲

このパラメータは、初期化ファイルの名前を定義します。

LoadInitFile
タイプ dynamic write parameter
Default 0
範囲 [0, 1]

InitFileName パラメータで指定されたファイルをLUTにロードし始めるには、このパラメータに値 1 を書き込みます。 上記の記述を参照してください。