Re: [myhdl-list] Re: co-simulation: vpi file
Brought to you by:
jandecaluwe
From: <dan...@we...> - 2005-12-12 08:39:02
|
George Pantazopoulos wrote: > > Would you recommend that I transistion to cver? Which has the more active > development and community? > I was able to install cver under cygwin just fine, however, when trying to run the PLI examples, ran into some problems. It basically has to do that you have to run a certain (older) version of cygwin in order to get it going. On this page: http://www.pragmatic-c.com/gpl-cver/windows.htm I found this link to a file, that has the details about it: "To use the PLI on Cygwin please read the README in tests_and_examples/examples.vpi." > Also, I got my own myHDL/cosim unit tests to pass by inserting yield > delay(10) statements between a signal changing and the time I do a > assertEqual() on it. Also, adding delay(10) to the very beginning of each > test function seemed to help some cases. It seems like somewhat of a > kludge, though. Is that the right thing to do? What are the guidelines for > this sort of thing? You did mention not to compare at time 0. Did you mean > time 0 from the start of the entire simulation? Or did you mean time 0 > from the start of each signal changing? I ran into that too. Actually a delay(1) is already sufficient. I believe this has to do with the nature of simulating a flip-flop behavior and you will find that in every HDL simulator. Consider the following statement in HDL simulation. yield clk.posedge a.next = input b.next = a In software programming a and b would have the same value. In HDL b will get the result of a one clock cycle later. In the simulation the decision is made at the positive edge of the clock. Consider this as the point when time stands still in the simulator. Now the simulator needs to make a decision about the assignments. For the assignments it takes the values it last knew, which is one timestep before the positive edge. It does the assignments and turns time on again. Now you are one timestep after the positive edge and the values would be available for assignment. As you want to look at the values, this is the time you want to be at to get the correct values. I hope I explained that correct. Anyone please correct me if I am wrong. There is actually a book, I found good in explaining writing testbenches, co-simulation, etc. It also talks about different types of simulators. Writing Testbenches, 2nd edition by Janick Bergeron Kluwer Academic Publishers Cheers, Guenter |