Skip to content

Commit 7b0076a

Browse files
committed
feat: 4 player multitap support
1 parent f03040a commit 7b0076a

File tree

5 files changed

+139
-23
lines changed

5 files changed

+139
-23
lines changed
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
{
22
"interact": {
33
"magic": "APF_VER_1",
4-
"variables": [],
4+
"variables": [
5+
{
6+
"name": "Use Multitap",
7+
"id": 20,
8+
"type": "check",
9+
"enabled": true,
10+
"address": "0x00000100",
11+
"persist": true,
12+
"writeonly": true,
13+
"defaultval": 0,
14+
"value": 1
15+
}
16+
],
517
"messages": []
618
}
719
}

src/fpga/ap_core.qsf

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
741741
set_global_assignment -name ALM_REGISTER_PACKING_EFFORT LOW
742742
set_global_assignment -name ROUTER_REGISTER_DUPLICATION ON
743743
set_global_assignment -name FITTER_EFFORT "STANDARD FIT"
744+
set_global_assignment -name SLD_FILE db/stp1_auto_stripped.stp
745+
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
744746
set_global_assignment -name SYSTEMVERILOG_FILE core/rtl/mister_top/sync_fifo.sv
745747
set_global_assignment -name MIF_FILE core/rtl/chip/DSP/dsp11b23410_p.mif
746748
set_global_assignment -name MIF_FILE core/rtl/chip/DSP/dsp11b23410_d.mif
@@ -777,8 +779,4 @@ set_global_assignment -name VERILOG_FILE core/core_bridge_cmd.v
777779
set_global_assignment -name SDC_FILE core/core_constraints.sdc
778780
set_global_assignment -name SIGNALTAP_FILE core/stp1.stp
779781
set_global_assignment -name QIP_FILE core/mf_pllbase.qip
780-
set_global_assignment -name SIP_FILE core/mf_pllbase.sip
781-
set_global_assignment -name QIP_FILE core/mf_pllcfg.qip
782-
set_global_assignment -name SIP_FILE core/mf_pllcfg.sip
783-
set_global_assignment -name SLD_FILE db/stp1_auto_stripped.stp
784-
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
782+
set_global_assignment -name SIP_FILE core/mf_pllbase.sip

src/fpga/apf/build_id.mif

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CONTENT
1010
BEGIN
1111

1212
0E0 : 20220919;
13-
0E1 : 00162912;
14-
0E2 : 6a00d36c;
13+
0E1 : 00181600;
14+
0E2 : fffd6548;
1515

1616
END;

src/fpga/core/core_top.v

