Skip to content

Commit

Permalink
Add support for R6
Browse files Browse the repository at this point in the history
  • Loading branch information
MJoergen committed Jan 2, 2024
1 parent 39513c5 commit 076c58a
Show file tree
Hide file tree
Showing 9 changed files with 2,211 additions and 33 deletions.
810 changes: 810 additions & 0 deletions CORE/CORE-R6.xpr

Large diffs are not rendered by default.

387 changes: 387 additions & 0 deletions M2M/MEGA65-R6.xdc

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions M2M/vhdl/controllers/M65/audio.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ port (
audio_bick_o : out std_logic; -- Audio Serial Data Clock Pin, 3.072 MHz
audio_sdti_o : out std_logic; -- Audio Serial Data Input Pin, 16-bit LSB justified
audio_lrclk_o : out std_logic; -- Input Channel Clock Pin, 48.0 kHz
audio_pdn_n_o : out std_logic; -- Power-Down & Reset Pin
audio_i2cfil_o : out std_logic; -- I2C Interface Mode Select Pin
audio_scl_o : out std_logic; -- Control Data Clock Input Pin
audio_sda_io : inout std_logic -- Control Data Input/Output Pin
audio_pdn_n_o : out std_logic -- Power-Down & Reset Pin
);
end entity audio;

Expand Down Expand Up @@ -86,9 +83,6 @@ begin

audio_mclk_o <= audio_clk_i;
audio_pdn_n_o <= not audio_reset_i;
audio_i2cfil_o <= '0'; -- I2C speed 400 kHz
audio_scl_o <= '1';
audio_sda_io <= 'Z';

end architecture synthesis;

19 changes: 17 additions & 2 deletions M2M/vhdl/framework.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ port (
qnice_ramrom_we_o : out std_logic;
qnice_ramrom_wait_i : in std_logic;

hdmi_scl_io : inout std_logic;
hdmi_sda_io : inout std_logic;

vga_scl_io : inout std_logic;
vga_sda_io : inout std_logic;

audio_scl_io : inout std_logic;
audio_sda_io : inout std_logic;

-- I2C bus
-- U32 = PCA9655EMTTXG. Address 0x40. I/O expander.
-- U12 = MP8869SGL-Z. Address 0x61. DC/DC Converter.
Expand Down Expand Up @@ -1023,8 +1032,8 @@ begin
i2c_addr_i => qnice_ramrom_addr_o,
i2c_wr_data_i => qnice_ramrom_data_out_o,
i2c_rd_data_o => qnice_i2c_rd_data,
scl_in_i => "11111" & i2c_scl_io & grove_scl_io & fpga_scl_io,
sda_in_i => "11111" & i2c_sda_io & grove_sda_io & fpga_sda_io,
scl_in_i => "11" & audio_scl_io & vga_scl_io & hdmi_scl_io & i2c_scl_io & grove_scl_io & fpga_scl_io,
sda_in_i => "11" & audio_sda_io & vga_sda_io & hdmi_sda_io & i2c_sda_io & grove_sda_io & fpga_sda_io,
scl_out_o => scl_out,
sda_out_o => sda_out
); -- i_rtc_wrapper
Expand All @@ -1036,6 +1045,12 @@ begin
grove_scl_io <= '0' when scl_out(1) = '0' else 'Z';
i2c_sda_io <= '0' when sda_out(2) = '0' else 'Z';
i2c_scl_io <= '0' when scl_out(2) = '0' else 'Z';
hdmi_sda_io <= '0' when sda_out(3) = '0' else 'Z';
hdmi_scl_io <= '0' when scl_out(3) = '0' else 'Z';
vga_sda_io <= '0' when sda_out(4) = '0' else 'Z';
vga_scl_io <= '0' when scl_out(4) = '0' else 'Z';
audio_sda_io <= '0' when sda_out(5) = '0' else 'Z';
audio_scl_io <= '0' when scl_out(5) = '0' else 'Z';

end architecture synthesis;

