Giter Site home page Giter Site logo

Comments (6)

michael-etzkorn avatar michael-etzkorn commented on September 24, 2024

Couldn't you simply add c.clock.step() to the end of your test for this?

from chiseltest.

KasperHesse avatar KasperHesse commented on September 24, 2024

Obviously that's a solution for tests that work, but for tests that fail, I can't find a way to inject a clock cycle when expect fails and raises an exception.

from chiseltest.

michael-etzkorn avatar michael-etzkorn commented on September 24, 2024

Ah, I see

from chiseltest.

ekiwi avatar ekiwi commented on September 24, 2024

I think this would be a good feature. However, there are some problems that we would have to solve.

First, we need to distinguish between:

  1. a failure because of an expect and
  2. a failure because an assert or stop statement in the circuit fired.

In case 2, the problem is that the VCS and IVerilog backends will just immediately kill the simulator execution and there isn't really a good way for us to continue the simulation, unless there is an appropriate option for each simulator. On Treadle and Verilator it should be doable to continue executing even after an assertion fires. This is something we worked to enable last summer.

Case 1 is easier because we control the failure in software. I think adding a step around here might work:

. I.e., Context().env.checkpoint() will potentially want to throw an exception and in that case we would have to step once before actually throwing it.

However, there could be some unintended side effects of doing an extra clock step at the end of the test. I am mostly concerned about what should happen if a assert or printf statement in the circuit is active. That way, the user would get shown a printout from a cycle after the test failed which might be confusing. Do you all have any thoughts on what the behavior should be?

from chiseltest.

KasperHesse avatar KasperHesse commented on September 24, 2024

I definitely think the circuit should be "idle", such that assert/printf statements do not get toggled. Otherwise, it might muddy the printout in the console

I don't know much about the structure of VCD files, but would it be possible to modify the generated file post-fact, simply extending all waves by one clock cycle?

from chiseltest.

ekiwi avatar ekiwi commented on September 24, 2024

I definitely think the circuit should be "idle", such that assert/printf statements do not get toggled. Otherwise, it might muddy the printout in the console

That will be hard to do in a simulator independent way. However, we might be able to only add this feature for Verilator and Treadle. Feel free to get started on a PR. I won't have time to actually work on any improvements, but I should be free enough to review a PR.

I don't know much about the structure of VCD files, but would it be possible to modify the generated file post-fact, simply extending all waves by one clock cycle?

That could work for VCDs, but we also support LXT, FST and FSDB (for some simulators).

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.