add c gate sim

This commit is contained in:
Redo
2022-11-05 02:11:48 -06:00
parent 1d465b09f7
commit 02bfb84cb5
7 changed files with 116 additions and 22 deletions

View File

@@ -6,6 +6,7 @@ ffi.cdef [[
struct Net;
void sim_set_data(struct Net** net_queue, int* num_net_queue, struct Gate** gate_queue, int* num_gate_queue, int* current_tick, int queue_max);
void sim_update_nets();
void sim_update_gates();
]]
local csim = ffi.load("compiled_sim.dll")
@@ -350,14 +351,6 @@ end
-- Logic Critical
function Simulation.ticklogic(sim)
-- Now implemented in C
--for i = 0, sim.num_groupqueue[0]-1 do
-- local cnet = sim.groupqueue[i]
-- Group.update_c(cnet, sim.current_tick[0])
-- cnet.in_queue[0] = 0
-- sim.groupqueue[i] = nil
--end
--sim.num_groupqueue[0] = 0
csim.sim_update_nets()
if sim.tickqueue[sim.current_tick[0]] ~= nil then
@@ -369,6 +362,7 @@ function Simulation.ticklogic(sim)
sim.tickqueue[sim.current_tick[0]] = nil
end
csim.sim_update_gates() -- handle any leftover gates, those without c logic functions
for i = 0, sim.num_gatequeue[0]-1 do
local cgate = sim.gatequeue[i]
local gate = Simulation.gate_from_cgate(sim, cgate)