Skip to content

Commit 67cf451

Browse files
committed
Working thing!
1 parent 80f89a5 commit 67cf451

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1811
-3525
lines changed

InputTest.sv

Lines changed: 93 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ module emu
3232
output [7:0] VGA_B,
3333
output VGA_HS,
3434
output VGA_VS,
35+
output VGA_DE, // = ~(VBlank | HBlank)
3536
output VGA_F1,
3637
output [1:0] VGA_SL,
3738
output VGA_SCALER, // Force VGA scaler
3839

3940
input [11:0] HDMI_WIDTH,
4041
input [11:0] HDMI_HEIGHT,
42+
output HDMI_FREEZE,
4143

4244
`ifdef MISTER_FB
4345
// Use framebuffer in DDRAM (USE_FB=1 in qsf)
@@ -164,9 +166,9 @@ assign {SD_SCK, SD_MOSI, SD_CS} = 'Z;
164166
assign {SDRAM_DQ, SDRAM_A, SDRAM_BA, SDRAM_CLK, SDRAM_CKE, SDRAM_DQML, SDRAM_DQMH, SDRAM_nWE, SDRAM_nCAS, SDRAM_nRAS, SDRAM_nCS} = 'Z;
165167
assign {DDRAM_CLK, DDRAM_BURSTCNT, DDRAM_ADDR, DDRAM_DIN, DDRAM_BE, DDRAM_RD, DDRAM_WE} = '0;
166168

167-
assign VGA_SL = 0;
168169
assign VGA_F1 = 0;
169170
assign VGA_SCALER = 0;
171+
assign HDMI_FREEZE = 0;
170172

171173
assign AUDIO_S = 0;
172174
assign AUDIO_L = 0;
@@ -184,8 +186,6 @@ wire [1:0] ar = status[9:8];
184186
assign VIDEO_ARX = (!ar) ? 12'd4 : (ar - 1'd1);
185187
assign VIDEO_ARY = (!ar) ? 12'd3 : 12'd0;
186188

187-
assign LED_USER = copy_in_progress;
188-
189189
`include "build_id.v"
190190
localparam CONF_STR = {
191191
"InputTest;;",
@@ -197,56 +197,118 @@ localparam CONF_STR = {
197197
"V,v",`BUILD_DATE
198198
};
199199

200-
201-
202200
//
203201
// HPS is the module that communicates between the linux and fpga
204202
//
205203
wire [31:0] status;
204+
wire [1:0] buttons;
205+
wire forced_scandoubler;
206+
wire direct_video;
207+
208+
wire ioctl_download;
209+
wire ioctl_upload;
210+
wire ioctl_wr;
211+
wire [24:0] ioctl_addr;
212+
wire [7:0] ioctl_dout;
213+
wire [7:0] ioctl_din;
214+
wire [7:0] ioctl_index;
215+
wire ioctl_wait;
216+
217+
wire [15:0] joystick_0, joystick_1;
218+
219+
wire [21:0] gamma_bus;
206220

207-
hps_io #(.STRLEN(($size(CONF_STR)>>3)) , .PS2DIV(1000), .WIDE(0)) hps_io
221+
hps_io #(.CONF_STR(CONF_STR)) hps_io
208222
(
209223
.clk_sys(clk_sys),
210224
.HPS_BUS(HPS_BUS),
211-
.status(status),
212225

213-
214-
.conf_str(CONF_STR)
215-
226+
.buttons(buttons),
227+
.status(status),
228+
.status_menumask({direct_video}),
229+
230+
.forced_scandoubler(forced_scandoubler),
231+
.direct_video(direct_video),
232+
233+
.ioctl_download(ioctl_download),
234+
.ioctl_upload(ioctl_upload),
235+
.ioctl_wr(ioctl_wr),
236+
.ioctl_addr(ioctl_addr),
237+
.ioctl_dout(ioctl_dout),
238+
.ioctl_din(ioctl_din),
239+
.ioctl_index(ioctl_index),
240+
.ioctl_wait(ioctl_wait),
241+
242+
.joystick_0(joystick_0),
243+
.joystick_1(joystick_1)
216244
);
217-
///////////////////
218-
// PLL - clocks are the most important part of a system
219-
///////////////////////////////////////////////////
220-
wire clk_sys, locked;
245+
246+
247+
//////////////////// CLOCKS ///////////////////
248+
249+
wire clk_sys;
250+
reg ce_pix;
221251

222252
pll pll
223253
(
224254
.refclk(CLK_50M),
225255
.rst(0),
226-
.outclk_0(clk_sys), // 25.116279 Mhz - for the vga pixel clock
227-
.locked(locked)
256+
.outclk_0(clk_sys)
228257
);
229258

230-
///////////////////////////////////////////////////
231259

232-
assign CLK_VIDEO = clk_sys;
233-
assign CE_PIXEL = 1;
260+
/////////////////// CLOCK DIVIDER ////////////////////
234261

235-
///////////////////////////////////////////////////
236-
wire [3:0] r, g, b;
237-
wire vs,hs;
238-
wire ce_pix;
262+
always @(posedge clk_sys) begin
263+
reg div;
264+
div <= div + 1'd1;
265+
ce_pix <= !div;
266+
end
267+
268+
269+
/////////////////// VIDEO ////////////////////
239270
wire hblank, vblank;
271+
wire hs, vs;
240272

241-
soc soc(
242-
.clk_sys(clk_sys), // wrong
243-
.pixel_clock(clk_sys), // wrong
244-
.VGA_HS(VGA_HS),
245-
.VGA_VS(VGA_VS),
246-
.VGA_R(VGA_R),
247-
.VGA_G(VGA_G),
248-
.VGA_B(VGA_B)
273+
wire [7:0] r;
274+
wire [7:0] g;
275+
wire [7:0] b;
276+
wire [23:0] rgb = {r,g,b};
277+
arcade_video #(224,24) arcade_video
278+
(
279+
.*,
280+
.clk_video(clk_sys),
281+
.RGB_in(rgb),
282+
.HBlank(hblank),
283+
.VBlank(vblank),
284+
.HSync(hs),
285+
.VSync(vs),
286+
.fx(status[5:3])
249287
);
250288

289+
///////////////////////////////////////////////////
290+
291+
wire rom_download = ioctl_download && (ioctl_index < 8'd2);
292+
wire reset = (RESET | status[0] | buttons[1] | rom_download);
293+
assign LED_USER = rom_download;
294+
295+
soc soc(
296+
.clk_sys(clk_sys),
297+
.ce_pix(ce_pix),
298+
.reset(reset | ioctl_download),
299+
.VGA_HS(hs),
300+
.VGA_VS(vs),
301+
.VGA_R(r),
302+
.VGA_G(g),
303+
.VGA_B(b),
304+
.VGA_HB(hblank),
305+
.VGA_VB(vblank),
306+
.dn_addr(ioctl_addr[13:0]),
307+
.dn_data(ioctl_dout),
308+
.dn_wr(ioctl_wr),
309+
.dn_index(ioctl_index),
310+
.inputs1(joystick_0[7:0]),
311+
.inputs2(joystick_1[7:0])
312+
);
251313

252314
endmodule

MiSTer.pf

1.18 KB
Binary file not shown.

README.MD

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
# InputTest_MiSTer
12

3+
## Overview
24

3-
# Memory Map
5+
6+
7+
8+
9+
## Memory Map
410

511
Start|End|Length|Name
612
---|---|---|---
713
0x0000|0x3FFF|0x4000|Program ROM
8-
0x4000|0x43FF|0x0400|Char ROM
9-
14+
0x4000|0x47FF|0x0800|Char ROM
1015
0x6000|0x6000|0x0001|System inputs (video timings etc)
11-
0x6001|0x6001|0x0001|Control inputs
12-
13-
0x8000|0xBFFF|0x4000|Work RAM
14-
0xC000|0xC3FF|0xDFFF|Char RAM
16+
0x7000|0x70BF|0x00C0|Joystick inputs
17+
0x8000|0x87FF|0x0800|Char RAM
18+
0x8800|0x8FFF|0x0800|Colour RAM
19+
0xC000|0xFFFF|0x4000|Work RAM

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cd src
2-
make
2+
make clean
3+
make all
34
cd ..
45
cd verilator
56
./verilate.sh

files.qip

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
set_global_assignment -name SYSTEMVERILOG_FILE InputTest.sv
2-
set_global_assignment -name QIP_FILE rtl/T80/t80.qip
32
set_global_assignment -name QIP_FILE rtl/tv80/TV80.qip
43
set_global_assignment -name CDF_FILE jtag.cdf
54
set_global_assignment -name QIP_FILE sys/sys.qip

src/font.bin renamed to font.bin

File renamed without changes.

src/font.fnt renamed to font.fnt

File renamed without changes.

font.pf

768 Bytes
Binary file not shown.

ram4k.qip

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)