-
Notifications
You must be signed in to change notification settings - Fork 7
/
MultiComp.sv
686 lines (588 loc) · 17.8 KB
/
MultiComp.sv
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
//============================================================================
// Grant�s multi computer
//
// Port to MiSTer.
//
// Based on Grant�s multi computer
// http://searle.hostei.com/grant/
// http://searle.hostei.com/grant/Multicomp/index.html
// and WiSo's collector blog (MiST port)
// https://ws0.org/building-your-own-custom-computer-with-the-mist-fpga-board-part-1/
// https://ws0.org/building-your-own-custom-computer-with-the-mist-fpga-board-part-2/
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//============================================================================
module emu
(
//Master input clock
input CLK_50M,
//Async reset from top-level module.
//Can be used as initial reset.
input RESET,
//Must be passed to hps_io module
inout [48:0] HPS_BUS,
//Base video clock. Usually equals to CLK_SYS.
output CLK_VIDEO,
//Multiple resolutions are supported using different CE_PIXEL rates.
//Must be based on CLK_VIDEO
output CE_PIXEL,
//Video aspect ratio for HDMI. Most retro systems have ratio 4:3.
//if VIDEO_ARX[12] or VIDEO_ARY[12] is set then [11:0] contains scaled size instead of aspect ratio.
output [12:0] VIDEO_ARX,
output [12:0] VIDEO_ARY,
output [7:0] VGA_R,
output [7:0] VGA_G,
output [7:0] VGA_B,
output VGA_HS,
output VGA_VS,
output VGA_DE, // = ~(VBlank | HBlank)
output VGA_F1,
output [1:0] VGA_SL,
output VGA_SCALER, // Force VGA scaler
output VGA_DISABLE, // analog out is off
input [11:0] HDMI_WIDTH,
input [11:0] HDMI_HEIGHT,
output HDMI_FREEZE,
output HDMI_BLACKOUT,
`ifdef MISTER_FB
// Use framebuffer in DDRAM
// FB_FORMAT:
// [2:0] : 011=8bpp(palette) 100=16bpp 101=24bpp 110=32bpp
// [3] : 0=16bits 565 1=16bits 1555
// [4] : 0=RGB 1=BGR (for 16/24/32 modes)
//
// FB_STRIDE either 0 (rounded to 256 bytes) or multiple of pixel size (in bytes)
output FB_EN,
output [4:0] FB_FORMAT,
output [11:0] FB_WIDTH,
output [11:0] FB_HEIGHT,
output [31:0] FB_BASE,
output [13:0] FB_STRIDE,
input FB_VBL,
input FB_LL,
output FB_FORCE_BLANK,
`ifdef MISTER_FB_PALETTE
// Palette control for 8bit modes.
// Ignored for other video modes.
output FB_PAL_CLK,
output [7:0] FB_PAL_ADDR,
output [23:0] FB_PAL_DOUT,
input [23:0] FB_PAL_DIN,
output FB_PAL_WR,
`endif
`endif
output LED_USER, // 1 - ON, 0 - OFF.
// b[1]: 0 - LED status is system status OR'd with b[0]
// 1 - LED status is controled solely by b[0]
// hint: supply 2'b00 to let the system control the LED.
output [1:0] LED_POWER,
output [1:0] LED_DISK,
// I/O board button press simulation (active high)
// b[1]: user button
// b[0]: osd button
output [1:0] BUTTONS,
input CLK_AUDIO, // 24.576 MHz
output [15:0] AUDIO_L,
output [15:0] AUDIO_R,
output AUDIO_S, // 1 - signed audio samples, 0 - unsigned
output [1:0] AUDIO_MIX, // 0 - no mix, 1 - 25%, 2 - 50%, 3 - 100% (mono)
//ADC
inout [3:0] ADC_BUS,
//SD-SPI
output SD_SCK,
output SD_MOSI,
input SD_MISO,
output SD_CS,
input SD_CD,
//High latency DDR3 RAM interface
//Use for non-critical time purposes
output DDRAM_CLK,
input DDRAM_BUSY,
output [7:0] DDRAM_BURSTCNT,
output [28:0] DDRAM_ADDR,
input [63:0] DDRAM_DOUT,
input DDRAM_DOUT_READY,
output DDRAM_RD,
output [63:0] DDRAM_DIN,
output [7:0] DDRAM_BE,
output DDRAM_WE,
//SDRAM interface with lower latency
output SDRAM_CLK,
output SDRAM_CKE,
output [12:0] SDRAM_A,
output [1:0] SDRAM_BA,
inout [15:0] SDRAM_DQ,
output SDRAM_DQML,
output SDRAM_DQMH,
output SDRAM_nCS,
output SDRAM_nCAS,
output SDRAM_nRAS,
output SDRAM_nWE,
`ifdef MISTER_DUAL_SDRAM
//Secondary SDRAM
//Set all output SDRAM_* signals to Z ASAP if SDRAM2_EN is 0
input SDRAM2_EN,
output SDRAM2_CLK,
output [12:0] SDRAM2_A,
output [1:0] SDRAM2_BA,
inout [15:0] SDRAM2_DQ,
output SDRAM2_nCS,
output SDRAM2_nCAS,
output SDRAM2_nRAS,
output SDRAM2_nWE,
`endif
input UART_CTS,
output UART_RTS,
input UART_RXD,
output UART_TXD,
output UART_DTR,
input UART_DSR,
// Open-drain User port.
// 0 - D+/RX
// 1 - D-/TX
// 2..6 - USR2..USR6
// Set USER_OUT to 1 to read from USER_IN.
input [6:0] USER_IN,
output [6:0] USER_OUT,
input OSD_STATUS
);
// User Port - extra USB 3.1A style connector on MiSTer
//
// USB P7 Name PIN Mister emu wire
// 1 +5V +5V
// 2 2 TX SDA AH9 USER_IO[1]
// 3 1 RX SCL AG11 USER_IO[0]
// 4 GND GND
// 5 8 DSR IO10 AF15 USER_IO[5]
// 6 7 DTR IO11 AG16 USER_IO[4]
// 7 6 CTS IO12 AH11 USER_IO[3]
// 8 5 RTS IO13 AH12 USER_IO[2]
// 9 10 IO6 IO8 AF17 USER_IO[6]
// FT232 USB to serial cable
// sig usb io connector
// Red 5V
// Black GND GND
// White RXD 2
// Green TXD 3
// Yellow RTS 7
// Blue CTS 8
// Define meaningful names for USER_IO signals
// Input pins (USER_IN)
wire user_rx = USER_IN[0]; // Serial RX from USER_IO port
wire user_cts = USER_IN[3]; // CTS from USER_IO port
// USER_IN[1] unused
// USER_IN[2] unused
// USER_IN[4:6] unused
// Output pins (USER_OUT)
// Active high enables for input pins
wire user_rx_en = USER_OUT[0]; // Enable RX input
wire user_tx = USER_OUT[1]; // Serial TX to USER_IO port
wire user_rts = USER_OUT[2]; // RTS to USER_IO port
wire user_cts_en = USER_OUT[3]; // Enable CTS input
// USER_OUT[4:6] unused
assign ADC_BUS = 'Z;
//assign {SD_SCK, SD_MOSI, SD_CS} = 'Z;
assign {SDRAM_DQ, SDRAM_A, SDRAM_BA, SDRAM_CLK, SDRAM_CKE, SDRAM_DQML, SDRAM_DQMH, SDRAM_nWE, SDRAM_nCAS, SDRAM_nRAS, SDRAM_nCS} = 'Z;
assign {DDRAM_CLK, DDRAM_BURSTCNT, DDRAM_ADDR, DDRAM_DIN, DDRAM_BE, DDRAM_RD, DDRAM_WE} = 0;
//assign UART_RTS = UART_CTS;
assign UART_DTR = UART_DSR;
assign LED_USER = vsd_sel & sd_act;
assign LED_DISK = ~driveLED;
assign LED_POWER = 0;
assign BUTTONS = 0;
assign VIDEO_ARX = 4;
assign VIDEO_ARY = 3;
assign VGA_SL = 0;
assign VGA_F1 = 0;
assign VGA_SCALER = 1;
assign AUDIO_S = 0;
assign AUDIO_L = 0;
assign AUDIO_R = 0;
assign AUDIO_MIX = 0;
`include "build_id.v"
parameter CONF_STR = {
"MultiComp;;",
"S,IMG;",
"OF,Reset after Mount,No,Yes;",
"-;",
"O78,CPU-ROM,Z80-CP/M,Z80-BASIC,6502-Basic,6809-Basic;",
"-;",
"O9B,Baud Rate tty,115200,38400,19200,9600,4800,2400;",
"OC,Serial Port,Console Port,User IO Port;",
"OE,Flow Control,None,RTS/CTS;", // New flow control option
"-;",
"RE,Reset;",
"V,v",`BUILD_DATE
};
////////////////// HPS I/O ///////////////////
wire [1:0] buttons;
wire [127:0] status;
wire PS2_CLK;
wire PS2_DAT;
wire forced_scandoubler;
wire [31:0] sd_lba[1];
wire sd_rd;
wire sd_wr;
wire sd_ack;
wire [8:0] sd_buff_addr;
wire [7:0] sd_buff_dout;
wire [7:0] sd_buff_din[1];
wire sd_buff_wr;
wire sd_ack_conf;
wire img_mounted;
wire img_readonly;
wire [63:0] img_size;
hps_io #(
.CONF_STR(CONF_STR),
.PS2DIV (2000)
) hps_io
(
.clk_sys(CLK_50M),
.HPS_BUS(HPS_BUS),
.buttons(buttons),
.status(status),
.forced_scandoubler(forced_scandoubler),
.ps2_kbd_clk_out(PS2_CLK),
.ps2_kbd_data_out(PS2_DAT),
.sd_lba(sd_lba),
.sd_rd(sd_rd),
.sd_wr(sd_wr),
.sd_ack(sd_ack),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din),
.sd_buff_wr(sd_buff_wr),
.img_mounted(img_mounted),
.img_readonly(img_readonly),
.img_size(img_size)
);
/////////////////////// CLOCKS ///////////////////////////////
wire clk_sys, locked;
pll pll
(
.refclk(CLK_50M),
.rst(0),
.outclk_0(clk_sys),
.locked(locked)
);
///////////////// RESET /////////////////////////
reg reset_from_mount = 0;
reg [15:0] reset_counter = 0;
always @(posedge clk_sys) begin
if(img_mounted & status[15]) begin
reset_from_mount <= 1;
reset_counter <= 0;
end else if(reset_from_mount) begin
if(reset_counter < 16'hffff)
reset_counter <= reset_counter + 1;
else
reset_from_mount <= 0;
end
end
wire reset = RESET | status[0] | buttons[1] | reset_from_mount;
///////////////// SDCARD ////////////////////////
wire sdclk;
wire sdmosi;
wire sdmiso = vsd_sel ? vsdmiso : SD_MISO;
wire sdss;
wire vsdmiso;
reg vsd_sel = 0;
// latch vsd_sel if user selects an image file
always @(posedge clk_sys) begin
if(RESET) begin // Only clear on hard reset
vsd_sel <= 0;
end
else begin
if(img_mounted) begin
// Latch the selection based on image size
vsd_sel <= |img_size;
end
end
end
//always @(posedge clk_sys) if(img_mounted) vsd_sel <= |img_size;
// uses the previous sd_card implementation i.e. now in components/sdcard
image_card image_card
(
.clk_sys(clk_sys),
.reset(reset),
.sdhc(1),
.sd_lba(sd_lba[0]),
.sd_rd(sd_rd), // New connection
.sd_wr(sd_wr), // New connection
.sd_ack(sd_ack), // New connection
.sd_buff_addr(sd_buff_addr), // New connection
.sd_buff_dout(sd_buff_dout), // New connection
.sd_buff_din(sd_buff_din[0]),
.sd_buff_wr(sd_buff_wr), // New connection
.clk_spi(clk_sys),
.ss(sdss | ~vsd_sel),
.sck(sdclk),
.mosi(sdmosi),
.miso(vsdmiso)
);
// this does not work i.e. with the new sd_card in /sys, not sure why yet
// sd_card sd_card
// (
// .clk_sys(clk_sys),
// .reset(reset),
// .sdhc(1),
// .img_mounted(img_mounted),
// .img_size(img_size),
// .sd_lba(sd_lba[0]),
// .sd_rd(sd_rd), // New connection
// .sd_wr(sd_wr), // New connection
// .sd_ack(sd_ack), // New connection
// .sd_buff_addr(sd_buff_addr), // New connection
// .sd_buff_dout(sd_buff_dout), // New connection
// .sd_buff_din(sd_buff_din[0]),
// .sd_buff_wr(sd_buff_wr), // New connection
// .clk_spi(clk_sys),
// .ss(sdss | ~vsd_sel),
// .sck(sdclk),
// .mosi(sdmosi),
// .miso(vsdmiso)
// );
assign SD_CS = sdss | vsd_sel;
assign SD_SCK = sdclk & ~vsd_sel;
assign SD_MOSI = sdmosi & ~vsd_sel;
reg sd_act;
always @(posedge clk_sys) begin
reg old_mosi, old_miso;
integer timeout = 0;
old_mosi <= sdmosi;
old_miso <= sdmiso;
sd_act <= 0;
if(timeout < 1000000) begin
timeout <= timeout + 1;
sd_act <= 1;
end
if((old_mosi ^ sdmosi) || (old_miso ^ sdmiso)) timeout <= 0;
end
// Serial port selection
wire serial_port_select = status[12]; // 0 = Console Port (UART), 1 = User IO Port
// Flow control enable
wire flow_control_enable = status[14]; // 0 = No flow control, 1 = RTS/CTS enabled
// Serial interface routing
wire serial_rx = serial_port_select ? user_rx : UART_RXD;
wire serial_tx;
localparam INIT_TIMEOUT = 24'd50000; // 1ms at 50MHz clock
reg [23:0] init_counter = 0;
reg init_complete = 0;
always @(posedge clk_sys) begin
if (reset) begin
init_complete <= 0;
init_counter <= 0;
end
else if (!init_complete) begin
if (init_counter == INIT_TIMEOUT) begin
init_complete <= 1;
end
else begin
init_counter <= init_counter + 1;
end
end
end
// CTS handling - active low when flow control enabled
wire serial_cts = flow_control_enable ?
(init_complete ? (serial_port_select ? user_cts : UART_CTS) : 1'b0) :
1'b0;
// Serial interface output routing
wire serial_rts; // RTS signal from CPUs
// Serial port output routing
assign UART_TXD = serial_port_select ? 1'b1 : serial_tx;
assign UART_RTS = (serial_port_select || !flow_control_enable) ? 1'b1 : serial_rts;
// USER_IO port control - single assignment for all outputs
assign USER_OUT = {
3'b0, // [6:4] unused
serial_port_select && flow_control_enable, // [3] CTS input enable
(serial_port_select && flow_control_enable) ? serial_rts : 1'b1, // [2] RTS output
serial_port_select ? serial_tx : 1'b1, // [1] TX output
serial_port_select // [0] RX input enable
};
// Connect the read-only signals to the USER_OUT bits for monitoring
assign user_rx_en = USER_OUT[0];
assign user_tx = USER_OUT[1];
assign user_rts = USER_OUT[2];
assign user_cts_en = USER_OUT[3];
///////////////////////////////////////////////////
assign CLK_VIDEO = clk_sys;
typedef enum {cpuZ80CPM='b00, cpuZ80Basic='b01, cpu6502Basic='b10, cpu6809Basic='b11} cpu_type_enum;
wire [1:0] cpu_type = status[8:7];
typedef enum {baud115200='b000, baud38400='b001, baud19200='b010, baud9600='b011, baud4800='b100, baud2400='b101} baud_rate_enum;
wire [2:0] baud_rate = status[11:9];
wire hblank, vblank;
wire hs, vs;
wire [1:0] r,g,b;
wire driveLED;
wire [3:0] _hblank, _vblank;
wire [3:0] _hs, _vs;
wire [1:0] _r[3:0], _g[3:0], _b[3:0];
wire [3:0] _driveLED;
wire [3:0] _CE_PIXEL;
wire [3:0] _SD_CS;
wire [3:0] _SD_MOSI;
wire [3:0] _SD_SCK;
wire [3:0] _txd;
wire [3:0] _rts; // RTS signals from CPUs
// Add baud rate selection logic
reg [15:0] baud_increment;
always @(*) begin
case(baud_rate)
baud115200: baud_increment = 16'd2416; // 115200
baud38400: baud_increment = 16'd805; // 38400
baud19200: baud_increment = 16'd403; // 19200
baud9600: baud_increment = 16'd201; // 9600
baud4800: baud_increment = 16'd101; // 4800
baud2400: baud_increment = 16'd50; // 2400
default: baud_increment = 16'd2416; // Default to 115200
endcase
end
always_comb
begin
hblank <= _hblank[cpu_type];
vblank <= _vblank[cpu_type];
hs <= _hs[cpu_type];
vs <= _vs[cpu_type];
r <= _r[cpu_type][1:0];
g <= _g[cpu_type][1:0];
b <= _b[cpu_type][1:0];
CE_PIXEL <= _CE_PIXEL[cpu_type];
sdss <= _SD_CS[cpu_type];
sdmosi <= _SD_MOSI[cpu_type];
sdclk <= _SD_SCK[cpu_type];
driveLED <= _driveLED[cpu_type];
serial_tx <= _txd[cpu_type];
serial_rts <= _rts[cpu_type];
end
MicrocomputerZ80CPM MicrocomputerZ80CPM
(
.N_RESET(~reset & cpu_type == cpuZ80CPM),
.clk(cpu_type == cpuZ80CPM ? clk_sys : 0),
.baud_increment(baud_increment),
.R(_r[cpuZ80CPM][1:0]),
.G(_g[cpuZ80CPM][1:0]),
.B(_b[cpuZ80CPM][1:0]),
.HS(_hs[cpuZ80CPM]),
.VS(_vs[cpuZ80CPM]),
.hBlank(_hblank[cpuZ80CPM]),
.vBlank(_vblank[cpuZ80CPM]),
.cepix(_CE_PIXEL[cpuZ80CPM]),
.ps2Clk(PS2_CLK),
.ps2Data(PS2_DAT),
.sdCS (_SD_CS[cpuZ80CPM]),
.sdMOSI (_SD_MOSI[cpuZ80CPM]),
.sdMISO (sdmiso),
.sdSCLK (_SD_SCK[cpuZ80CPM]),
.driveLED(_driveLED[cpuZ80CPM]),
.rxd1(serial_rx),
.txd1(_txd[cpuZ80CPM]),
.rts1(_rts[cpuZ80CPM]),
.cts1(serial_cts)
);
MicrocomputerZ80Basic MicrocomputerZ80Basic
(
.N_RESET(~reset & cpu_type == cpuZ80Basic),
.clk(cpu_type == cpuZ80Basic ? clk_sys : 0),
.baud_increment(baud_increment),
.R(_r[cpuZ80Basic][1:0]),
.G(_g[cpuZ80Basic][1:0]),
.B(_b[cpuZ80Basic][1:0]),
.HS(_hs[cpuZ80Basic]),
.VS(_vs[cpuZ80Basic]),
.hBlank(_hblank[cpuZ80Basic]),
.vBlank(_vblank[cpuZ80Basic]),
.cepix(_CE_PIXEL[cpuZ80Basic]),
.ps2Clk(PS2_CLK),
.ps2Data(PS2_DAT),
.sdCS(_SD_CS[cpuZ80Basic]),
.sdMOSI(_SD_MOSI[cpuZ80Basic]),
.sdMISO(sdmiso),
.sdSCLK(_SD_SCK[cpuZ80Basic]),
.driveLED(_driveLED[cpuZ80Basic]),
.rxd1(serial_rx),
.txd1(_txd[cpuZ80Basic]),
.rts1(_rts[cpuZ80Basic]),
.cts1(serial_cts)
);
Microcomputer6502Basic Microcomputer6502Basic
(
.N_RESET(~reset & cpu_type == cpu6502Basic),
.clk(cpu_type == cpu6502Basic ? clk_sys : 0),
.baud_increment(baud_increment),
.R(_r[cpu6502Basic][1:0]),
.G(_g[cpu6502Basic][1:0]),
.B(_b[cpu6502Basic][1:0]),
.HS(_hs[cpu6502Basic]),
.VS(_vs[cpu6502Basic]),
.hBlank(_hblank[cpu6502Basic]),
.vBlank(_vblank[cpu6502Basic]),
.cepix(_CE_PIXEL[cpu6502Basic]),
.ps2Clk(PS2_CLK),
.ps2Data(PS2_DAT),
.sdCS(_SD_CS[cpu6502Basic]),
.sdMOSI(_SD_MOSI[cpu6502Basic]),
.sdMISO(sdmiso),
.sdSCLK(_SD_SCK[cpu6502Basic]),
.driveLED(_driveLED[cpu6502Basic]),
.rxd1(serial_rx),
.txd1(_txd[cpu6502Basic]),
.rts1(_rts[cpu6502Basic]),
.cts1(serial_cts)
);
//Reset is not working (even on the original Grant's 6809)
Microcomputer6809Basic Microcomputer6809Basic
(
.N_RESET(~reset & cpu_type == cpu6809Basic),
.clk(cpu_type == cpu6809Basic ? clk_sys : 0),
.baud_increment(baud_increment),
.R(_r[cpu6809Basic][1:0]),
.G(_g[cpu6809Basic][1:0]),
.B(_b[cpu6809Basic][1:0]),
.HS(_hs[cpu6809Basic]),
.VS(_vs[cpu6809Basic]),
.hBlank(_hblank[cpu6809Basic]),
.vBlank(_vblank[cpu6809Basic]),
.cepix(_CE_PIXEL[cpu6809Basic]),
.ps2Clk(PS2_CLK),
.ps2Data(PS2_DAT),
.sdCS(_SD_CS[cpu6809Basic]),
.sdMOSI(_SD_MOSI[cpu6809Basic]),
.sdMISO(sdmiso),
.sdSCLK(_SD_SCK[cpu6809Basic]),
.driveLED(_driveLED[cpu6809Basic]),
.rxd1(serial_rx),
.txd1(_txd[cpu6809Basic]),
.rts1(_rts[cpu6809Basic]),
.cts1(serial_cts)
);
video_cleaner video_cleaner
(
.clk_vid(CLK_VIDEO),
.ce_pix(CE_PIXEL),
.R({4{r}}),
.G({4{g}}),
.B({4{b}}),
.HSync(hs),
.VSync(vs),
.HBlank(hblank),
.VBlank(vblank),
.VGA_R(VGA_R),
.VGA_G(VGA_G),
.VGA_B(VGA_B),
.VGA_VS(VGA_VS),
.VGA_HS(VGA_HS),
.VGA_DE(VGA_DE)
);
endmodule