统一地址模式的系统verilog约束
System verilog constraint for uniform address pattern
我想在“rand bit [7:0] addr[10]”上添加一个约束,这样我们就可以从第 0 个索引到第 5 个以均匀递增的顺序生成地址,从第 6 个到最后一个索引以均匀递减的顺序生成地址。我是 SV 约束的新手,有人可以提供帮助吗?
class A;
rand bit [7:0] addr[10];
rand int step; // this needs to be an int to catch underflow/overflow
constraint uniform {
foreach (addr[index]) {
index inside {[0:4]} -> addr[index] + step == addr[index+1];
index inside {[6:8]} -> addr[index] - step == addr[index+1];
}
step inside {[1:25]};
}
endclass
我想在“rand bit [7:0] addr[10]”上添加一个约束,这样我们就可以从第 0 个索引到第 5 个以均匀递增的顺序生成地址,从第 6 个到最后一个索引以均匀递减的顺序生成地址。我是 SV 约束的新手,有人可以提供帮助吗?
class A;
rand bit [7:0] addr[10];
rand int step; // this needs to be an int to catch underflow/overflow
constraint uniform {
foreach (addr[index]) {
index inside {[0:4]} -> addr[index] + step == addr[index+1];
index inside {[6:8]} -> addr[index] - step == addr[index+1];
}
step inside {[1:25]};
}
endclass