mortbopet / VSRTL

Visual Simulation of Register Transfer Logic
MIT License
87 stars 17 forks source link

Make propagation algorithm traverse circuit only one #10

Closed mortbopet closed 5 years ago

mortbopet commented 5 years ago

Currently, the entire circuit is visited by the register propagation algorithm each time the circuit is clocked. This is redundant, given that the register propagation algorithm may push components on to a stack in the order of which the algorithm deems that components may be propagated in a correct order.

Component::propagateComponent() as well as Port::propagate() should be rewritten in such a way as to traverse the graph, but also push $this onto a stack (owned by the Design) when it is allowed to propagate itself. In this way, this stack may be traversed in the order of which the elements was added, to allow for clocking the circuit in O(c+p) where c = number of components and p = number of ports.