fpga: aps6404l_controller: Add generic to select wrap mode

This commit is contained in:
Markus Koch 2024-08-01 21:03:12 +02:00
parent 7bece90229
commit 280b354813

View File

@ -13,6 +13,9 @@ use ieee.std_logic_1164.all;
use ieee.numeric_std.all; use ieee.numeric_std.all;
entity aps6404l_controller is entity aps6404l_controller is
generic(
TOGGLE_WRAP_BOUNDARY : boolean := false
);
port( port(
clk : in std_logic; -- Max clock 132 MHz -> 66 MHz SPI clk : in std_logic; -- Max clock 132 MHz -> 66 MHz SPI
rst : in std_logic; -- rst : in std_logic; --
@ -204,6 +207,14 @@ begin
opmode <= COMMAND; opmode <= COMMAND;
end procedure qpi_stop; end procedure qpi_stop;
impure function POST_QPI_STATE return state_t is
begin
if TOGGLE_WRAP_BOUNDARY then
return QPI_SET_BOUNDARY;
else
return IDLE;
end if;
end function POST_QPI_STATE;
begin begin
if rst then if rst then
state <= QPI_EXIT; state <= QPI_EXIT;
@ -225,7 +236,7 @@ begin
state <= SPI_ENABLE_QPI when qpi_xfer(qpi_to_spi((x"9", x"9"))); state <= SPI_ENABLE_QPI when qpi_xfer(qpi_to_spi((x"9", x"9")));
when SPI_ENABLE_QPI => when SPI_ENABLE_QPI =>
state <= QPI_SET_BOUNDARY when qpi_xfer(qpi_to_spi((x"3", x"5"))); state <= POST_QPI_STATE when qpi_xfer(qpi_to_spi((x"3", x"5")));
when QPI_SET_BOUNDARY => when QPI_SET_BOUNDARY =>
state <= IDLE when qpi_xfer((x"C", x"0")); state <= IDLE when qpi_xfer((x"C", x"0"));