8 changes: 4 additions & 4 deletions M2M/vhdl/i2c/rtc_master.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ architecture synthesis of rtc_master is
-- 5: DayOfMonth
-- 6: Month
-- 7: Year
constant C_ACTION_LIST_READ_R5 : action_list_t := (
constant C_ACTION_LIST_READ_R456 : action_list_t := (
-- This reads from the RTC
0 => (WAIT_CMD, X"F1", X"0001"), -- Wait until I2C is idle
1 => (WRITE_CMD, X"00", X"0000"), -- Prepare to write to RTC
Expand All @@ -125,7 +125,7 @@ architecture synthesis of rtc_master is
9 => (END_CMD, X"00", X"0000")
);

constant C_ACTION_LIST_WRITE_R5 : action_list_t := (
constant C_ACTION_LIST_WRITE_R456 : action_list_t := (
-- This writes to the RTC
0 => (WAIT_CMD, X"F1", X"0001"), -- Wait until I2C is idle
1 => (SHIFT_OUT_CMD, X"00", X"0005"), -- Prepare to write to RTC
Expand All @@ -140,7 +140,7 @@ architecture synthesis of rtc_master is
if board = "MEGA65_R3" then
return C_ACTION_LIST_READ_R3;
else
return C_ACTION_LIST_READ_R5; -- Valid for R4 and R5
return C_ACTION_LIST_READ_R456; -- Valid for R4, R5, and R6
end if;
end function get_action_list_read;

Expand All @@ -149,7 +149,7 @@ architecture synthesis of rtc_master is
if board = "MEGA65_R3" then
return C_ACTION_LIST_WRITE_R3;
else
return C_ACTION_LIST_WRITE_R5; -- Valid for R4 and R5
return C_ACTION_LIST_WRITE_R456; -- Valid for R4, R5, and R6
end if;
end function get_action_list_write;

Expand Down
10 changes: 6 additions & 4 deletions M2M/vhdl/top_mega65-r3.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,6 @@ begin
-- Safe default values for ports not supported by the M2M framework
---------------------------------------------------------------------------------------------

vga_scl_io <= 'Z';
vga_sda_io <= 'Z';
hdmi_scl_io <= 'Z';
hdmi_sda_io <= 'Z';
hdmi_ls_oe_o <= '1';
hdmi_cec_io <= 'Z';
audio_mclk_o <= '0';
Expand Down Expand Up @@ -652,6 +648,12 @@ begin
qnice_ramrom_we_o => qnice_ramrom_we,
qnice_ramrom_wait_i => qnice_ramrom_wait,

hdmi_scl_io => hdmi_scl_io,
hdmi_sda_io => hdmi_sda_io,
vga_scl_io => vga_scl_io,
vga_sda_io => vga_sda_io,
audio_scl_io => open,
audio_sda_io => open,
i2c_sda_io => i2c_sda,
i2c_scl_io => i2c_scl,
fpga_sda_io => fpga_sda_io,
Expand Down
17 changes: 9 additions & 8 deletions M2M/vhdl/top_mega65-r4.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,11 @@ begin
audio_bick_o => audio_bick_o,
audio_sdti_o => audio_sdti_o,
audio_lrclk_o => audio_lrclk_o,
audio_pdn_n_o => audio_pdn_n_o,
audio_i2cfil_o => audio_i2cfil_o,
audio_scl_o => audio_scl_o,
audio_sda_io => audio_sda_io
audio_pdn_n_o => audio_pdn_n_o
); -- i_audio

audio_i2cfil_o <= '0'; -- I2C speed 400 kHz

---------------------------------------------------------------------------------------------
-- C64 Cartridge port
---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -481,13 +480,9 @@ begin
-- Safe default values for ports not supported by the M2M framework
---------------------------------------------------------------------------------------------

vga_scl_io <= 'Z';
vga_sda_io <= 'Z';
vdac_psave_n_o <= '1';
hdmi_hiz_en_o <= '0'; -- HDMI is 50 ohm terminated.
hdmi_ls_oe_n_o <= '0'; -- Enable HDMI output
hdmi_scl_io <= 'Z';
hdmi_sda_io <= 'Z';
dbg_io_10 <= 'Z';
dbg_io_11 <= 'Z';

Expand Down Expand Up @@ -701,6 +696,12 @@ begin
qnice_ramrom_we_o => qnice_ramrom_we,
qnice_ramrom_wait_i => qnice_ramrom_wait,

hdmi_scl_io => hdmi_scl_io,
hdmi_sda_io => hdmi_sda_io,
vga_scl_io => vga_scl_io,
vga_sda_io => vga_sda_io,
audio_scl_io => audio_scl_o,
audio_sda_io => audio_sda_io,
i2c_sda_io => i2c_sda,
i2c_scl_io => i2c_scl,
fpga_sda_io => fpga_sda_io,
Expand Down
17 changes: 9 additions & 8 deletions M2M/vhdl/top_mega65-r5.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,11 @@ begin
audio_bick_o => audio_bick_o,
audio_sdti_o => audio_sdti_o,
audio_lrclk_o => audio_lrclk_o,
audio_pdn_n_o => audio_pdn_n_o,
audio_i2cfil_o => audio_i2cfil_o,
audio_scl_o => audio_scl_o,
audio_sda_io => audio_sda_io
audio_pdn_n_o => audio_pdn_n_o
); -- i_audio

audio_i2cfil_o <= '0'; -- I2C speed 400 kHz

---------------------------------------------------------------------------------------------
-- C64 Cartridge port
---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -521,13 +520,9 @@ begin
-- Safe default values for ports not supported by the M2M framework
---------------------------------------------------------------------------------------------

vga_scl_io <= 'Z';
vga_sda_io <= 'Z';
vdac_psave_n_o <= '1';
hdmi_hiz_en_o <= '0'; -- HDMI is 50 ohm terminated.
hdmi_ls_oe_n_o <= '0'; -- Enable HDMI output
hdmi_scl_io <= 'Z';
hdmi_sda_io <= 'Z';
dbg_io_11 <= 'Z';

eth_clock_o <= '0';
Expand Down Expand Up @@ -740,6 +735,12 @@ begin
qnice_ramrom_we_o => qnice_ramrom_we,
qnice_ramrom_wait_i => qnice_ramrom_wait,

hdmi_scl_io => hdmi_scl_io,
hdmi_sda_io => hdmi_sda_io,
vga_scl_io => vga_scl_io,
vga_sda_io => vga_sda_io,
audio_scl_io => audio_scl_o,
audio_sda_io => audio_sda_io,
i2c_scl_io => i2c_scl_io,
i2c_sda_io => i2c_sda_io,
fpga_sda_io => fpga_sda_io,
Expand Down
Loading

0 comments on commit 076c58a

Please sign in to comment.