简体   繁体   中英

printf redirection for DPI

While using DPI in SystemVerilog I faced an issue to redirect stdout of C side into stdout of SystemVerilog to get all log writes in one place (In my case printf from C were displayed in terminal but not seemed in log file from EDA).

I know the 100% works solution it is export function from SV side and use it in C to print, but it does not seem to me clever.

I tried to use some sort of redirection using reopen functions to changed address stdout var points to (as far as I understand the stdout it is an address for program to write into), but eventually it redirects all logging into this stdout including SystemVerilog log.

What is a better way to keep all logs in one stream?

Maybe there is a way to get C know the IDE stdout?

The answer had been given by https://stackoverflow.com/users/1143850/serge

Use vpi_print function from C side. The vpi_print will put its output into the same stream as EDI does

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM