start adding c structs for gates and ports
This commit is contained in:
@@ -169,13 +169,19 @@ function Simulation.removegate(self, objref)
|
||||
self.ngates = self.ngates - 1
|
||||
end
|
||||
|
||||
local function is_wire(obj)
|
||||
return obj.layer~=nil
|
||||
end
|
||||
|
||||
function Simulation.connectwireat(self, wire, x, y, z)
|
||||
local objs = Simulation.getfromworld(self, x, y, z)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj ~= wire and obj.group ~= nil then
|
||||
if obj.logictype == 0 and Wire.getlayer(obj) == Wire.getlayer(wire) then
|
||||
if is_wire(obj) then -- wire
|
||||
if Wire.getlayer(obj) == Wire.getlayer(wire) then -- same layer
|
||||
Group.addwire(obj.group, wire)
|
||||
elseif obj.logictype == 1 then
|
||||
end
|
||||
else -- port
|
||||
Group.addwire(obj.group, wire)
|
||||
end
|
||||
end
|
||||
@@ -273,13 +279,13 @@ function Simulation.tick(self)
|
||||
self.groupqueue = {}
|
||||
|
||||
for k, gate in pairs(self.initqueue) do
|
||||
gate.definition.init(gate)
|
||||
Gate.init(gate)
|
||||
end
|
||||
self.initqueue = {}
|
||||
|
||||
for gate, inputs in pairs(self.inputqueue) do
|
||||
for inputidx, argv in ipairs(inputs) do
|
||||
gate.definition.input(gate, argv)
|
||||
Gate.input(gate, argv)
|
||||
end
|
||||
end
|
||||
self.inputqueue = {}
|
||||
@@ -292,7 +298,7 @@ function Simulation.tick(self)
|
||||
end
|
||||
|
||||
for k, gate in pairs(self.gatequeue) do
|
||||
gate.definition.logic(gate)
|
||||
Gate.logic(gate)
|
||||
end
|
||||
self.gatequeue = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user