make net update use c structT
This commit is contained in:
parent
bb66be2083
commit
7d0dcc53a2
@ -213,15 +213,17 @@ end
|
|||||||
|
|
||||||
-- Logic Critical
|
-- Logic Critical
|
||||||
function Group.update(net, tick)
|
function Group.update(net, tick)
|
||||||
local state = net.state_num[0]>0 and 1 or 0
|
local cnet = net.c
|
||||||
if state ~= net.state[0] then
|
local state = cnet.state_num[0]>0 and 1 or 0
|
||||||
net.state[0] = state
|
if state ~= cnet.state[0] then
|
||||||
net.update_tick[0] = tick
|
cnet.state[0] = state
|
||||||
|
cnet.update_tick[0] = tick
|
||||||
|
|
||||||
local len = net.num_gates_update[0]-1
|
local len = cnet.num_gates_update[0]-1
|
||||||
for i = 0, len do
|
for i = 0, len do
|
||||||
local gate = net.gates_update[i+1]
|
local cgate = cnet.gates_update_c[i]
|
||||||
if gate.in_queue[0]==0 then
|
if cgate.in_queue[0]==0 then
|
||||||
|
local gate = Simulation.gate_from_cgate(sim, cgate)
|
||||||
Simulation.queuegate(GSim, gate)
|
Simulation.queuegate(GSim, gate)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -415,10 +415,10 @@ function Simulation.remove_net(sim, net)
|
|||||||
sim.nets[net.id] = nil
|
sim.nets[net.id] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function Simulation.net_from_netc(sim, netc)
|
function Simulation.net_from_cnet(sim, cnet)
|
||||||
return sim.nets[netc.id] or error("no net for id "..netc.id)
|
return sim.nets[cnet.id] or error("no net for id "..cnet.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Simulation.gate_from_gatec(sim, gatec)
|
function Simulation.gate_from_cgate(sim, cgate)
|
||||||
return sim.gates[gatec.objref] or error("no gate for objref "..gatec.objref)
|
return sim.gates[cgate.objref] or error("no gate for objref "..cgate.objref)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user