Giter Site home page Giter Site logo

Comments (4)

MarcusTomlinson avatar MarcusTomlinson commented on July 23, 2024

You’re summary is correct, yes.

I considered handling this delay explicitly inside each component, but it seems to me that this is not possible for more complex circuits without rewriting the way Circuit ticks.

This would be my first suggestion. Essentially, in each component’s Process_(), set the output(s) from the result(s) of the previous Process_().

Do you have an example of a complex circuit where this wouldn’t work?

from dspatch.

AndreasAlbert avatar AndreasAlbert commented on July 23, 2024

Thanks for getting back to me so quickly!

I am specifically thinking about a circular dependence like this one:

---------------        -------------
| FIFO         |      | CONSUMER    |
| output: data | ---> | input: data |
| input: pop   | <--- | output: pop |
----------------       -------------

If I add an internal delay as we discuss above, it basically boils down to structuring the Process_ method in each of the components like this:

void Process_(SignalBus const & inputs, SignalBus& outputs){
    // Update output bus based on whatever we calculated last tick
    propagate(outputs);

    // Execute the actual logic of this component,
    // output goes into the internal buffer, 
    // will be propagated next tick
    logic(inputs);
}

Now I think I run into trouble with execution order, because I am forcing the two steps to be executed directly after each other for a given component.
The circuit ticks will end up doing more or less this (pseudocode):

for(auto component: components) {
    component.propagate();
    component.logic();
}

When in reality, I would need this:

    for(auto component: components) {
        component.propagate();
    }
    for(auto component: components) {
        component.logic();
    }

from dspatch.

AndreasAlbert avatar AndreasAlbert commented on July 23, 2024

One way around this dilemma would be to call propagate only on even ticks and logic on odd ticks. That would make sure that correct ordering is conserved. Only hurdle is that it requires signal states to be persistent between ticks. Currently, the signals are being cleared here, here and possibly elsewhere. @MarcusTomlinson would you be open to having this behavior made configurable? Being able to disable the automatic clearing should suffice.

from dspatch.

MarcusTomlinson avatar MarcusTomlinson commented on July 23, 2024

@MarcusTomlinson would you be open to having this behavior made configurable? Being able to disable the automatic clearing should suffice.

Sure, sounds fair. Could you PR this?

from dspatch.

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.