more optimizations: move port states into gates, inline net queue checks
This commit is contained in:
@@ -116,6 +116,7 @@ function Simulation.addgate(sim, gate)
|
||||
|
||||
sim.ngates = sim.ngates + 1
|
||||
|
||||
Gate.preinit(gate)
|
||||
Simulation.queuegateinit(sim, gate)
|
||||
Simulation.queuegate(sim, gate)
|
||||
end
|
||||
@@ -239,7 +240,8 @@ end
|
||||
-- Logic Critical
|
||||
function Simulation.queuegate(sim, gate)
|
||||
if gate.in_queue==0 then
|
||||
table.insert(sim.gatequeue, gate)
|
||||
--table.insert(sim.gatequeue, gate)
|
||||
sim.gatequeue[sim.num_gatequeue+1] = gate
|
||||
sim.num_gatequeue = sim.num_gatequeue + 1
|
||||
gate.in_queue = 1
|
||||
end
|
||||
@@ -265,12 +267,11 @@ end
|
||||
|
||||
-- Logic Critical
|
||||
function Simulation.queuegroup(sim, group)
|
||||
if group.in_queue==0 then
|
||||
--table.insert(sim.groupqueue, group)
|
||||
--if group.in_queue==0 then
|
||||
sim.groupqueue[sim.num_groupqueue+1] = group
|
||||
sim.num_groupqueue = sim.num_groupqueue + 1
|
||||
group.in_queue = 1
|
||||
end
|
||||
--end
|
||||
end
|
||||
|
||||
function Simulation.dequeuegroup(sim, group)
|
||||
@@ -306,7 +307,6 @@ end
|
||||
|
||||
-- Logic Critical
|
||||
function Simulation.ticklogic(sim)
|
||||
--for k, group in ipairs(sim.groupqueue) do
|
||||
local len = sim.num_groupqueue
|
||||
for i = 1, len do
|
||||
local group = sim.groupqueue[i]
|
||||
@@ -323,7 +323,6 @@ function Simulation.ticklogic(sim)
|
||||
sim.tickqueue[sim.current_tick] = nil
|
||||
end
|
||||
|
||||
--for k, gate in ipairs(sim.gatequeue) do
|
||||
local len = sim.num_gatequeue
|
||||
for i = 1, len do
|
||||
local gate = sim.gatequeue[i]
|
||||
|
||||
Reference in New Issue
Block a user