From 7ac9e72d7dc3741cde34a77bcf9957fcedfdab56 Mon Sep 17 00:00:00 2001 From: jimmystones Date: Fri, 28 Jan 2022 17:05:21 +0000 Subject: [PATCH] Fix sim video and cleanup --- verilator/sim/sim_video.cpp | 17 ++++++++--------- verilator/sim_main.cpp | 10 +++------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/verilator/sim/sim_video.cpp b/verilator/sim/sim_video.cpp index 322ef39..2dcd6c7 100644 --- a/verilator/sim/sim_video.cpp +++ b/verilator/sim/sim_video.cpp @@ -412,18 +412,17 @@ void SimVideo::Clock(bool hblank, bool vblank, bool hsync, bool vsync, uint32_t bool vb_falling = (!vblank && last_vblank); bool vb_rising = (vblank && !last_vblank); - // Next line on end of hblank - if (hb_falling) { - // Increment line and reset pixel count - count_line++; - count_pixel = 0; - } - - //else { + if (!vblank) { + // Next line on end of hblank + if (hb_falling) { + // Increment line and reset pixel count + count_line++; + count_pixel = 0; + } if (de) { count_pixel++; } - //} + } //frame_ready = 1; // Reset on rising vsync diff --git a/verilator/sim_main.cpp b/verilator/sim_main.cpp index 9b6fb05..44ea357 100644 --- a/verilator/sim_main.cpp +++ b/verilator/sim_main.cpp @@ -272,7 +272,7 @@ int verilate() if (clk_sys.clk) { bus.AfterEval(); } #ifdef CPU_DEBUG - if (!top->reset ) { + if (!top->reset) { cpu_sync = top->emu__DOT__blockade__DOT__SYNC; unsigned short pc = top->emu__DOT__blockade__DOT__cpu__DOT__core__DOT__r16_pc; @@ -510,13 +510,13 @@ int main(int argc, char** argv, char** env) ImGui::SliderInt("Rotate", &video.output_rotate, -1, 1); ImGui::SameLine(); ImGui::Checkbox("Flip V", &video.output_vflip); ImGui::Text("main_time: %d frame_count: %d sim FPS: %f", main_time, video.count_frame, video.stats_fps); - ImGui::Text("pixel: %06d line: %03d", video.count_pixel, video.count_line); - ImGui::Text("xmax: %04d ymax: %04d", video.stats_xMax, video.stats_yMax); +#ifdef DEBUG_AUDIO //float vol_l = ((signed short)(top->AUDIO_L) / 256.0f) / 256.0f; //float vol_r = ((signed short)(top->AUDIO_R) / 256.0f) / 256.0f; //ImGui::ProgressBar(vol_l + 0.5, ImVec2(200, 16), 0); ImGui::SameLine(); //ImGui::ProgressBar(vol_r + 0.5, ImVec2(200, 16), 0); +#endif // Draw VGA output ImGui::Image(video.texture_id, ImVec2(video.output_width * VGA_SCALE_X, video.output_height * VGA_SCALE_Y)); @@ -541,10 +541,6 @@ int main(int argc, char** argv, char** env) //mem_edit.DrawContents(&top->emu__DOT__blockade__DOT__rom_msb__DOT__mem, 512, 0); //ImGui::End(); - // ImGui::Begin("ROM"); - // memoryEditor_hs.DrawContents(&top->top__DOT__blockade__DOT__MEM_ROM__DOT__ram, 4096, 0); - // ImGui::End(); - video.UpdateTexture(); // Pass inputs to sim