undo c struct queues
This commit is contained in:
		| @@ -210,21 +210,20 @@ function Group.mergeinto(group, group2) | |||||||
| end | end | ||||||
|  |  | ||||||
| -- Logic Critical | -- Logic Critical | ||||||
| function Group.update_net_c(netc, tick) | function Group.update(net, tick) | ||||||
| 	local state = netc.state_num[0]>0 and 1 or 0 | 	local state = net.state_num[0]>0 and 1 or 0 | ||||||
| 	if state ~= netc.state[0] then | 	if state ~= net.state[0] then | ||||||
| 		netc.state[0] = state | 		net.state[0] = state | ||||||
| 		netc.update_tick[0] = tick | 		net.update_tick[0] = tick | ||||||
| 		 | 		 | ||||||
| 		local len = netc.num_gates_update[0]-1 | 		local len = net.num_gates_update[0]-1 | ||||||
| 		for i = 0, len do | 		for i = 0, len do | ||||||
| 			local gatec = netc.gates_update_c[i] | 			local gate = net.gates_update[i+1] | ||||||
| 			if gatec and gatec.in_queue[0]==0 then | 			if gate.in_queue[0]==0 then | ||||||
| 				Simulation.queue_gate_c(GSim, gatec) | 				Simulation.queuegate(GSim, gate) | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 		 | 		 | ||||||
| 		local net = Simulation.net_from_netc(GSim, netc) |  | ||||||
| 		Simulation.queuegroupfx(GSim, net) | 		Simulation.queuegroupfx(GSim, net) | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
|   | |||||||
| @@ -246,14 +246,10 @@ function Simulation.connectport(sim, port) | |||||||
| end | end | ||||||
|  |  | ||||||
| -- Logic Critical | -- Logic Critical | ||||||
| function Simulation.queue_gate_c(sim, gatec) |  | ||||||
| 	sim.gatequeue[sim.num_gatequeue+1] = gatec |  | ||||||
| 	sim.num_gatequeue = sim.num_gatequeue + 1 |  | ||||||
| 	gatec.in_queue[0] = 1 |  | ||||||
| end |  | ||||||
|  |  | ||||||
| function Simulation.queuegate(sim, gate) | function Simulation.queuegate(sim, gate) | ||||||
| 	Simulation.queue_gate_c(sim, gate.c) | 	sim.gatequeue[sim.num_gatequeue+1] = gate | ||||||
|  | 	sim.num_gatequeue = sim.num_gatequeue + 1 | ||||||
|  | 	gate.in_queue[0] = 1 | ||||||
| end | end | ||||||
|  |  | ||||||
| function Simulation.queuegate_safe(sim, gate) | function Simulation.queuegate_safe(sim, gate) | ||||||
| @@ -283,14 +279,10 @@ function Simulation.queuegateinit(sim, gate) | |||||||
| end | end | ||||||
|  |  | ||||||
| -- Logic Critical | -- Logic Critical | ||||||
| function Simulation.queue_net_c(sim, netc) |  | ||||||
| 	sim.groupqueue[sim.num_groupqueue+1] = netc |  | ||||||
| 	sim.num_groupqueue = sim.num_groupqueue + 1 |  | ||||||
| 	netc.in_queue[0] = 1 |  | ||||||
| end |  | ||||||
|  |  | ||||||
| function Simulation.queuegroup(sim, net) | function Simulation.queuegroup(sim, net) | ||||||
| 	Simulation.queue_net_c(sim, net.c) | 	sim.groupqueue[sim.num_groupqueue+1] = net | ||||||
|  | 	sim.num_groupqueue = sim.num_groupqueue + 1 | ||||||
|  | 	net.in_queue[0] = 1 | ||||||
| end | end | ||||||
|  |  | ||||||
| function Simulation.queuegroup_safe(sim, group) | function Simulation.queuegroup_safe(sim, group) | ||||||
| @@ -333,9 +325,9 @@ end | |||||||
| -- Logic Critical | -- Logic Critical | ||||||
| function Simulation.ticklogic(sim) | function Simulation.ticklogic(sim) | ||||||
| 	for i = 1, sim.num_groupqueue do | 	for i = 1, sim.num_groupqueue do | ||||||
| 		local netc = sim.groupqueue[i] | 		local net = sim.groupqueue[i] | ||||||
| 		Group.update_net_c(netc, sim.current_tick) | 		Group.update(net, sim.current_tick) | ||||||
| 		netc.in_queue[0] = 0 | 		net.in_queue[0] = 0 | ||||||
| 		sim.groupqueue[i] = nil | 		sim.groupqueue[i] = nil | ||||||
| 	end | 	end | ||||||
| 	sim.num_groupqueue = 0 | 	sim.num_groupqueue = 0 | ||||||
| @@ -350,8 +342,7 @@ function Simulation.ticklogic(sim) | |||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	for i = 1, sim.num_gatequeue do | 	for i = 1, sim.num_gatequeue do | ||||||
| 		local gatec = sim.gatequeue[i] | 		local gate = sim.gatequeue[i] | ||||||
| 		local gate = sim.gate_from_gatec(sim, gatec) |  | ||||||
| 		gate.logic(gate) | 		gate.logic(gate) | ||||||
| 		gate.in_queue[0] = 0 | 		gate.in_queue[0] = 0 | ||||||
| 		sim.gatequeue[i] = nil | 		sim.gatequeue[i] = nil | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Redo
					Redo