fix bug and remove prints
This commit is contained in:
parent
042503d87d
commit
1787444b72
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
struct Net;
|
struct Net;
|
||||||
@ -74,12 +73,11 @@ FAST void sim_dequeue_gate(const int i) {
|
|||||||
(*num_gate_queue)--;
|
(*num_gate_queue)--;
|
||||||
}
|
}
|
||||||
DLL void sim_update_gates() {
|
DLL void sim_update_gates() {
|
||||||
printf("gatequeue=%i\n", *num_gate_queue);
|
|
||||||
for(int i=0; i<*num_gate_queue; i++) {
|
for(int i=0; i<*num_gate_queue; i++) {
|
||||||
struct Gate* gate = gate_queue[i];
|
struct Gate* gate = gate_queue[i];
|
||||||
if(gate->logic_function != 0) {
|
if(gate->logic_function != 0) {
|
||||||
printf("gatelogic %i %i\n", gate->logic_function, gate->objref);
|
|
||||||
sim_dequeue_gate(i);
|
sim_dequeue_gate(i);
|
||||||
|
*(gate->in_queue) = 0;
|
||||||
sim_logic_functions[gate->logic_function](gate);
|
sim_logic_functions[gate->logic_function](gate);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@ -104,16 +102,13 @@ FAST void sim_queue_net(const struct Net* const net) {
|
|||||||
|
|
||||||
FAST void sim_update_net(const struct Net* const net) {
|
FAST void sim_update_net(const struct Net* const net) {
|
||||||
int state = *(net->state_num) > 0;
|
int state = *(net->state_num) > 0;
|
||||||
printf("updatenet %i\n", state);
|
|
||||||
if(state != *(net->state)) {
|
if(state != *(net->state)) {
|
||||||
printf(" statediff\n");
|
|
||||||
*(net->state) = state;
|
*(net->state) = state;
|
||||||
*(net->update_tick) = *current_tick;
|
*(net->update_tick) = *current_tick;
|
||||||
|
|
||||||
for(int i=0; i<*(net->num_gates_update); i++) {
|
for(int i=0; i<*(net->num_gates_update); i++) {
|
||||||
struct Gate* gate = net->gates_update_c[i];
|
struct Gate* gate = net->gates_update_c[i];
|
||||||
if(!*(gate->in_queue)) {
|
if(!*(gate->in_queue)) {
|
||||||
printf(" queuegate %i\n", gate->objref);
|
|
||||||
sim_queue_gate(gate);
|
sim_queue_gate(gate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +118,6 @@ FAST void sim_update_net(const struct Net* const net) {
|
|||||||
////
|
////
|
||||||
|
|
||||||
FAST int sim_gate_get_port(const struct Gate* const gate, const int port) {
|
FAST int sim_gate_get_port(const struct Gate* const gate, const int port) {
|
||||||
printf("getport %i\n", port);
|
|
||||||
return *(gate->port_net_state[port]);
|
return *(gate->port_net_state[port]);
|
||||||
}
|
}
|
||||||
FAST int sim_gate_get_port_rising(const struct Gate* const gate, const int port) {
|
FAST int sim_gate_get_port_rising(const struct Gate* const gate, const int port) {
|
||||||
@ -133,9 +127,7 @@ FAST int sim_gate_get_port_falling(const struct Gate* const gate, const int port
|
|||||||
return (!*(gate->port_net_state[port])) && ((*(gate->port_nets_c[port]->update_tick) == *current_tick));
|
return (!*(gate->port_net_state[port])) && ((*(gate->port_nets_c[port]->update_tick) == *current_tick));
|
||||||
}
|
}
|
||||||
FAST void sim_gate_set_port(const struct Gate* const gate, const int port, const int state) {
|
FAST void sim_gate_set_port(const struct Gate* const gate, const int port, const int state) {
|
||||||
printf("setport %i=%i\n", port, state);
|
|
||||||
if(state != gate->port_states[port]) {
|
if(state != gate->port_states[port]) {
|
||||||
printf(" statediff\n");
|
|
||||||
*(gate->port_net_state_num[port]) += state - gate->port_states[port];
|
*(gate->port_net_state_num[port]) += state - gate->port_states[port];
|
||||||
gate->port_states[port] = state;
|
gate->port_states[port] = state;
|
||||||
|
|
||||||
@ -143,7 +135,6 @@ FAST void sim_gate_set_port(const struct Gate* const gate, const int port, const
|
|||||||
( (*(gate->port_net_state_num[port]) > 0) != *(gate->port_net_state[port]) ) &&
|
( (*(gate->port_net_state_num[port]) > 0) != *(gate->port_net_state[port]) ) &&
|
||||||
( !*(gate->port_net_in_queue[port]) )
|
( !*(gate->port_net_in_queue[port]) )
|
||||||
) {
|
) {
|
||||||
printf(" queuenet\n");
|
|
||||||
sim_queue_net(gate->port_nets_c[port]);
|
sim_queue_net(gate->port_nets_c[port]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
4378
sim/dump.txt
4378
sim/dump.txt
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user