make nets keep list of updated gates instead of ports

This commit is contained in:
Redo0
2021-05-25 20:22:02 -05:00
parent e92cc50186
commit c62d7340b0
7 changed files with 82 additions and 80 deletions

View File

@@ -15,20 +15,6 @@ PortDirections = {
Port = {}
FFI.cdef[[
struct Gate;
struct Net;
struct Port {
bool state;
char type;
char direction;
bool causeupdate;
int position[3];
struct Gate* gate;
struct Net* group;
};
]]
function Port.new(type, direction, position, causeupdate)
local o = {
type = type,
@@ -44,13 +30,13 @@ end
function Port.setstate(port, state) -- output state
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 state then
Port.getgroup(port).state_num = Port.getgroup(port).state_num + 1
else
Port.getgroup(port).state_num = Port.getgroup(port).state_num - 1
if (group.state_num>0) ~= group.state then
Simulation.queuegroup(GSim, group)
end
Simulation.queuegroup(GSim, Port.getgroup(port))
end
end