inline Port.setstate; remove unused network codes

This commit is contained in:
Redo0
2021-05-25 20:37:29 -05:00
parent c62d7340b0
commit 09e65faec4
5 changed files with 18 additions and 32 deletions

View File

@@ -6,6 +6,7 @@ function Gate.new(objref, definition)
objref = objref,
definition = definition,
ports = {},
port_nets = {},
in_queue = false,
logic = definition.logic,
}
@@ -18,11 +19,20 @@ function Gate.addport(gate, port)
end
function Gate.getportstate(gate, index)
return gate.ports[index].group.state
return gate.port_nets[index].state
end
function Gate.setportstate(gate, index, state)
Port.setstate(gate.ports[index], state)
local port = gate.ports[index]
if state ~= port.state then
local group = port.group
group.state_num = group.state_num - (port.state and 1 or 0) + (state and 1 or 0)
port.state = state
if (group.state_num>0) ~= group.state then
Simulation.queuegroup(GSim, group)
end
end
end
function Gate.initdata(gate)