System verilog 测试台如何捕获或报告独特的案例冲突
目标是创建一种机制,自动捕获System verilog 测试台如何捕获或报告独特的案例冲突,system-verilog,System Verilog,目标是创建一种机制,自动捕获unqiue案例违规行为,并将其报告给测试台,以便在模拟过程中进行错误计数。日志文件可能很大,使得后期处理不太实用。手动创建断言容易出错(特别是当一个热条件不是下面的代码那样的连续总线时),并且在设计开发过程中是一个永无止境的赋值 always_comb begin unique case(1'b1) a[3] : b = 4'h3; a[2] : b = 4'h2; c[10] : b = 4'hE; c[8] : b =
unqiue案例
违规行为,并将其报告给测试台,以便在模拟过程中进行错误计数。日志文件可能很大,使得后期处理不太实用。手动创建断言容易出错(特别是当一个热条件不是下面的代码那样的连续总线时),并且在设计开发过程中是一个永无止境的赋值
always_comb begin
unique case(1'b1)
a[3] : b = 4'h3;
a[2] : b = 4'h2;
c[10] : b = 4'hE;
c[8] : b = 4'h4;
endcase
end
我可以使用$assertcontrol
启用/禁用对唯一案例
违规的报告,因此我相信可以使用VPI回调,但我在使用VPI\u iterate()
查找唯一案例
时遇到问题,目前,我正在缓慢地遍历设计,试图找出何时传递我的vpiHandle
所指向的对象。我尝试了vpi\u迭代(vpiCallback,NULL)
,但我的模拟器返回一条消息,说明vpiCallback
尚未实现
模拟器正在向日志文件报告
唯一案例
违规行为。那么,我怎样才能让我的测试台检测到它呢?我还没有完整的答案,但这里有一些东西可以让你开始。我将您的始终\u comb
块添加到模块:
module some_module();
logic [3:0] a;
logic [3:0] b;
logic [8:0] c;
always_comb begin : always_comb_proc
unique case(1'b1)
a[3] : b = 4'h3;
a[2] : b = 4'h2;
c[10] : b = 4'hE;
c[8] : b = 4'h4;
endcase
end
initial begin
$add_cbs();
end
endmodule
我创建了一个VPI系统任务,可以找到唯一案例的句柄。这只是一个遍历层次结构的问题:
void add_cbs_calltf() {
// getting the module could be more elegant
vpiHandle mod = vpi_handle_by_name("some_module", NULL);
// there's only one process - the 'always_comb'
vpiHandle proc_it = vpi_iterate(vpiProcess, mod);
vpiHandle proc = vpi_scan(proc_it);
// each 'always' process has an event control
// - for 'always_comb', this is implicit
vpiHandle ev_ctrl = vpi_handle(vpiStmt, proc);
// the event control contains the 'begin/end' statement
vpiHandle named_begin = vpi_handle(vpiStmt, ev_ctrl);
// finally, a 'begin/end' statement can contain other statements
// - the one and only in this case is the 'unique case'
vpiHandle stmt_it = vpi_iterate(vpiStmt, named_begin);
vpiHandle stmt = vpi_scan(stmt_it);
vpi_printf("stmt type = %s\n", vpi_get_str(vpiType, stmt));
vpi_printf("stmt case type = %d\n", vpi_get(vpiCaseType, stmt));
vpi_printf("stmt case qualifier = %d\n", vpi_get(vpiQualifier, stmt));
}
我仍然不知道如何在“断言”触发时添加回调,但这应该是朝着正确方向迈出的一步。我可能会研究一下并更新答案。我还没有完整的答案,但这里有一些东西可以让你开始。我将您的始终\u comb
块添加到模块:
module some_module();
logic [3:0] a;
logic [3:0] b;
logic [8:0] c;
always_comb begin : always_comb_proc
unique case(1'b1)
a[3] : b = 4'h3;
a[2] : b = 4'h2;
c[10] : b = 4'hE;
c[8] : b = 4'h4;
endcase
end
initial begin
$add_cbs();
end
endmodule
我创建了一个VPI系统任务,可以找到唯一案例的句柄。这只是一个遍历层次结构的问题:
void add_cbs_calltf() {
// getting the module could be more elegant
vpiHandle mod = vpi_handle_by_name("some_module", NULL);
// there's only one process - the 'always_comb'
vpiHandle proc_it = vpi_iterate(vpiProcess, mod);
vpiHandle proc = vpi_scan(proc_it);
// each 'always' process has an event control
// - for 'always_comb', this is implicit
vpiHandle ev_ctrl = vpi_handle(vpiStmt, proc);
// the event control contains the 'begin/end' statement
vpiHandle named_begin = vpi_handle(vpiStmt, ev_ctrl);
// finally, a 'begin/end' statement can contain other statements
// - the one and only in this case is the 'unique case'
vpiHandle stmt_it = vpi_iterate(vpiStmt, named_begin);
vpiHandle stmt = vpi_scan(stmt_it);
vpi_printf("stmt type = %s\n", vpi_get_str(vpiType, stmt));
vpi_printf("stmt case type = %d\n", vpi_get(vpiCaseType, stmt));
vpi_printf("stmt case qualifier = %d\n", vpi_get(vpiQualifier, stmt));
}
我仍然不知道如何在“断言”触发时添加回调,但这应该是朝着正确方向迈出的一步。我可能会研究它并更新答案。您只是想将警告升级为错误吗?对于incisive,您可以使用-ncerror
@nguthrie来实现这一点,我希望它能够在我的测试台上触发一些东西,比如发出一个“uvm_错误()”`我无法帮助您使用VPI,但是如何定义一些宏,包括错误检查/断言以及唯一案例
?@MatthewTaylor,我无法触摸RTL。我一直在考虑制作一个每个处理脚本来解析RTL文件,一些如何检测提取独特情况下使用的信号,并计算出时钟域,然后生成bind
语句的文件。使用$onehot
断言创建参数化检查器模块将是一个简单的部分。创建要解析和提取的脚本很困难。另外,我不确定脚本策略是否容易标记来自零时间故障的错误违规。是否只想将警告升级为错误?对于incisive,您可以使用-ncerror
@nguthrie来实现这一点,我希望它能够在我的测试台上触发一些东西,比如发出一个“uvm_错误()”`我无法帮助您使用VPI,但是如何定义一些宏,包括错误检查/断言以及唯一案例
?@MatthewTaylor,我无法触摸RTL。我一直在考虑制作一个每个处理脚本来解析RTL文件,一些如何检测提取独特情况下使用的信号,并计算出时钟域,然后生成bind
语句的文件。使用$onehot
断言创建参数化检查器模块将是一个简单的部分。创建要解析和提取的脚本很困难。另外,我不确定脚本策略是否会倾向于标记来自零时间故障的错误违规。