读、写和使能移位 - 2023.2 简体中文

Vitis 高层次综合用户指南 (UG1399)

Document ID
UG1399
Release Date
2023-12-18
Version
2023.2 简体中文

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 资源内。