Line 1... |
Line 1... |
-- IOTA Pearl Diver VHDL Port
|
-- IOTA Pearl Diver VHDL Port
|
--
|
--
|
-- Written 2018 by Thomas Pototschnig <microengineer18@gmail.com>
|
-- 2018 by Thomas Pototschnig <microengineer18@gmail.com,
|
--
|
-- http://microengineer.eu
|
-- This source code is currently licensed under
|
-- discord: pmaxuw#8292
|
-- Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
|
--
|
--
|
-- Permission is hereby granted, free of charge, to any person obtaining
|
-- http://www.microengineer.eu
|
-- a copy of this software and associated documentation files (the
|
--
|
-- "Software"), to deal in the Software without restriction, including
|
-- If you like my project please consider a donation to
|
-- without limitation the rights to use, copy, modify, merge, publish,
|
--
|
-- distribute, sublicense, and/or sell copies of the Software, and to
|
-- LLEYMHRKXWSPMGCMZFPKKTHSEMYJTNAZXSAYZGQUEXLXEEWPXUNWBFDWESOJVLHQHXOPQEYXGIRBYTLRWHMJAOSHUY
|
-- permit persons to whom the Software is furnished to do so, subject to
|
--
|
-- the following conditions:
|
-- As soon as donations reach 1000MIOTA, everything will become
|
--
|
-- GPL and open for any use - commercial included.
|
-- The above copyright notice and this permission notice shall be
|
|
-- included in all copies or substantial portions of the Software.
|
|
--
|
|
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
-- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
-- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
-- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
library ieee;
|
library ieee;
|
|
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.numeric_std.all;
|
use ieee.numeric_std.all;
|
Line 32... |
Line 42... |
ss : in std_logic;
|
ss : in std_logic;
|
|
|
|
|
data_rd : in std_logic_vector(31 downto 0);
|
data_rd : in std_logic_vector(31 downto 0);
|
data_wr : out std_logic_vector(31 downto 0);
|
data_wr : out std_logic_vector(31 downto 0);
|
data_wren : out std_logic
|
data_wren : out std_logic;
|
|
data_strobe : in std_logic
|
|
|
);
|
);
|
end spi_slave;
|
end spi_slave;
|
|
|
|
|
Line 65... |
Line 76... |
|
|
sync_mosi <= sync_mosi(0) & mosi;
|
sync_mosi <= sync_mosi(0) & mosi;
|
sync_sck <= sync_sck(0) & sck;
|
sync_sck <= sync_sck(0) & sck;
|
sync_ss <= sync_ss(0) & ss;
|
sync_ss <= sync_ss(0) & ss;
|
|
|
|
if data_strobe = '1' then
|
|
i_shiftregister := data_rd;
|
|
end if;
|
|
|
case sync_ss is
|
case sync_ss is
|
when "11" =>
|
when "11" =>
|
i_shiftregister := data_rd;
|
-- i_shiftregister := data_rd;
|
cnt := 0;
|
cnt := 0;
|
-- i_flip := '0';
|
-- i_flip := '0';
|
when "10" =>
|
when "10" =>
|
miso <= i_shiftregister(31);
|
miso <= i_shiftregister(31);
|
when "01" =>
|
when "01" =>
|
Line 79... |
Line 94... |
iwren := '1';
|
iwren := '1';
|
data_wr <= i_shiftregister;
|
data_wr <= i_shiftregister;
|
when "00" =>
|
when "00" =>
|
case sync_sck is
|
case sync_sck is
|
when "01" =>
|
when "01" =>
|
i_shiftregister := i_shiftregister(30 downto 0) & sync_mosi(0);
|
i_shiftregister := i_shiftregister(30 downto 0) & mosi;
|
cnt := cnt + 1;
|
cnt := cnt + 1;
|
when "10" =>
|
when "10" =>
|
miso <= i_shiftregister(31);
|
miso <= i_shiftregister(31);
|
when others =>
|
when others =>
|
end case;
|
end case;
|