make in_queue int tptre

This commit is contained in:
Redo
2022-11-04 15:32:30 -06:00
parent 7823e413ee
commit f1b909279c
4 changed files with 17 additions and 26 deletions

View File

@@ -6,7 +6,7 @@ Gate = {}
function Gate.new(objref, definition)
local gate = {
-- Logic Critical
in_queue = ffi.new("int"),
in_queue = ffi.new("int[1]"),
port_states = ffi.new("int["..(#definition.ports+1).."]"),
logic = definition.logic,
ports = {},
@@ -27,10 +27,11 @@ end
function Gate.setportstate(gate, index, state)
if state ~= gate.port_states[index] then
local group = gate.port_nets[index]
local net_state_num = gate.port_net_state_nums[index]
group.state_num = group.state_num - gate.port_states[index] + state
gate.port_states[index] = state
if ((group.state_num>0) ~= (group.state==1)) and (group.in_queue==0) then
if ((group.state_num>0) ~= (group.state==1)) and (group.in_queue[0]==0) then
Simulation.queuegroup(GSim, group)
end
end