add debug prints to c logic
This commit is contained in:
parent
8c16498ec6
commit
a2df8dbf96
@ -1,4 +1,5 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct Net;
|
||||
@ -31,7 +32,7 @@ struct Net {
|
||||
#define DLL __attribute__((visibility("default")))
|
||||
#define GATEFUNCTYPE
|
||||
|
||||
typedef void(*GateFunc)(const struct Gate* const);
|
||||
typedef void(*GateFunc)(const struct Gate* const gate);
|
||||
|
||||
struct Net** net_queue;
|
||||
int* num_net_queue;
|
||||
@ -76,6 +77,7 @@ DLL void sim_update_gates() {
|
||||
for(int i=0; i<*num_gate_queue; i++) {
|
||||
struct Gate* gate = gate_queue[i];
|
||||
if(gate->logic_function != 0) {
|
||||
printf("gatelogic %i", gate->logic_function);
|
||||
sim_dequeue_gate(i);
|
||||
sim_logic_functions[gate->logic_function](gate);
|
||||
i--;
|
||||
@ -117,6 +119,7 @@ FAST void sim_update_net(const struct Net* const net) {
|
||||
////
|
||||
|
||||
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]);
|
||||
}
|
||||
FAST int sim_gate_get_port_rising(const struct Gate* const gate, const int port) {
|
||||
@ -126,7 +129,9 @@ 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));
|
||||
}
|
||||
FAST void sim_gate_set_port(const struct Gate* const gate, const int port, const int state) {
|
||||
printf("setport %i=%i", port, state);
|
||||
if(state != gate->port_states[port]) {
|
||||
printf(" statediff\n");
|
||||
*(gate->port_net_state_num[port]) += state - gate->port_states[port];
|
||||
gate->port_states[port] = state;
|
||||
|
||||
@ -134,6 +139,7 @@ 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_in_queue[port]) )
|
||||
) {
|
||||
printf(" queuenet\n");
|
||||
sim_queue_net(gate->port_nets_c[port]);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
4304
sim/dump.txt
4304
sim/dump.txt
File diff suppressed because it is too large
Load Diff
@ -368,6 +368,7 @@ function Simulation.ticklogic(sim)
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user