undo c struct queues

This commit is contained in:
Redo 2022-11-04 17:22:51 -06:00
parent 898726af35
commit 0cb1ef5540
2 changed files with 19 additions and 29 deletions

View File

@ -210,21 +210,20 @@ function Group.mergeinto(group, group2)
end
-- Logic Critical
function Group.update_net_c(netc, tick)
local state = netc.state_num[0]>0 and 1 or 0
if state ~= netc.state[0] then
netc.state[0] = state
netc.update_tick[0] = tick
function Group.update(net, tick)
local state = net.state_num[0]>0 and 1 or 0
if state ~= net.state[0] then
net.state[0] = state
net.update_tick[0] = tick
local len = netc.num_gates_update[0]-1
local len = net.num_gates_update[0]-1
for i = 0, len do
local gatec = netc.gates_update_c[i]
if gatec and gatec.in_queue[0]==0 then
Simulation.queue_gate_c(GSim, gatec)
local gate = net.gates_update[i+1]
if gate.in_queue[0]==0 then
Simulation.queuegate(GSim, gate)
end
end
local net = Simulation.net_from_netc(GSim, netc)
Simulation.queuegroupfx(GSim, net)
end
end

View File

@ -246,14 +246,10 @@ function Simulation.connectport(sim, port)
end
-- Logic Critical
function Simulation.queue_gate_c(sim, gatec)
sim.gatequeue[sim.num_gatequeue+1] = gatec
sim.num_gatequeue = sim.num_gatequeue + 1
gatec.in_queue[0] = 1
end
function Simulation.queuegate(sim, gate)
Simulation.queue_gate_c(sim, gate.c)
sim.gatequeue[sim.num_gatequeue+1] = gate
sim.num_gatequeue = sim.num_gatequeue + 1
gate.in_queue[0] = 1
end
function Simulation.queuegate_safe(sim, gate)
@ -283,14 +279,10 @@ function Simulation.queuegateinit(sim, gate)
end
-- Logic Critical
function Simulation.queue_net_c(sim, netc)
sim.groupqueue[sim.num_groupqueue+1] = netc
sim.num_groupqueue = sim.num_groupqueue + 1
netc.in_queue[0] = 1
end
function Simulation.queuegroup(sim, net)
Simulation.queue_net_c(sim, net.c)
sim.groupqueue[sim.num_groupqueue+1] = net
sim.num_groupqueue = sim.num_groupqueue + 1
net.in_queue[0] = 1
end
function Simulation.queuegroup_safe(sim, group)
@ -333,9 +325,9 @@ end
-- Logic Critical
function Simulation.ticklogic(sim)
for i = 1, sim.num_groupqueue do
local netc = sim.groupqueue[i]
Group.update_net_c(netc, sim.current_tick)
netc.in_queue[0] = 0
local net = sim.groupqueue[i]
Group.update(net, sim.current_tick)
net.in_queue[0] = 0
sim.groupqueue[i] = nil
end
sim.num_groupqueue = 0
@ -350,8 +342,7 @@ function Simulation.ticklogic(sim)
end
for i = 1, sim.num_gatequeue do
local gatec = sim.gatequeue[i]
local gate = sim.gate_from_gatec(sim, gatec)
local gate = sim.gatequeue[i]
gate.logic(gate)
gate.in_queue[0] = 0
sim.gatequeue[i] = nil