mirror of
https://github.com/MiSTer-devel/InputTest_MiSTer.git
synced 2026-05-17 03:03:52 +00:00
Merge pull request #3 from alanswx/main
Fixes for cross platform and top to emu change
This commit is contained in:
@@ -46,7 +46,7 @@ endif
|
||||
|
||||
CFLAGS += $(CC_OPT) $(CC_DEFINE) -Iimgui
|
||||
LDFLAGS = $(LIBS)
|
||||
EXE = ./obj_dir/Vtop
|
||||
EXE = ./obj_dir/Vemu
|
||||
V_OPT = -O3 --x-assign fast --x-initial fast --noassert
|
||||
CC_OPT = -O
|
||||
#V_OPT =
|
||||
@@ -70,7 +70,7 @@ C_SRC = \
|
||||
sim_main.cpp \
|
||||
sim/sim_bus.cpp sim/sim_clock.cpp sim/sim_console.cpp sim/sim_video.cpp sim/sim_input.cpp \
|
||||
sim/imgui/imgui_impl_sdl.cpp sim/imgui/imgui_impl_opengl2.cpp sim/imgui/imgui_draw.cpp sim/imgui/imgui_widgets.cpp sim/imgui/imgui_tables.cpp sim/imgui/imgui.cpp sim/imgui/ImGuiFileDialog.cpp
|
||||
VOUT = obj_dir/Vtop.cpp
|
||||
VOUT = obj_dir/Vemu.cpp
|
||||
|
||||
all: $(EXE)
|
||||
|
||||
@@ -78,11 +78,11 @@ $(VOUT): $(V_SRC) Makefile
|
||||
$V -cc $(V_OPT) -LDFLAGS "$(LDFLAGS) " -exe --trace --Mdir ./obj_dir $(V_DEFINE) $(V_INC) $(TOP) -CFLAGS $(CFLAGS) $(V_SRC) $(C_SRC)
|
||||
|
||||
$(EXE): $(VOUT) $(C_SRC)
|
||||
# (cd obj_dir; make OPT="-fauto-inc-dec -fdce -fdefer-pop -fdse -ftree-ccp -ftree-ch -ftree-fre -ftree-dce -ftree-dse" -f Vtop.mk)
|
||||
(cd obj_dir; make -f Vtop.mk)
|
||||
# (cd obj_dir; make OPT="-fauto-inc-dec -fdce -fdefer-pop -fdse -ftree-ccp -ftree-ch -ftree-fre -ftree-dce -ftree-dse" -f Vemu.mk)
|
||||
(cd obj_dir; make -f Vemu.mk)
|
||||
|
||||
fast:
|
||||
(cd obj_dir; rm -f *.o ; make OPT="-fcompare-elim -fcprop-registers -fguess-branch-probability -fauto-inc-dec -fif-conversion2 -fif-conversion -fipa-pure-const -fdce -fipa-profile -fipa-reference -fmerge-constants -fsplit-wide-types -fdefer-pop -fdse -ftree-ccp -ftree-ch -ftree-fre -ftree-dce -ftree-dse -ftree-builtin-call-dce -ftree-copyrename -ftree-dominator-opts -ftree-forwprop -ftree-phiprop -ftree-sra -ftree-pta -ftree-ter -funit-at-a-time -ftree-bit-ccp -falign-functions -falign-jumps -falign-loops -falign-labels -fcaller-saves -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize -fexpensive-optimizations -fgcse -fgcse-lm -finline-small-functions -findirect-inlining -fipa-sra -foptimize-sibling-calls -fpartial-inlining -fpeephole2 -fregmove -freorder-blocks -freorder-functions -frerun-cse-after-loop -fsched-interblock -fsched-spec -fschedule-insns -fschedule-insns2 -fstrict-aliasing -fstrict-overflow -ftree-switch-conversion -ftree-pre -ftree-vrp" -f Vtop.mk)
|
||||
(cd obj_dir; rm -f *.o ; make OPT="-fcompare-elim -fcprop-registers -fguess-branch-probability -fauto-inc-dec -fif-conversion2 -fif-conversion -fipa-pure-const -fdce -fipa-profile -fipa-reference -fmerge-constants -fsplit-wide-types -fdefer-pop -fdse -ftree-ccp -ftree-ch -ftree-fre -ftree-dce -ftree-dse -ftree-builtin-call-dce -ftree-copyrename -ftree-dominator-opts -ftree-forwprop -ftree-phiprop -ftree-sra -ftree-pta -ftree-ter -funit-at-a-time -ftree-bit-ccp -falign-functions -falign-jumps -falign-loops -falign-labels -fcaller-saves -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize -fexpensive-optimizations -fgcse -fgcse-lm -finline-small-functions -findirect-inlining -fipa-sra -foptimize-sibling-calls -fpartial-inlining -fpeephole2 -fregmove -freorder-blocks -freorder-functions -frerun-cse-after-loop -fsched-interblock -fsched-spec -fschedule-insns -fschedule-insns2 -fstrict-aliasing -fstrict-overflow -ftree-switch-conversion -ftree-pre -ftree-vrp" -f Vemu.mk)
|
||||
|
||||
clean:
|
||||
rm -f obj_dir/*
|
||||
|
||||
@@ -29,7 +29,7 @@ Size=560,393
|
||||
Collapsed=0
|
||||
|
||||
[Window][CPU Registers]
|
||||
Pos=1349,13
|
||||
Pos=1261,13
|
||||
Size=269,188
|
||||
Collapsed=0
|
||||
|
||||
@@ -58,3 +58,12 @@ Pos=-208,137
|
||||
Size=738,454
|
||||
Collapsed=0
|
||||
|
||||
[Window][Choose File##ChooseFileDlgKey]
|
||||
Pos=60,60
|
||||
Size=639,314
|
||||
Collapsed=0
|
||||
|
||||
[Table][0x5E7B4F09,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
|
||||
@@ -73,9 +73,8 @@
|
||||
<ClCompile Include="sim\sim_console.cpp" />
|
||||
<ClCompile Include="sim\sim_input.cpp" />
|
||||
<ClCompile Include="sim\sim_video.cpp" />
|
||||
<ClCompile Include="obj_dir\Vtop.cpp" />
|
||||
<ClCompile Include="obj_dir\Vtop__Dpi.cpp" />
|
||||
<ClCompile Include="obj_dir\Vtop__Syms.cpp" />
|
||||
<ClCompile Include="obj_dir\Vemu.cpp" />
|
||||
<ClCompile Include="obj_dir\Vemu__Syms.cpp" />
|
||||
<ClCompile Include="sim_main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -18,13 +18,10 @@
|
||||
<ClCompile Include="sim_main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="obj_dir\Vtop.cpp">
|
||||
<ClCompile Include="obj_dir\Vemu.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="obj_dir\Vtop__Dpi.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="obj_dir\Vtop__Syms.cpp">
|
||||
<ClCompile Include="obj_dir\Vemu__Syms.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sim\vinc\verilated.cpp">
|
||||
@@ -63,7 +60,7 @@
|
||||
<ClCompile Include="sim\sim_bus.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="obj_dir\Vtop__Dpi.cpp">
|
||||
<ClCompile Include="obj_dir\Vemu__Dpi.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sim\sim_clock.cpp">
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef _MSC_VER
|
||||
#include <SDL2/SDL.h>
|
||||
const Uint8* m_keyboardState;
|
||||
const Uint8* m_keyboardState_last;
|
||||
#else
|
||||
#define WIN32
|
||||
#include <dinput.h>
|
||||
@@ -72,9 +73,13 @@ void SimInput::Read() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
for (unsigned char k = 0; k < 256; k++) {
|
||||
m_keyboardState_last[k] = m_keyboardState[k];
|
||||
}
|
||||
#else
|
||||
m_keyboardState_last = m_keyboardState;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <verilated.h>
|
||||
#include "Vtop.h"
|
||||
#include "Vemu.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#ifndef _MSC_VER
|
||||
@@ -67,7 +67,7 @@ int multi_step_amount = 1024;
|
||||
|
||||
// Verilog module
|
||||
// --------------
|
||||
Vtop* top = NULL;
|
||||
Vemu* top = NULL;
|
||||
|
||||
vluint64_t main_time = 0; // Current simulation time.
|
||||
double sc_time_stamp() { // Called by $time in Verilog.
|
||||
@@ -105,7 +105,7 @@ int verilate() {
|
||||
}
|
||||
|
||||
// Output pixels on rising edge of pixel clock
|
||||
if (clk_sys.IsRising() && top->top__DOT__ce_pix ) {
|
||||
if (clk_sys.IsRising() && top->emu__DOT__ce_pix ) {
|
||||
uint32_t colour = 0xFF000000 | top->VGA_B << 16 | top->VGA_G << 8 | top->VGA_R;
|
||||
video.Clock(top->VGA_HB, top->VGA_VB, top->VGA_HS, top->VGA_VS, colour);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ char ps2_timer = 0;
|
||||
int main(int argc, char** argv, char** env) {
|
||||
|
||||
// Create core and initialise
|
||||
top = new Vtop();
|
||||
top = new Vemu();
|
||||
Verilated::commandArgs(argc, argv);
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -247,19 +247,19 @@ int main(int argc, char** argv, char** env) {
|
||||
ImGui::End();
|
||||
|
||||
/*ImGui::Begin("PGROM Editor");
|
||||
mem_edit_1.DrawContents(top->top__DOT__system__DOT__pgrom__DOT__mem, 16384, 0);
|
||||
mem_edit_1.DrawContents(top->emu__DOT__system__DOT__pgrom__DOT__mem, 16384, 0);
|
||||
ImGui::End();
|
||||
ImGui::Begin("CHROM Editor");
|
||||
mem_edit_1.DrawContents(top->top__DOT__system__DOT__chrom__DOT__mem, 2048, 0);
|
||||
mem_edit_1.DrawContents(top->emu__DOT__system__DOT__chrom__DOT__mem, 2048, 0);
|
||||
ImGui::End();*/
|
||||
ImGui::Begin("WKRAM Editor");
|
||||
mem_edit_2.DrawContents(top->top__DOT__system__DOT__wkram__DOT__mem, 16384, 0);
|
||||
mem_edit_2.DrawContents(top->emu__DOT__system__DOT__wkram__DOT__mem, 16384, 0);
|
||||
ImGui::End();
|
||||
//ImGui::Begin("CHRAM Editor");
|
||||
//mem_edit_3.DrawContents(top->top__DOT__system__DOT__chram__DOT__mem, 2048, 0);
|
||||
//mem_edit_3.DrawContents(top->emu__DOT__system__DOT__chram__DOT__mem, 2048, 0);
|
||||
//ImGui::End();
|
||||
//ImGui::Begin("COLRAM Editor");
|
||||
//mem_edit_3.DrawContents(top->top__DOT__system__DOT__colram__DOT__mem, 2048, 0);
|
||||
//mem_edit_3.DrawContents(top->emu__DOT__system__DOT__colram__DOT__mem, 2048, 0);
|
||||
//ImGui::End();
|
||||
|
||||
// File Dialog to load rom
|
||||
@@ -280,8 +280,8 @@ int main(int argc, char** argv, char** env) {
|
||||
|
||||
ImGui::Begin("CPU Registers");
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("PC 0x%04X", top->top__DOT__system__DOT__T80x__DOT__i_tv80_core__DOT__PC);
|
||||
ImGui::Text("ACC 0x%04X", top->top__DOT__system__DOT__T80x__DOT__i_tv80_core__DOT__ACC);
|
||||
ImGui::Text("PC 0x%04X", top->emu__DOT__system__DOT__T80x__DOT__i_tv80_core__DOT__PC);
|
||||
ImGui::Text("ACC 0x%04X", top->emu__DOT__system__DOT__T80x__DOT__i_tv80_core__DOT__ACC);
|
||||
ImGui::End();
|
||||
|
||||
video.UpdateTexture();
|
||||
|
||||
8
verilator/verilate.sh
Normal file → Executable file
8
verilator/verilate.sh
Normal file → Executable file
@@ -1,3 +1,6 @@
|
||||
|
||||
set -e
|
||||
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null ; then
|
||||
verilator -cc -exe --public --compiler msvc +define+SIMULATION=1 --converge-limit 2000 --top-module emu sim.v \
|
||||
../rtl/dpram.v \
|
||||
../rtl/spram.v \
|
||||
@@ -10,3 +13,8 @@ verilator -cc -exe --public --compiler msvc +define+SIMULATION=1 --converge-limi
|
||||
../rtl/tv80/tv80_reg.v \
|
||||
../rtl/tv80/tv80n.v \
|
||||
../rtl/tv80/tv80s.v
|
||||
else
|
||||
echo "not running on windows"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user