make sim global; make nonessential queues optional
This commit is contained in:
17
sim/port.lua
17
sim/port.lua
@@ -29,7 +29,7 @@ FFI.cdef[[
|
||||
};
|
||||
]]
|
||||
|
||||
function Port.new(self, type, direction, position, causeupdate, sim)
|
||||
function Port.new(self, type, direction, position, causeupdate)
|
||||
local o = {
|
||||
type = type,
|
||||
direction = direction,
|
||||
@@ -38,7 +38,6 @@ function Port.new(self, type, direction, position, causeupdate, sim)
|
||||
state = false,
|
||||
gate = nil,
|
||||
group = nil,
|
||||
sim = sim,
|
||||
}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
@@ -53,7 +52,7 @@ function Port.setstate(port, state) -- output state
|
||||
else
|
||||
Port.getgroup(port).state_num = Port.getgroup(port).state_num - 1
|
||||
end
|
||||
Simulation.queuegroup(Port.getsim(port), Port.getgroup(port))
|
||||
Simulation.queuegroup(GSim, Port.getgroup(port))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -66,14 +65,14 @@ function Port.isrising(port)
|
||||
if port.group == nil then
|
||||
return false
|
||||
end
|
||||
return port.group.state and (port.group.updatetick == Port.getsim(port).currenttick)
|
||||
return port.group.state and (port.group.updatetick == GSim.currenttick)
|
||||
end
|
||||
|
||||
function Port.isfalling(port)
|
||||
if port.group == nil then
|
||||
return false
|
||||
end
|
||||
return port.group.state == false and (port.updatetick == Port.getsim(port).currenttick)
|
||||
return port.group.state == false and (port.updatetick == GSim.currenttick)
|
||||
end
|
||||
|
||||
function Port.getgate(port)
|
||||
@@ -99,11 +98,3 @@ end
|
||||
function Port.getstate(port)
|
||||
return port.state
|
||||
end
|
||||
|
||||
function Port.getinputstate(port)
|
||||
return Port.getgroup(port).state
|
||||
end
|
||||
|
||||
function Port.getsim(port)
|
||||
return port.sim
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user