-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathhdmi_doomchip.si
79 lines (62 loc) · 1.63 KB
/
hdmi_doomchip.si
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// SL 2020-04-28
// DoomChip, HDMI wrapper
// https://github.com/sylefeb/Silice
// MIT license, see LICENSE_MIT in Silice repo root
//
// NOTE: there is tearing currently (unrestricted frame rate)
//
$$if ULX3S then
$$ HAS_COMPUTE_CLOCK = true
$$else
$$ error('only tested on ULX3S, other boards will require changes')
$$end
// -------------------------
group column_io {
uint10 draw_col = 0, // column that can be drawn
// (drawer should not draw beyond this)
uint10 y = 0,
uint8 palidx = 0,
uint1 write = 0, // pulse high to draw column pixel
uint1 done = 0, // done drawing column
}
$$doomchip_width = 320
$$doomchip_height = 200
$include('doomchip.si')
// include('doomchip_debug_placeholder.si')
$$texfile_palette = palette_666
$include('../common/video_sdram_main.si')
// -------------------------
$$print('------< HDMI mode >------')
// -------------------------
$include('sdram_column_writer.si')
// -------------------------
// Main drawing algorithm
algorithm frame_drawer(
sdram_user sd,
input uint1 sdram_clock,
input uint1 sdram_reset,
input uint1 vsync,
output uint1 fbuffer,
$$if ULX3S or DE10NANO then
input uint7 btns,
$$end
output uint8 leds,
) <autorun> {
column_io colio;
doomchip doom(
colio <:> colio,
vsync <: vsync,
<:auto:> // used to bind parameters across the different boards
);
sdram_byte_io sdh;
sdram_half_speed_access half<@sdram_clock,!sdram_reset>(
sd <:> sd,
sdh <:> sdh
);
sdram_column_writer writer(
colio <:> colio,
sd <:> sdh,
fbuffer :> fbuffer,
);
while (1) { }
}