Line 1... |
Line 1... |
-- $Id: ibdr_rk11.vhd 350 2010-12-28 16:40:11Z mueller $
|
-- $Id: ibdr_rk11.vhd 427 2011-11-19 21:04:11Z mueller $
|
--
|
--
|
-- Copyright 2008-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2008-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
--
|
--
|
-- This program is free software; you may redistribute and/or modify it under
|
-- This program is free software; you may redistribute and/or modify it under
|
-- the terms of the GNU General Public License as published by the Free
|
-- the terms of the GNU General Public License as published by the Free
|
-- Software Foundation, either version 2, or at your option any later version.
|
-- Software Foundation, either version 2, or at your option any later version.
|
--
|
--
|
Line 16... |
Line 16... |
-- Description: ibus dev(rem): RK11-A/B
|
-- Description: ibus dev(rem): RK11-A/B
|
--
|
--
|
-- Dependencies: ram_1swar_gen
|
-- Dependencies: ram_1swar_gen
|
-- Test bench: -
|
-- Test bench: -
|
-- Target Devices: generic
|
-- Target Devices: generic
|
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2, 12.1; ghdl 0.18-0.29
|
-- Tool versions: xst 8.2, 9.1, 9.2, 12.1, 13.1; ghdl 0.18-0.29
|
--
|
--
|
-- Synthesized (xst):
|
-- Synthesized (xst):
|
-- Date Rev ise Target flop lutl lutm slic t peri
|
-- Date Rev ise Target flop lutl lutm slic t peri
|
-- 2010-10-17 333 12.1 M53d xc3s1000-4 46 248 16 137 s 7.2
|
-- 2010-10-17 333 12.1 M53d xc3s1000-4 46 248 16 137 s 7.2
|
-- 2009-06-01 221 10.1.03 K39 xc3s1000-4 46 249 16 148 s 7.1
|
-- 2009-06-01 221 10.1.03 K39 xc3s1000-4 46 249 16 148 s 7.1
|
-- 2008-01-06 111 8.2.03 I34 xc3s1000-4 36 189 16 111 s 6.0
|
-- 2008-01-06 111 8.2.03 I34 xc3s1000-4 36 189 16 111 s 6.0
|
--
|
--
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2011-11-18 427 1.2.2 now numeric_std clean
|
-- 2010-10-23 335 1.2.1 rename RRI_LAM->RB_LAM;
|
-- 2010-10-23 335 1.2.1 rename RRI_LAM->RB_LAM;
|
-- 2010-10-17 333 1.2 use ibus V2 interface
|
-- 2010-10-17 333 1.2 use ibus V2 interface
|
-- 2010-06-11 303 1.1 use IB_MREQ.racc instead of RRI_REQ
|
-- 2010-06-11 303 1.1 use IB_MREQ.racc instead of RRI_REQ
|
-- 2009-05-24 219 1.0.9 add CE_MSEC input; inc sector counter every msec
|
-- 2009-05-24 219 1.0.9 add CE_MSEC input; inc sector counter every msec
|
-- BUGFIX: sector counter now counts 000,...,013.
|
-- BUGFIX: sector counter now counts 000,...,013.
|
Line 46... |
Line 47... |
-- 2008-01-06 111 1.0 Initial version
|
-- 2008-01-06 111 1.0 Initial version
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.numeric_std.all;
|
|
|
use work.slvtypes.all;
|
use work.slvtypes.all;
|
use work.memlib.all;
|
use work.memlib.all;
|
use work.iblib.all;
|
use work.iblib.all;
|
|
|
Line 69... |
Line 70... |
);
|
);
|
end ibdr_rk11;
|
end ibdr_rk11;
|
|
|
architecture syn of ibdr_rk11 is
|
architecture syn of ibdr_rk11 is
|
|
|
constant ibaddr_rk11 : slv16 := conv_std_logic_vector(8#177400#,16);
|
constant ibaddr_rk11 : slv16 := slv(to_unsigned(8#177400#,16));
|
|
|
constant ibaddr_rkds : slv3 := "000"; -- rkds address offset
|
constant ibaddr_rkds : slv3 := "000"; -- rkds address offset
|
constant ibaddr_rker : slv3 := "001"; -- rker address offset
|
constant ibaddr_rker : slv3 := "001"; -- rker address offset
|
constant ibaddr_rkcs : slv3 := "010"; -- rkcs address offset
|
constant ibaddr_rkcs : slv3 := "010"; -- rkcs address offset
|
constant ibaddr_rkwc : slv3 := "011"; -- rkwc address offset
|
constant ibaddr_rkwc : slv3 := "011"; -- rkwc address offset
|
Line 188... |
Line 189... |
DI => MEM_DIN(ibf_byte0),
|
DI => MEM_DIN(ibf_byte0),
|
DO => MEM_DOUT(ibf_byte0));
|
DO => MEM_DOUT(ibf_byte0));
|
|
|
proc_regs: process (CLK)
|
proc_regs: process (CLK)
|
begin
|
begin
|
if CLK'event and CLK='1' then
|
if rising_edge(CLK) then
|
if BRESET='1' or R_REGS.creset='1' then
|
if BRESET='1' or R_REGS.creset='1' then
|
R_REGS <= regs_init;
|
R_REGS <= regs_init;
|
if R_REGS.creset = '1' then
|
if R_REGS.creset = '1' then
|
R_REGS.sbusy <= N_REGS.sbusy;
|
R_REGS.sbusy <= N_REGS.sbusy;
|
end if;
|
end if;
|
Line 260... |
Line 261... |
null;
|
null;
|
|
|
when s_init =>
|
when s_init =>
|
ibhold := r.ibsel; -- hold ibus when controller busy
|
ibhold := r.ibsel; -- hold ibus when controller busy
|
icrip := '1';
|
icrip := '1';
|
n.icnt := unsigned(r.icnt) + 1;
|
n.icnt := slv(unsigned(r.icnt) + 1);
|
if unsigned(r.icnt) = 7 then
|
if unsigned(r.icnt) = 7 then
|
n.state := s_idle;
|
n.state := s_idle;
|
end if;
|
end if;
|
|
|
when others => null;
|
when others => null;
|
Line 294... |
Line 295... |
idout(rkds_ibf_scsa) := '0';
|
idout(rkds_ibf_scsa) := '0';
|
end if;
|
end if;
|
idout(rkds_ibf_sc) := r.sc;
|
idout(rkds_ibf_sc) := r.sc;
|
end if;
|
end if;
|
|
|
if r.sbusy(conv_integer(unsigned(imem_addr(2 downto 0))))='1' then
|
if r.sbusy(to_integer(unsigned(imem_addr(2 downto 0))))='1' then
|
idout(rkds_ibf_adry) := '0'; -- clear drive access rdy
|
idout(rkds_ibf_adry) := '0'; -- clear drive access rdy
|
end if;
|
end if;
|
|
|
if ibwrem = '1' then -- rem write ? than update ds data
|
if ibwrem = '1' then -- rem write ? than update ds data
|
imem_addr := '1' & IB_MREQ.din(rkds_ibf_id); -- use id field as addr
|
imem_addr := '1' & IB_MREQ.din(rkds_ibf_id); -- use id field as addr
|
Line 357... |
Line 358... |
ilam := '1'; -- issue lam
|
ilam := '1'; -- issue lam
|
end if;
|
end if;
|
|
|
if unsigned(IB_MREQ.din(rkcs_ibf_func))=4 or -- if seek
|
if unsigned(IB_MREQ.din(rkcs_ibf_func))=4 or -- if seek
|
unsigned(IB_MREQ.din(rkcs_ibf_func))=6 then -- or drive reset
|
unsigned(IB_MREQ.din(rkcs_ibf_func))=6 then -- or drive reset
|
n.sbusy(conv_integer(unsigned(r.drsel))) := '1'; -- set busy
|
n.sbusy(to_integer(unsigned(r.drsel))) := '1'; -- set busy
|
end if;
|
end if;
|
|
|
end if;
|
end if;
|
else -- GO=0
|
else -- GO=0
|
if r.ide = '0' and -- if ide now 0
|
if r.ide = '0' and -- if ide now 0
|
Line 439... |
Line 440... |
n.scp := '0'; -- clear scp flag, is command end
|
n.scp := '0'; -- clear scp flag, is command end
|
n.fireq := '0';
|
n.fireq := '0';
|
elsif iscval = '1' then -- was a seek done
|
elsif iscval = '1' then -- was a seek done
|
n.scp := '1'; -- signal seek complete interrupt
|
n.scp := '1'; -- signal seek complete interrupt
|
n.id := iscid; -- load id
|
n.id := iscid; -- load id
|
n.sireq(conv_integer(unsigned(iscid))) := '0'; -- reset sireq bit
|
n.sireq(to_integer(unsigned(iscid))) := '0'; -- reset sireq bit
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if icrip = '1' then -- control reset in progress ?
|
if icrip = '1' then -- control reset in progress ?
|
imem_addr := '0' & r.icnt; -- use icnt as addr
|
imem_addr := '0' & r.icnt; -- use icnt as addr
|
Line 454... |
Line 455... |
|
|
if CE_MSEC = '1' then -- advance sector counter every msec
|
if CE_MSEC = '1' then -- advance sector counter every msec
|
if unsigned(r.sc) = 8#13# then -- sector counter (count to 8#13#)
|
if unsigned(r.sc) = 8#13# then -- sector counter (count to 8#13#)
|
n.sc := (others=>'0');
|
n.sc := (others=>'0');
|
else
|
else
|
n.sc := unsigned(r.sc) + 1;
|
n.sc := slv(unsigned(r.sc) + 1);
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
N_REGS <= n;
|
N_REGS <= n;
|
|
|