more optimizations: move port states into gates, inline net queue checks

This commit is contained in:
Redo0
2021-06-05 18:41:50 -05:00
parent 14c61e35d1
commit 19d2e36fd6
6 changed files with 38 additions and 44 deletions

View File

@@ -5,13 +5,8 @@ Group = {}
function Group.new()
local o = {
--state = ffi.new("long long", 0),
state = 0,
--state_num = ffi.new("long long", 0),
state_num = 0,
--in_queue = ffi.new("bool", false),
--in_queue = false,
--in_queue = ffi.new("long long", 0),
in_queue = 0,
gates_update = {},
num_gates_update = 0,
@@ -44,7 +39,9 @@ function Group.addwire(group, wire)
Wire.setgroup(wire, group)
Wire.update(wire)
Simulation.queuegroup(GSim, group)
if group.in_queue==0 then
Simulation.queuegroup(GSim, group)
end
end
end
end
@@ -186,11 +183,9 @@ function Group.setstate(group, state)
group.state = state
group.update_tick = sim.current_tick
--for k, gate in ipairs(group.gates_update) do
local len = group.num_gates_update
for i = 1, len do
local gate = group.gates_update[i]
Simulation.queuegate(sim, gate)
Simulation.queuegate(sim, group.gates_update[i])
end
Simulation.queuegroupfx(sim, group)