make gate queue use c structs
This commit is contained in:
parent
5e0d779600
commit
4f2b9f4e6d
@ -246,15 +246,15 @@ function Simulation.connectport(sim, port)
|
||||
end
|
||||
|
||||
-- Logic Critical
|
||||
function Simulation.queuegate(sim, gate)
|
||||
sim.gatequeue[sim.num_gatequeue+1] = gate
|
||||
function Simulation.queuegate_c(sim, cgate)
|
||||
sim.gatequeue[sim.num_gatequeue + 1] = cgate
|
||||
sim.num_gatequeue = sim.num_gatequeue + 1
|
||||
gate.in_queue[0] = 1
|
||||
cgate.in_queue[0] = 1
|
||||
end
|
||||
|
||||
function Simulation.queuegate_c(sim, cgate)
|
||||
local gate = Simulation.gate_from_cgate(sim, cgate)
|
||||
Simulation.queuegate(sim, gate)
|
||||
function Simulation.queuegate(sim, gate)
|
||||
local cgate = gate.c
|
||||
Simulation.queuegate_c(sim, cgate)
|
||||
end
|
||||
|
||||
function Simulation.queuegate_safe(sim, gate)
|
||||
@ -263,6 +263,7 @@ function Simulation.queuegate_safe(sim, gate)
|
||||
end
|
||||
end
|
||||
|
||||
-- Logic Critical
|
||||
function Simulation.queuegatelater(sim, gate, delay)
|
||||
local tick = sim.current_tick + delay
|
||||
if sim.tickqueue[tick] == nil then
|
||||
@ -273,7 +274,6 @@ end
|
||||
|
||||
function Simulation.queuegateinput(sim, gate, argv)
|
||||
sim.inputqueue = sim.inputqueue or {}
|
||||
--sim.inputqueue[gate] = argv
|
||||
sim.inputqueue[gate] = sim.inputqueue[gate] or {}
|
||||
table.insert(sim.inputqueue[gate], argv)
|
||||
end
|
||||
@ -307,7 +307,7 @@ end
|
||||
|
||||
function Simulation.dequeuegate(sim, gate)
|
||||
if gate.in_queue[0]~=0 then
|
||||
array_remove(sim.gatequeue, gate, true)
|
||||
array_remove(sim.gatequeue, gate.c, true)
|
||||
sim.num_gatequeue = sim.num_gatequeue - 1
|
||||
gate.in_queue[0] = 0
|
||||
end
|
||||
@ -348,9 +348,8 @@ function Simulation.ticklogic(sim)
|
||||
end
|
||||
|
||||
for i = 1, sim.num_gatequeue do
|
||||
local gate = sim.gatequeue[i]
|
||||
local cgate = gate.c
|
||||
gate = Simulation.gate_from_cgate(sim, cgate)
|
||||
local cgate = sim.gatequeue[i]
|
||||
local gate = Simulation.gate_from_cgate(sim, cgate)
|
||||
gate.logic(gate)
|
||||
cgate.in_queue[0] = 0
|
||||
sim.gatequeue[i] = nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user