Lines changed: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ module core_top (
316316
end
317317
32'h10xxxxxx: begin
318318
// example
319-
// bridge_rd_data <= example_device_data;
320319
bridge_rd_data <= 0;
321320
end
322321
32'hF8xxxxxx: begin
@@ -329,15 +328,15 @@ module core_top (
329328
end
330329
end
331330

332-
// always @(posedge clk_74a) begin
333-
// if (bridge_wr) begin
334-
// casex(bridge_addr)
335-
// 32'h00000000: begin
336-
// LHRom_type <= bridge_wr_data[2:0];
337-
// end
338-
// endcase
339-
// end
340-
// end
331+
always @(posedge clk_74a) begin
332+
if (bridge_wr) begin
333+
casex (bridge_addr)
334+
32'h00000100: begin
335+
multitap_enabled <= bridge_wr_data[0];
336+
end
337+
endcase
338+
end
339+
end
341340

342341

343342
//
@@ -582,6 +581,8 @@ module core_top (
582581

583582
wire [15:0] cont1_key_s;
584583
wire [15:0] cont2_key_s;
584+
wire [15:0] cont3_key_s;
585+
wire [15:0] cont4_key_s;
585586

586587
synch_3 #(
587588
.WIDTH(32)
@@ -599,14 +600,36 @@ module core_top (
599600
clk_sys_21_48
600601
);
601602

603+
synch_3 #(
604+
.WIDTH(32)
605+
) cont3_s (
606+
cont3_key,
607+
cont3_key_s,
608+
clk_sys_21_48
609+
);
610+
611+
synch_3 #(
612+
.WIDTH(32)
613+
) cont4_s (
614+
cont4_key,
615+
cont4_key_s,
616+
clk_sys_21_48
617+
);
618+
602619
wire PAL;
603620

621+
// Settings
622+
reg multitap_enabled;
623+
604624
MAIN_SNES snes (
605625
.clk_mem_85_9 (clk_mem_85_9),
606626
.clk_sys_21_48(clk_sys_21_48),
607627

608628
.core_reset(~pll_core_locked),
609629

630+
// Settings
631+
.multitap_enabled(multitap_enabled),
632+
610633
// Input
611634
.p1_button_a(cont1_key_s[4]),
612635
.p1_button_b(cont1_key_s[5]),
@@ -634,6 +657,32 @@ module core_top (
634657
.p2_dpad_left(cont2_key_s[2]),
635658
.p2_dpad_right(cont2_key_s[3]),
636659

660+
.p3_button_a(cont3_key_s[4]),
661+
.p3_button_b(cont3_key_s[5]),
662+
.p3_button_x(cont3_key_s[6]),
663+
.p3_button_y(cont3_key_s[7]),
664+
.p3_button_trig_l(cont3_key_s[8]),
665+
.p3_button_trig_r(cont3_key_s[9]),
666+
.p3_button_start(cont3_key_s[15]),
667+
.p3_button_select(cont3_key_s[14]),
668+
.p3_dpad_up(cont3_key_s[0]),
669+
.p3_dpad_down(cont3_key_s[1]),
670+
.p3_dpad_left(cont3_key_s[2]),
671+
.p3_dpad_right(cont3_key_s[3]),
672+
673+
.p4_button_a(cont4_key_s[4]),
674+
.p4_button_b(cont4_key_s[5]),
675+
.p4_button_x(cont4_key_s[6]),
676+
.p4_button_y(cont4_key_s[7]),
677+
.p4_button_trig_l(cont4_key_s[8]),
678+
.p4_button_trig_r(cont4_key_s[9]),
679+
.p4_button_start(cont4_key_s[15]),
680+
.p4_button_select(cont4_key_s[14]),
681+
.p4_dpad_up(cont4_key_s[0]),
682+
.p4_dpad_down(cont4_key_s[1]),
683+
.p4_dpad_left(cont4_key_s[2]),
684+
.p4_dpad_right(cont4_key_s[3]),
685+
637686
// ROM loading
638687
.rom_file_size(rom_file_size),
639688
.ioctl_download(ioctl_download),

src/fpga/core/rtl/mister_top/SNES.sv

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module MAIN_SNES (
44

55
input wire core_reset,
66

7-
// ROM type (maybe needs to be determined by CHIP32)
8-
// input wire [2:0] LHRom_type,
7+
// Settings
8+
input wire multitap_enabled,
99

1010
// Inputs
1111
input wire p1_button_a,
@@ -34,6 +34,32 @@ module MAIN_SNES (
3434
input wire p2_dpad_left,
3535
input wire p2_dpad_right,
3636

37+
input wire p3_button_a,
38+
input wire p3_button_b,
39+
input wire p3_button_x,
40+
input wire p3_button_y,
41+
input wire p3_button_trig_l,
42+
input wire p3_button_trig_r,
43+
input wire p3_button_start,
44+
input wire p3_button_select,
45+
input wire p3_dpad_up,
46+
input wire p3_dpad_down,
47+
input wire p3_dpad_left,
48+
input wire p3_dpad_right,
49+
50+
input wire p4_button_a,
51+
input wire p4_button_b,
52+
input wire p4_button_x,
53+
input wire p4_button_y,
54+
input wire p4_button_trig_l,
55+
input wire p4_button_trig_r,
56+
input wire p4_button_start,
57+
input wire p4_button_select,
58+
input wire p4_dpad_up,
59+
input wire p4_dpad_down,
60+
input wire p4_dpad_left,
61+
input wire p4_dpad_right,
62+
3763
// ROM loading
3864
input wire [31:0] rom_file_size,
3965
input wire ioctl_download,
@@ -666,6 +692,7 @@ module MAIN_SNES (
666692
p1_dpad_left,
667693
p1_dpad_right
668694
};
695+
669696
wire [11:0] joy1 = {
670697
p2_button_start,
671698
p2_button_select,
@@ -681,6 +708,36 @@ module MAIN_SNES (
681708
p2_dpad_right
682709
};
683710

711+
wire [11:0] joy2 = {
712+
p3_button_start,
713+
p3_button_select,
714+
p3_button_trig_r,
715+
p3_button_trig_l,
716+
p3_button_y,
717+
p3_button_x,
718+
p3_button_b,
719+
p3_button_a,
720+
p3_dpad_up,
721+
p3_dpad_down,
722+
p3_dpad_left,
723+
p3_dpad_right
724+
};
725+
726+
wire [11:0] joy3 = {
727+
p4_button_start,
728+
p4_button_select,
729+
p4_button_trig_r,
730+
p4_button_trig_l,
731+
p4_button_y,
732+
p4_button_x,
733+
p4_button_b,
734+
p4_button_a,
735+
p4_dpad_up,
736+
p4_dpad_down,
737+
p4_dpad_left,
738+
p4_dpad_right
739+
};
740+
684741
wire [1:0] JOY1_DO = piano ? {1'b1, piano_joypad_do} : JOY1_DO_t;
685742

686743
wire JOY_STRB;
@@ -708,16 +765,16 @@ module MAIN_SNES (
708765
ioport port2 (
709766
.CLK(clk_sys),
710767

711-
.MULTITAP(status[17]),
768+
.MULTITAP(multitap_enabled),
712769

713770
.PORT_LATCH(JOY_STRB),
714771
.PORT_CLK(JOY2_CLK),
715772
.PORT_P6(JOY2_P6),
716773
.PORT_DO(JOY2_DO),
717774

718775
.JOYSTICK1((joy_swap ^ raw_serial) ? joy0 : joy1),
719-
// .JOYSTICK2(joy2),
720-
// .JOYSTICK3(joy3),
776+
.JOYSTICK2(joy2),
777+
.JOYSTICK3(joy3),
721778
// .JOYSTICK4(joy4),
722779

723780
// .MOUSE(ps2_mouse),

0 commit comments

Comments
 (0)