Reputation: 11
I'm working on an risc-v project and new to DPI-C mechanism.
I want to using cpp to realize the pmem_read
& pmem_write
function and export it into verilog.
This is the declaration.
// paddr.cpp
extern "C" void pmem_read(unsigned char re, uint32_t raddr, uint32_t mask, uint32_t *rword){...}
// Dcache.sv
import "DPI-C" function void pmem_read(input bit re, input int addr, input int mask, output int rword);
// main.cpp
#include <Vtop.h>
#include <paddr.h>
...
However, when using Verilator to compile them, I encounter an error which reports the declaration in Vtop.h
is conflicting with the one in paddr.cpp
.
But when using DPI-C, the declarations are just different, really don't know how to solve it.
Upvotes: 0
Views: 85
Reputation: 11
I found I incorrectly add the Vtop.h
in paddr.cpp
which is the cause that raises the confilict error.
After removing it, the code works fine.
Upvotes: 0