Line 1... |
Line 1... |
-- $Id: ibdr_pc11.vhd 314 2010-07-09 17:38:41Z mueller $
|
-- $Id: ibdr_pc11.vhd 335 2010-10-24 22:24:23Z mueller $
|
--
|
--
|
-- Copyright 2009-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2009-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): PC11
|
-- Description: ibus dev(rem): PC11
|
--
|
--
|
-- Dependencies: -
|
-- Dependencies: -
|
-- Test bench: xxdp: zpcae0
|
-- Test bench: xxdp: zpcae0
|
-- 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 26 97 0 57 s 6.0
|
-- 2009-06-28 230 10.1.03 K39 xc3s1000-4 25 92 0 54 s 4.9
|
-- 2009-06-28 230 10.1.03 K39 xc3s1000-4 25 92 0 54 s 4.9
|
--
|
--
|
-- 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-06-28 230 1.0 prdy now inits to '1'; setting err bit in csr now
|
-- 2009-06-28 230 1.0 prdy now inits to '1'; setting err bit in csr now
|
-- causes interrupt, if enabled; validated with zpcae0
|
-- causes interrupt, if enabled; validated with zpcae0
|
-- 2009-06-01 221 0.9 Initial version (untested)
|
-- 2009-06-01 221 0.9 Initial version (untested)
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
Line 44... |
Line 47... |
-- fixed address: 177550
|
-- fixed address: 177550
|
port (
|
port (
|
CLK : in slbit; -- clock
|
CLK : in slbit; -- clock
|
RESET : in slbit; -- system reset
|
RESET : in slbit; -- system reset
|
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_PTR : out slbit; -- interrupt request, reader
|
EI_REQ_PTR : out slbit; -- interrupt request, reader
|
EI_REQ_PTP : out slbit; -- interrupt request, punch
|
EI_REQ_PTP : out slbit; -- interrupt request, punch
|
EI_ACK_PTR : in slbit; -- interrupt acknowledge, reader
|
EI_ACK_PTR : in slbit; -- interrupt acknowledge, reader
|
Line 77... |
Line 80... |
|
|
constant pbuf_ibf_pval : integer := 8;
|
constant pbuf_ibf_pval : integer := 8;
|
constant pbuf_ibf_rbusy : integer := 9;
|
constant pbuf_ibf_rbusy : integer := 9;
|
|
|
type regs_type is record -- state registers
|
type regs_type is record -- state registers
|
|
ibsel : slbit; -- ibus select
|
rerr : slbit; -- rcsr: reader error
|
rerr : slbit; -- rcsr: reader error
|
rbusy : slbit; -- rcsr: reader busy
|
rbusy : slbit; -- rcsr: reader busy
|
rdone : slbit; -- rcsr: reader done
|
rdone : slbit; -- rcsr: reader done
|
rie : slbit; -- rcsr: reader interrupt enable
|
rie : slbit; -- rcsr: reader interrupt enable
|
rbuf : slv8; -- rbuf:
|
rbuf : slv8; -- rbuf:
|
Line 91... |
Line 95... |
pbuf : slv8; -- pbuf:
|
pbuf : slv8; -- pbuf:
|
pintreq : slbit; -- ptp interrupt request
|
pintreq : slbit; -- ptp interrupt request
|
end record regs_type;
|
end record regs_type;
|
|
|
constant regs_init : regs_type := (
|
constant regs_init : regs_type := (
|
|
'0', -- ibsel
|
'1', -- rerr (init=1!)
|
'1', -- rerr (init=1!)
|
'0','0','0', -- rbusy,rdone,rie
|
'0','0','0', -- rbusy,rdone,rie
|
(others=>'0'), -- rbuf
|
(others=>'0'), -- rbuf
|
'0', -- rintreq
|
'0', -- rintreq
|
'1', -- perr (init=1!)
|
'1', -- perr (init=1!)
|
Line 125... |
Line 130... |
end process proc_regs;
|
end process proc_regs;
|
|
|
proc_next : process (R_REGS, IB_MREQ, EI_ACK_PTR, EI_ACK_PTP)
|
proc_next : process (R_REGS, IB_MREQ, EI_ACK_PTR, EI_ACK_PTP)
|
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 idout : slv16 := (others=>'0');
|
variable idout : slv16 := (others=>'0');
|
|
variable ibreq : slbit := '0';
|
variable ibrd : slbit := '0';
|
variable ibrd : slbit := '0';
|
variable ibw0 : slbit := '0';
|
variable ibw0 : slbit := '0';
|
variable ibw1 : slbit := '0';
|
variable ibw1 : slbit := '0';
|
variable ilam : slbit := '0';
|
variable ilam : slbit := '0';
|
begin
|
begin
|
|
|
r := R_REGS;
|
r := R_REGS;
|
n := R_REGS;
|
n := R_REGS;
|
|
|
ibsel := '0';
|
|
idout := (others=>'0');
|
idout := (others=>'0');
|
ibrd := not IB_MREQ.we;
|
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;
|
ilam := '0';
|
ilam := '0';
|
|
|
-- 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 3)=ibaddr_pc11(12 downto 3) then
|
IB_MREQ.addr(12 downto 3)=ibaddr_pc11(12 downto 3) then
|
ibsel := '1';
|
n.ibsel := '1';
|
end if;
|
end if;
|
|
|
-- ibus transactions
|
-- ibus transactions
|
if ibsel = '1' then
|
if r.ibsel = '1' then
|
case IB_MREQ.addr(2 downto 1) is
|
case IB_MREQ.addr(2 downto 1) is
|
|
|
when ibaddr_rcsr => -- RCSR -- reader control status -----
|
when ibaddr_rcsr => -- RCSR -- reader control status -----
|
|
|
idout(rcsr_ibf_rerr) := r.rerr;
|
idout(rcsr_ibf_rerr) := r.rerr;
|
Line 299... |
Line 305... |
end if;
|
end if;
|
|
|
N_REGS <= n;
|
N_REGS <= n;
|
|
|
IB_SRES.dout <= idout;
|
IB_SRES.dout <= idout;
|
IB_SRES.ack <= ibsel;
|
IB_SRES.ack <= r.ibsel and ibreq;
|
IB_SRES.busy <= '0';
|
IB_SRES.busy <= '0';
|
|
|
RRI_LAM <= ilam;
|
RB_LAM <= ilam;
|
EI_REQ_PTR <= r.rintreq;
|
EI_REQ_PTR <= r.rintreq;
|
EI_REQ_PTP <= r.pintreq;
|
EI_REQ_PTP <= r.pintreq;
|
|
|
end process proc_next;
|
end process proc_next;
|
|
|