make sim use proper OOP

This commit is contained in:
Redo0
2021-05-25 14:18:13 -05:00
parent 0963ef8ca8
commit be2df1ef33
8 changed files with 74 additions and 56 deletions

View File

@@ -38,18 +38,22 @@ function Gate.getportisrising(self, index)
return Port.isrising(self.ports[index])
end
function Gate:getportisfalling(index)
function Gate.getportisfalling(self, index)
return Port.isfalling(self.ports[index])
end
function Gate.cb(gate, ...)
Simulation.queuecallback(gate.sim, gate, ...)
Simulation.queuecallback(Gate.getsim(gate), gate, ...)
end
function Gate.queue(self, delay)
Simulation.queuegatelater(self.sim, self, delay)
function Gate.queue(gate, delay)
Simulation.queuegatelater(Gate.getsim(gate), gate, delay)
end
function Gate.gettick(gate)
return gate.sim.currenttick
return Gate.getsim(gate).currenttick
end
function Gate.getsim(gate)
return gate.sim
end