start adding c structs for gates and ports

This commit is contained in:
Redo0
2021-05-25 14:54:26 -05:00
parent be2df1ef33
commit 8561940777
7 changed files with 86 additions and 43 deletions

View File

@@ -1,6 +1,14 @@
Gate = {}
FFI.cdef[[
struct Gate {
int objref;
int definition_objref;
struct Port ports[1];
};
]]
function Gate.new(self, objref, definition, sim)
local o = {
objref = objref,
@@ -57,3 +65,21 @@ end
function Gate.getsim(gate)
return gate.sim
end
function Gate.getdefinition(gate)
return gate.definition
end
-- Logic functions
function Gate.init(gate)
Gate.getdefinition(gate).init(gate)
end
function Gate.logic(gate)
Gate.getdefinition(gate).logic(gate)
end
function Gate.input(gate, argv)
Gate.getdefinition(gate).input(gate, argv)
end