来源:systemverilog验证 测试平台编写指南(书籍)
1 新建counter7.c文件
vi counter7.c
#include<svdpi.h>
void counter7(
svBitVecVal * o,
const svBitVecVal * i,
const svBit reset,
const svBit load){
static unsigned char count = 0;
if (reset) count = 0;
else if (load) count = *i;
else count++;
count = count&0x7f;
*o = count;
}
2 新建counter.sv文件
vi counter.sv
3 制作makefile