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
|
end
|
||||||
|
|
||||||
-- Logic Critical
|
-- Logic Critical
|
||||||
function Simulation.queuegate(sim, gate)
|
function Simulation.queuegate_c(sim, cgate)
|
||||||
sim.gatequeue[sim.num_gatequeue+1] = gate
|
sim.gatequeue[sim.num_gatequeue + 1] = cgate
|
||||||
sim.num_gatequeue = sim.num_gatequeue + 1
|
sim.num_gatequeue = sim.num_gatequeue + 1
|
||||||
gate.in_queue[0] = 1
|
cgate.in_queue[0] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function Simulation.queuegate_c(sim, cgate)
|
function Simulation.queuegate(sim, gate)
|
||||||
local gate = Simulation.gate_from_cgate(sim, cgate)
|
local cgate = gate.c
|
||||||
Simulation.queuegate(sim, gate)
|
Simulation.queuegate_c(sim, cgate)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Simulation.queuegate_safe(sim, gate)
|
function Simulation.queuegate_safe(sim, gate)
|
||||||
@ -263,6 +263,7 @@ function Simulation.queuegate_safe(sim, gate)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Logic Critical
|
||||||
function Simulation.queuegatelater(sim, gate, delay)
|
function Simulation.queuegatelater(sim, gate, delay)
|
||||||
local tick = sim.current_tick + delay
|
local tick = sim.current_tick + delay
|
||||||
if sim.tickqueue[tick] == nil then
|
if sim.tickqueue[tick] == nil then
|
||||||
@ -273,7 +274,6 @@ end
|
|||||||
|
|
||||||
function Simulation.queuegateinput(sim, gate, argv)
|
function Simulation.queuegateinput(sim, gate, argv)
|
||||||
sim.inputqueue = sim.inputqueue or {}
|
sim.inputqueue = sim.inputqueue or {}
|
||||||
--sim.inputqueue[gate] = argv
|
|
||||||
sim.inputqueue[gate] = sim.inputqueue[gate] or {}
|
sim.inputqueue[gate] = sim.inputqueue[gate] or {}
|
||||||
table.insert(sim.inputqueue[gate], argv)
|
table.insert(sim.inputqueue[gate], argv)
|
||||||
end
|
end
|
||||||
@ -307,7 +307,7 @@ end
|
|||||||
|
|
||||||
function Simulation.dequeuegate(sim, gate)
|
function Simulation.dequeuegate(sim, gate)
|
||||||
if gate.in_queue[0]~=0 then
|
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
|
sim.num_gatequeue = sim.num_gatequeue - 1
|
||||||
gate.in_queue[0] = 0
|
gate.in_queue[0] = 0
|
||||||
end
|
end
|
||||||
@ -348,9 +348,8 @@ function Simulation.ticklogic(sim)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, sim.num_gatequeue do
|
for i = 1, sim.num_gatequeue do
|
||||||
local gate = sim.gatequeue[i]
|
local cgate = sim.gatequeue[i]
|
||||||
local cgate = gate.c
|
local gate = Simulation.gate_from_cgate(sim, cgate)
|
||||||
gate = Simulation.gate_from_cgate(sim, cgate)
|
|
||||||
gate.logic(gate)
|
gate.logic(gate)
|
||||||
cgate.in_queue[0] = 0
|
cgate.in_queue[0] = 0
|
||||||
sim.gatequeue[i] = nil
|
sim.gatequeue[i] = nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user