forked from Apple-2-HW/AppleIISd
formatting
This commit is contained in:
parent
63313fd7fa
commit
7425ad32fc
@ -32,21 +32,12 @@
|
|||||||
library IEEE;
|
library IEEE;
|
||||||
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_1164.ALL;
|
||||||
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
||||||
|
--use AddressDecoder.ALL;
|
||||||
|
|
||||||
use AddressDecoder.ALL;
|
|
||||||
|
|
||||||
-- Uncomment the following library declaration if using
|
|
||||||
-- arithmetic functions with Signed or Unsigned values
|
|
||||||
--use IEEE.NUMERIC_STD.ALL;
|
|
||||||
|
|
||||||
|
|
||||||
-- Uncomment the following library declaration if instantiating
|
|
||||||
-- any Xilinx primitives in this code.
|
|
||||||
--library UNISIM;
|
|
||||||
--use UNISIM.VComponents.all;
|
|
||||||
|
|
||||||
entity AppleIISd is
|
entity AppleIISd is
|
||||||
Port ( data : inout STD_LOGIC_VECTOR (7 downto 0);
|
Port (
|
||||||
|
data : inout STD_LOGIC_VECTOR (7 downto 0);
|
||||||
nrw : in STD_LOGIC;
|
nrw : in STD_LOGIC;
|
||||||
nirq : out STD_LOGIC;
|
nirq : out STD_LOGIC;
|
||||||
nreset : in STD_LOGIC;
|
nreset : in STD_LOGIC;
|
||||||
@ -126,12 +117,13 @@ architecture Behavioral of AppleIISd is
|
|||||||
|
|
||||||
-- spi clock
|
-- spi clock
|
||||||
signal clksrc: std_logic; -- clock source (phi2 or extclk)
|
signal clksrc: std_logic; -- clock source (phi2 or extclk)
|
||||||
|
-- TODO divcnt is not used at all??
|
||||||
signal divcnt: std_logic_vector(DIV_WIDTH-1 downto 0); -- divisor counter
|
signal divcnt: std_logic_vector(DIV_WIDTH-1 downto 0); -- divisor counter
|
||||||
|
|
||||||
signal shiftclk : std_logic;
|
signal shiftclk : std_logic;
|
||||||
|
|
||||||
component AddressDecoder
|
component AddressDecoder
|
||||||
port ( A8 : in std_logic;
|
port (
|
||||||
|
A8 : in std_logic;
|
||||||
A9 : in std_logic;
|
A9 : in std_logic;
|
||||||
A10 : in std_logic;
|
A10 : in std_logic;
|
||||||
CLK : in std_logic;
|
CLK : in std_logic;
|
||||||
@ -141,12 +133,14 @@ architecture Behavioral of AppleIISd is
|
|||||||
B8 : out std_logic;
|
B8 : out std_logic;
|
||||||
B9 : out std_logic;
|
B9 : out std_logic;
|
||||||
B10 : out std_logic;
|
B10 : out std_logic;
|
||||||
NOE : out std_logic);
|
NOE : out std_logic
|
||||||
|
);
|
||||||
end component;
|
end component;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
add_dec : AddressDecoder
|
add_dec : AddressDecoder
|
||||||
port map (A8=>a8,
|
port map (
|
||||||
|
A8=>a8,
|
||||||
A9=>a9,
|
A9=>a9,
|
||||||
A10=>a10,
|
A10=>a10,
|
||||||
CLK=>extclk,
|
CLK=>extclk,
|
||||||
@ -156,14 +150,13 @@ begin
|
|||||||
B8=>b8,
|
B8=>b8,
|
||||||
B9=>b9,
|
B9=>b9,
|
||||||
B10=>b10,
|
B10=>b10,
|
||||||
NOE=>noe);
|
NOE=>noe
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
led <= not (bsy or not slavesel); --'0'; --shifting2; --shiftdone; --shiftcnt(2);
|
led <= not (bsy or not slavesel);
|
||||||
ng <= ndev_sel and nio_sel and nio_stb;
|
ng <= ndev_sel and nio_sel and nio_stb;
|
||||||
inited <= inited_int and not card;
|
inited <= inited_int and not card;
|
||||||
--------------------------
|
|
||||||
|
|
||||||
bsy <= start_shifting or shifting2;
|
bsy <= start_shifting or shifting2;
|
||||||
|
|
||||||
process(start_shifting, shiftdone, shiftclk)
|
process(start_shifting, shiftdone, shiftclk)
|
||||||
@ -204,8 +197,7 @@ begin
|
|||||||
end if;
|
end if;
|
||||||
end process;
|
end process;
|
||||||
|
|
||||||
inproc: process(reset, shifting2,
|
inproc: process(reset, shifting2, shiftcnt, shiftclk, spidatain, int_miso)
|
||||||
shiftcnt, shiftclk, spidatain, int_miso)
|
|
||||||
begin
|
begin
|
||||||
if (reset='1') then
|
if (reset='1') then
|
||||||
spidatain <= (others => '0');
|
spidatain <= (others => '0');
|
||||||
@ -218,8 +210,7 @@ begin
|
|||||||
end if;
|
end if;
|
||||||
end process;
|
end process;
|
||||||
|
|
||||||
outproc: process(reset, shifting2, spidataout, cpol, cpha,
|
outproc: process(reset, shifting2, spidataout, cpol, cpha, shiftcnt, shiftclk)
|
||||||
shiftcnt, shiftclk)
|
|
||||||
begin
|
begin
|
||||||
if (reset='1') then
|
if (reset='1') then
|
||||||
int_mosi <= '1';
|
int_mosi <= '1';
|
||||||
@ -276,11 +267,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
if (reset='1') then
|
if (reset='1') then
|
||||||
divcnt <= divisor;
|
divcnt <= divisor;
|
||||||
--spiclk <= '0';
|
|
||||||
elsif (falling_edge(clksrc)) then
|
elsif (falling_edge(clksrc)) then
|
||||||
if (shiftclk = '1') then
|
if (shiftclk = '1') then
|
||||||
divcnt <= divisor;
|
divcnt <= divisor;
|
||||||
--spiclk <= not(spiclk);
|
|
||||||
else
|
else
|
||||||
divcnt <= divcnt - 1;
|
divcnt <= divcnt - 1;
|
||||||
end if;
|
end if;
|
||||||
@ -295,7 +284,7 @@ begin
|
|||||||
-- interface section
|
-- interface section
|
||||||
-- inputs
|
-- inputs
|
||||||
reset <= not (nreset);
|
reset <= not (nreset);
|
||||||
selected <= not(ndev_sel); -- and cpu_phi2;
|
selected <= not(ndev_sel);
|
||||||
is_read <= selected and nphi2 and nrw;
|
is_read <= selected and nphi2 and nrw;
|
||||||
int_din <= data;
|
int_din <= data;
|
||||||
|
|
||||||
@ -312,10 +301,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if (shiftdone = '1') then
|
if (shiftdone = '1') then
|
||||||
tc <= '1';
|
tc <= '1';
|
||||||
elsif (falling_edge(selected) and addr="00"
|
elsif (falling_edge(selected) and addr="00") then
|
||||||
--elsif (falling_edge(cpu_phi2) and selected='1' and addr="00"
|
|
||||||
--and nrw='1' -- both reads _and_ writes clear the interrupt
|
|
||||||
) then
|
|
||||||
tc <= '0';
|
tc <= '0';
|
||||||
end if;
|
end if;
|
||||||
end process;
|
end process;
|
||||||
@ -374,8 +360,8 @@ begin
|
|||||||
slaveinten <= '0';
|
slaveinten <= '0';
|
||||||
inited_int <= '0';
|
inited_int <= '0';
|
||||||
divisor <= (others => '0');
|
divisor <= (others => '0');
|
||||||
|
spidataout <= (others => '1');
|
||||||
elsif (falling_edge(selected) and nrw = '0') then
|
elsif (falling_edge(selected) and nrw = '0') then
|
||||||
--elsif (falling_edge(cpu_phi2) and selected='1' and nrw='0') then
|
|
||||||
case addr is
|
case addr is
|
||||||
when "00" => -- write SPI data out (see other process above)
|
when "00" => -- write SPI data out (see other process above)
|
||||||
spidataout <= int_din;
|
spidataout <= int_din;
|
||||||
|
Loading…
Reference in New Issue
Block a user