shift
メソッドではイネーブル入力もサポートされており、シフト演算を変数で制御およびイネーブルにできます。
// Include the Class
#include "ap_shift_reg.h"
// Define a variable of type ap_shift_reg<type, depth>
// - Sreg must use the static qualifier
// - Sreg will hold integer data types
// - Sreg will hold 4 data values
static ap_shift_reg<int, 4> Sreg;
int var1, In1;
bool En;
// Read location 3 of Sreg into var1
// THEN if En=1
// Shift all values up one and load In1 into location 0
var1 = Sreg.shift(In1,3,En);
ap_shift_reg
クラスを使用すると、Vitis HLS で各シフト レジスタに対して固有の RTL コンポーネントが作成されます。論理合成が実行されると、このコンポーネントが SRL リソースに合成されます。