inline Port.setstate; remove unused network codes
This commit is contained in:
14
sim/gate.lua
14
sim/gate.lua
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user