1
0
mirror of https://github.com/Gehstock/Mist_FPGA.git synced 2026-01-17 16:43:22 +00:00

Release Squash

This commit is contained in:
Marcel 2019-09-24 17:43:49 +02:00
parent 88ec38aad9
commit 960ca7474d
6 changed files with 27 additions and 132 deletions

View File

@ -1,7 +1,7 @@
Squash Port to Mist FPGA by Gehstock
Work in Progress
--Joystick to Wheel Encoder
Left, Right moving Player
Up, Down moving Racket

View File

@ -49,7 +49,6 @@ set_global_assignment -name VHDL_FILE rtl/squash.vhd
set_global_assignment -name VHDL_FILE rtl/ym_2149_linmix.vhd
set_global_assignment -name VHDL_FILE rtl/video_gen.vhd
set_global_assignment -name VHDL_FILE rtl/gen_ram.vhd
set_global_assignment -name SYSTEMVERILOG_FILE rtl/joy2quad.sv
set_global_assignment -name VHDL_FILE rtl/rom/squash_tile_bit1.vhd
set_global_assignment -name VHDL_FILE rtl/rom/squash_tile_bit0.vhd
set_global_assignment -name VHDL_FILE rtl/rom/squash_program.vhd
@ -157,10 +156,10 @@ set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -
set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
# end DESIGN_PARTITION(Top)
# -------------------------
# end ENTITY(Squash_MiST)
# -----------------------
# -----------------------
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

View File

@ -1,100 +0,0 @@
//============================================================================
// joy2quad
//
// Take in digital joystick buttons, and try to estimate a quadrature encoder
//
//
// This makes an offset wave pattern for each keyboard stroke. It might
// be a good extension to change the size of the wave based on how long the joystick
// is held down.
//
// Copyright (c) 2019 Alan Steremberg - alanswx
//
//
//============================================================================
// digital joystick button to quadrature encoder
module joy2quad
(
input CLK,
input [11:0] clkdiv,
input rightc,
input leftc,
output reg [1:0] steer
);
reg [3:0] state = 0;
always @(posedge CLK) begin
reg [11:0] count = 0;
if (count >0)
begin
count=count-1;
end
else
begin
count=clkdiv;
casex(state)
4'b0000:
begin
steer=2'b00;
if (leftc==1)
begin
state=4'b0001;
end
if (rightc==1)
begin
state=4'b0101;
end
end
4'b0001:
begin
steer=2'b00;
state=4'b0010;
end
4'b0010:
begin
steer=2'b01;
state=3'b0011;
end
4'b0011:
begin
steer=2'b11;
state=4'b0100;
end
4'b0100:
begin
steer=2'b10;
state=4'b000;
end
4'b0101:
begin
steer=2'b00;
state=4'b0110;
end
4'b0110:
begin
steer=2'b10;
state=4'b0111;
end
4'b0111:
begin
steer=2'b11;
state=4'b1000;
end
4'b1000:
begin
steer=2'b01;
state=4'b0000;
end
endcase
end
end
endmodule

View File

@ -155,16 +155,6 @@ signal vsync_o : std_logic;
signal dail1 : std_logic_vector(1 downto 0);
signal dail2 : std_logic_vector(1 downto 0);
COMPONENT joy2quad
PORT
(
CLK : IN STD_LOGIC;
clkdiv : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
rightc : IN STD_LOGIC;
leftc : IN STD_LOGIC;
steer : OUT STD_LOGIC_VECTOR(1 DOWNTO 0)
);
END COMPONENT;
begin
@ -229,23 +219,29 @@ video_s <= video_i;
------------------
-- player controls
------------------
dailP1 : joy2quad
port map (
CLK => clock_12,
clkdiv => X"265",
rightc => up1,
leftc => down1,
steer => dail1
);
dailP2 : joy2quad
port map (
CLK => clock_12,
clkdiv => X"265",
rightc => up2,
leftc => down2,
steer => dail2
);
process (up1,down1,clock_1mhz) begin
if dail1 /= "11" then
dail1 <= "11";
elsif up1 = '1' then
dail1 <= "01";
elsif down1 = '1' then
dail1 <= "10";
else
dail1<="11";
end if;
end process;
process (up2,down2,clock_1mhz) begin
if dail2 /= "11" then
dail2 <= "11";
elsif up2 = '1' then
dail2 <= "01";
elsif down2 = '1' then
dail2 <= "10";
else
dail2<="11";
end if;
end process;
player1 <= not(fire1 & dail1 & right1 & left1 & start1 & '0' & coin1);
player2 <= not(fire2 & dail2 & right2 & left2 & start2 & "00");