6

I have an verilog based test-bench, interfaced to 'C source using DPI. Now using DPI I am planning to write my whole firmware. To do this I need 3 things

  • Register Read
  • Register Write
  • Interrupt handler As I understand, register reads and writes are tasks that I need to export from the RTL test-bench. And Interrupt handler (I implemented by importing a function from 'C).

I checked most the cadence documentation and found no useful hints. I have also registered with cadence users community but it seems that I cannot ask question till they approve my registration.

Just in case someone is aware of this, would appreciate their help.

1
  • 1
    What is up with the apostrophe before the C? Is that a language distinct from C? Commented Apr 7, 2009 at 7:24

2 Answers 2

3

Actually I figured it out something like this.

//--From RTL ---
export "DPI" task reg_read;

task reg_read;
   input int nAddr;
   output int nVal;

 // -- read implementation --

endtask

// -- From C code
extern void reg_read (int nAddr, int *pVal);

void test_read (void)
{
   int nRegVal;

   // Dummy checking !!
   reg_read (0x100, &nRegVal);
}

// -- Again in RTL --
import "DPI" context task test_read ();

This works for me using ncverilog.

Sign up to request clarification or add additional context in comments.

Comments

2

Cool...I actually wrote an article on this topic. link

The paper is actually exporting register reads and writes and stuff across the DPI and then adding a TCL interpreter to it so that you can use TCL to control your sim. This was something the lab dudes loved since all their tools are already in Tcl.

You can just follow the instructions to integrate your function calls from C to SV across the DPI, and then stop when the TCL stuff comes into play.

2 Comments

The given link isn't valid.
Huh...it seems IC Journal doesn't exist anymore. Here is a link to the overview of how it works, but its fairly high-level: eejournal.com/article/20080826_vmm If I can find the original article posted anywhere I'll come back and leave a link here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.