Line 1... |
Line 1... |
-- $Id: ibdr_rk11.vhd 317 2010-07-22 19:36:56Z mueller $
|
-- $Id: ibdr_rk11.vhd 335 2010-10-24 22:24:23Z mueller $
|
--
|
--
|
-- Copyright 2008-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2008-2010 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
|
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; ghdl 0.18-0.25
|
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2, 12.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 M53 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
|
|
-- 2010-10-23 335 1.2.1 rename RRI_LAM->RB_LAM;
|
|
-- 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.
|
-- 2009-05-21 217 1.0.8 cancel pending interrupt requests when IE=0
|
-- 2009-05-21 217 1.0.8 cancel pending interrupt requests when IE=0
|
-- 2009-05-16 216 1.0.7 BUGFIX: correct interrupt on IE 0->1 logic
|
-- 2009-05-16 216 1.0.7 BUGFIX: correct interrupt on IE 0->1 logic
|
Line 56... |
Line 59... |
-- fixed address: 177400
|
-- fixed address: 177400
|
port (
|
port (
|
CLK : in slbit; -- clock
|
CLK : in slbit; -- clock
|
CE_MSEC : in slbit; -- msec pulse
|
CE_MSEC : in slbit; -- msec pulse
|
BRESET : in slbit; -- ibus reset
|
BRESET : in slbit; -- ibus reset
|
RRI_LAM : out slbit; -- remote attention
|
RB_LAM : out slbit; -- remote attention
|
IB_MREQ : in ib_mreq_type; -- ibus request
|
IB_MREQ : in ib_mreq_type; -- ibus request
|
IB_SRES : out ib_sres_type; -- ibus response
|
IB_SRES : out ib_sres_type; -- ibus response
|
EI_REQ : out slbit; -- interrupt request
|
EI_REQ : out slbit; -- interrupt request
|
EI_ACK : in slbit -- interrupt acknowledge
|
EI_ACK : in slbit -- interrupt acknowledge
|
);
|
);
|
Line 111... |
Line 114... |
s_idle,
|
s_idle,
|
s_init
|
s_init
|
);
|
);
|
|
|
type regs_type is record -- state registers
|
type regs_type is record -- state registers
|
|
ibsel : slbit; -- ibus select
|
state : state_type; -- state
|
state : state_type; -- state
|
id : slv3; -- rkds: drive id of search done
|
id : slv3; -- rkds: drive id of search done
|
sc : slv4; -- rkds: sector counter
|
sc : slv4; -- rkds: sector counter
|
cse : slbit; -- rker: check sum error
|
cse : slbit; -- rker: check sum error
|
wce : slbit; -- rker: write check error
|
wce : slbit; -- rker: write check error
|
Line 132... |
Line 136... |
creset : slbit; -- control reset flag
|
creset : slbit; -- control reset flag
|
crdone : slbit; -- control reset done since last fdone
|
crdone : slbit; -- control reset done since last fdone
|
end record regs_type;
|
end record regs_type;
|
|
|
constant regs_init : regs_type := (
|
constant regs_init : regs_type := (
|
s_init, --
|
'0', -- ibsel
|
|
s_init, -- state
|
(others=>'0'), -- id
|
(others=>'0'), -- id
|
(others=>'0'), -- sc
|
(others=>'0'), -- sc
|
'0','0', -- cse, wce
|
'0','0', -- cse, wce
|
'0','0','0', -- he, scp, maint
|
'0','0','0', -- he, scp, maint
|
'1', -- rdy (SET TO 1)
|
'1', -- rdy (SET TO 1)
|
Line 198... |
Line 203... |
end process proc_regs;
|
end process proc_regs;
|
|
|
proc_next : process (R_REGS, CE_MSEC, IB_MREQ, MEM_DOUT, EI_ACK)
|
proc_next : process (R_REGS, CE_MSEC, IB_MREQ, MEM_DOUT, EI_ACK)
|
variable r : regs_type := regs_init;
|
variable r : regs_type := regs_init;
|
variable n : regs_type := regs_init;
|
variable n : regs_type := regs_init;
|
variable ibsel : slbit := '0';
|
variable ibhold : slbit := '0';
|
variable ibbusy : slbit := '0';
|
|
variable icrip : slbit := '0';
|
variable icrip : slbit := '0';
|
variable idout : slv16 := (others=>'0');
|
variable idout : slv16 := (others=>'0');
|
variable ibrd : slbit := '0';
|
|
variable ibrem : slbit := '0';
|
variable ibrem : slbit := '0';
|
|
variable ibreq : slbit := '0';
|
|
variable ibrd : slbit := '0';
|
variable ibw0 : slbit := '0';
|
variable ibw0 : slbit := '0';
|
variable ibw1 : slbit := '0';
|
variable ibw1 : slbit := '0';
|
variable ibwrem : slbit := '0';
|
variable ibwrem : slbit := '0';
|
variable ilam : slbit := '0';
|
variable ilam : slbit := '0';
|
variable iscval : slbit := '0';
|
variable iscval : slbit := '0';
|
Line 221... |
Line 226... |
begin
|
begin
|
|
|
r := R_REGS;
|
r := R_REGS;
|
n := R_REGS;
|
n := R_REGS;
|
|
|
ibsel := '0';
|
ibhold := '0';
|
ibbusy := '0';
|
|
icrip := '0';
|
icrip := '0';
|
idout := (others=>'0');
|
idout := (others=>'0');
|
ibrd := not IB_MREQ.we;
|
|
ibrem := IB_MREQ.racc or r.maint;
|
ibrem := IB_MREQ.racc or r.maint;
|
|
ibreq := IB_MREQ.re or IB_MREQ.we;
|
|
ibrd := IB_MREQ.re;
|
ibw0 := IB_MREQ.we and IB_MREQ.be0;
|
ibw0 := IB_MREQ.we and IB_MREQ.be0;
|
ibw1 := IB_MREQ.we and IB_MREQ.be1;
|
ibw1 := IB_MREQ.we and IB_MREQ.be1;
|
ibwrem := IB_MREQ.we and ibrem;
|
ibwrem := IB_MREQ.we and ibrem;
|
ilam := '0';
|
ilam := '0';
|
iscval := '0';
|
iscval := '0';
|
Line 241... |
Line 246... |
imem_we1 := '0';
|
imem_we1 := '0';
|
imem_addr := '0' & IB_MREQ.addr(3 downto 1);
|
imem_addr := '0' & IB_MREQ.addr(3 downto 1);
|
imem_din := IB_MREQ.din;
|
imem_din := IB_MREQ.din;
|
|
|
-- ibus address decoder
|
-- ibus address decoder
|
if IB_MREQ.req = '1' and
|
n.ibsel := '0';
|
|
if IB_MREQ.aval = '1' and
|
IB_MREQ.addr(12 downto 4)=ibaddr_rk11(12 downto 4) then
|
IB_MREQ.addr(12 downto 4)=ibaddr_rk11(12 downto 4) then
|
ibsel := '1';
|
n.ibsel := '1';
|
end if;
|
end if;
|
|
|
-- internal state machine (for control reset)
|
-- internal state machine (for control reset)
|
case r.state is
|
case r.state is
|
when s_idle =>
|
when s_idle =>
|
null;
|
null;
|
|
|
when s_init =>
|
when s_init =>
|
ibbusy := ibsel; -- keep req pending if selected
|
ibhold := r.ibsel; -- hold ibus when controller busy
|
ibsel := '0'; -- but don't process selection
|
|
icrip := '1';
|
icrip := '1';
|
n.icnt := unsigned(r.icnt) + 1;
|
n.icnt := 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;
|
Line 265... |
Line 270... |
when others => null;
|
when others => null;
|
end case;
|
end case;
|
|
|
|
|
-- ibus transactions
|
-- ibus transactions
|
if ibsel = '1' then
|
|
|
if r.ibsel='1' and ibhold='0' then -- selected and not holding
|
idout := MEM_DOUT;
|
idout := MEM_DOUT;
|
imem_we0 := ibw0;
|
imem_we0 := ibw0;
|
imem_we1 := ibw1;
|
imem_we1 := ibw1;
|
|
|
case IB_MREQ.addr(3 downto 1) is
|
case IB_MREQ.addr(3 downto 1) is
|
Line 460... |
Line 466... |
MEM_1_WE <= imem_we1;
|
MEM_1_WE <= imem_we1;
|
MEM_ADDR <= imem_addr;
|
MEM_ADDR <= imem_addr;
|
MEM_DIN <= imem_din;
|
MEM_DIN <= imem_din;
|
|
|
IB_SRES.dout <= idout;
|
IB_SRES.dout <= idout;
|
IB_SRES.ack <= ibsel;
|
IB_SRES.ack <= r.ibsel and ibreq;
|
IB_SRES.busy <= ibbusy;
|
IB_SRES.busy <= ibhold and ibreq;
|
|
|
RRI_LAM <= ilam;
|
RB_LAM <= ilam;
|
EI_REQ <= iei_req;
|
EI_REQ <= iei_req;
|
|
|
end process proc_next;
|
end process proc_next;
|
|
|
|
|