Giter Site home page Giter Site logo

Dump verilog testbench about chiseltest HOT 5 OPEN

ucb-bar avatar ucb-bar commented on June 5, 2024
Dump verilog testbench

from chiseltest.

Comments (5)

edwardcwang avatar edwardcwang commented on June 5, 2024

See #60. In general, translating arbitrary Scala code, which is what a testers2 program is, to Verilog is not really feasible or desirable.

from chiseltest.

ducky64 avatar ducky64 commented on June 5, 2024

To expand on that answer a bit more:

  • Testbenches written in testers2 are nonsynthesizable, you're essentially writing a Scala program that interfaces with a simulator through peek and poke operations. So generating a equivalent Verilog testbench in the general case is somewhere between impossible and very difficult.
  • If you just need Verilator simulating directly Chisel elaborated RTL, that is currently supported. See example test cases at https://github.com/ucb-bar/chisel-testers2/blob/master/src/test/scala/chisel3/experimental/tests/VerilatorBasicTests.scala
  • If you need Verilator on your post-syn, that's on the roadmap (see #60). I don't have an ETA.
  • If your test reduces down to basically a static testvector, that is, the test control flow does not depend on the circuit state, it is theoretically possible to dump that testvector to a Verilog nonsynthesizable harness. Adding primitives like waiting for a signal state might allow a small amount of dynamic control for common operations, like waiting on a ready signal. But this isn't on the roadmap, since I think #60 gets you most of the way there?
    • More interesting than having everything generate down into pure Verilog might be synthesizing test cases onto a FPGA without needing Scala (and a PC host, with associated potentially slow communications) in the loop, for very long test cases. But this is also not on the roadmap, so maybe wayyy future work.
  • Otherwise I'd be interested in hearing about your use case and discussing potential solutions.

from chiseltest.

ShuyunJia avatar ShuyunJia commented on June 5, 2024

For post-syn simulation without timing check, I think the blackbox solution in #60 is good enough.

For post-simulation with sdf annotation, however, I have to switch to vcs or ncsim for timing check. It's when a verilog testbench is needed. Usually we don't need all the testcases for post-timing simulation, just the basic ones covering timing paths. From my experience in commercial chips development, static vector test cases are ok for a post-timing simulation. That's why I think a straighforward dumping to nonsynthesizable verilog would be helpful.

from chiseltest.

ducky64 avatar ducky64 commented on June 5, 2024

That makes sense. Architecture-wise, it should be possible to create a backend that dumps poke and delays, and it was a theoretical consideration during the design phase. I don't have the bandwidth to build it in the near future, but if you'd like to build it, we can discuss how to architect such a system to integrate with everything else.

Alternatively, since VCD dumping is a currently existing feature, would it be simpler to build a testharness by parsing VCD dumps?

Also, it's worth noting that the testbench semantics are zero-delay. I don't know if that complicates integration with timing checks,

from chiseltest.

ShuyunJia avatar ShuyunJia commented on June 5, 2024

I prefer a straightforward verilog dumping since it is much more intuitive.
When annotated with sdf, vcs would know how to specify and check the timing inside
I submit a draft pr #95, which is similiar to the implementation in https://github.com/ucb-bar/dsptools.
In this pr, the verilog is dumped line-by-line with the peek-poke execution order.
The fork-join is ignored here. When several threads are available, the dumped vector is in the actual execution order of these threads.
The difficult part is to translate the while keyword, I have to introduce a new method called waitAndStep here.
Maybe you can give suggestions on it.

from chiseltest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.