void scverify_top::generate_reset() { static bool first = true; if (first || sc_time_stamp() == SC_ZERO_TIME) { setup_debug(); first = false; rst.write(SC_LOGIC_1); reset_deactivation_event.notify(40.0, SC_NS); TLS_en.write(SC_LOGIC_1); } else { input_a_transactor->reset_streams(); input_b_transactor->reset_streams(); output_transactor->reset_streams(); rst.write(SC_LOGIC_0); } }
// Draws one frame then returns void run_one_frame() { frame_drawn = 0; while (!frame_drawn) { if (halted || stopped) { long current_cycles = cgb_speed ? 2 : 4; update_timers(current_cycles); sound_add_cycles(current_cycles); inc_serial_cycles(current_cycles); // If Key pressed in "stop" mode, then gameboy is "unstopped" if (stopped) { if(key_pressed()) { stopped = 0; } } if (halted) { update_graphics(current_cycles); } } else if (!(halted || stopped)) { current_cycles = 0; current_cycles += exec_opcode(skip_bug); } cycles += current_cycles; #ifdef EFIAPI if (cycles > 3000) { #else if (cycles > 15000) { #endif quit |= update_keys(); cycles = 0; } skip_bug = handle_interrupts(); if (debug && step_count > 0 && --step_count == 0) { int flags = get_command(); step_count = (flags & STEPS_SET) ? get_steps() : STEPS_OFF; } } } void setup_debug() { if (debug) { int flags = get_command(); step_count = (flags & STEPS_SET) ? get_steps() : STEPS_OFF; breakpoint = (flags & BREAKPOINT_SET) ? get_breakpoint() : BREAKPOINT_OFF; } } void run() { log_message(LOG_INFO, "About to setup debug\n"); setup_debug(); log_message(LOG_INFO, "About to run\n"); while(!quit) { run_one_frame(); } }