Line 1... |
Line 1... |
-- $Id: ibd_iist.vhd 350 2010-12-28 16:40:11Z mueller $
|
-- $Id: ibd_iist.vhd 427 2011-11-19 21:04:11Z mueller $
|
--
|
--
|
-- Copyright 2009-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2009-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(loc): IIST
|
-- Description: ibus dev(loc): IIST
|
--
|
--
|
-- Dependencies: -
|
-- Dependencies: -
|
-- 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 112 510 0 291 s 15.8
|
-- 2010-10-17 333 12.1 M53d xc3s1000-4 112 510 0 291 s 15.8
|
-- 2010-10-17 314 12.1 M53d xc3s1000-4 111 504 0 290 s 15.6
|
-- 2010-10-17 314 12.1 M53d xc3s1000-4 111 504 0 290 s 15.6
|
-- 2009-06-01 223 10.1.03 K39 xc3s1000-4 111 439 0 256 s 9.8
|
-- 2009-06-01 223 10.1.03 K39 xc3s1000-4 111 439 0 256 s 9.8
|
-- 2009-06-01 221 10.1.03 K39 xc3s1000-4 111 449 0 258 s 13.3
|
-- 2009-06-01 221 10.1.03 K39 xc3s1000-4 111 449 0 258 s 13.3
|
--
|
--
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2011-11-18 427 0.8.1 now numeric_std clean
|
-- 2010-10-17 333 0.8 use ibus V2 interface
|
-- 2010-10-17 333 0.8 use ibus V2 interface
|
-- 2009-06-07 224 0.7 send inverted stc_stp; remove pgc_err; honor msk_im
|
-- 2009-06-07 224 0.7 send inverted stc_stp; remove pgc_err; honor msk_im
|
-- also for dcf_dcf and exc_rte; add iist_mreq and
|
-- also for dcf_dcf and exc_rte; add iist_mreq and
|
-- iist_sreq, boot and lock interfaces
|
-- iist_sreq, boot and lock interfaces
|
-- 2009-06-05 223 0.6 level interrupt, parity logic, exc.ui logic
|
-- 2009-06-05 223 0.6 level interrupt, parity logic, exc.ui logic
|
Line 38... |
Line 39... |
-- 2009-06-01 221 0.5 Initial version (untested, lock&boot missing)
|
-- 2009-06-01 221 0.5 Initial version (untested, lock&boot missing)
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
|
|
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.iblib.all;
|
use work.iblib.all;
|
use work.ibdlib.all;
|
use work.ibdlib.all;
|
|
|
Line 67... |
Line 68... |
);
|
);
|
end ibd_iist;
|
end ibd_iist;
|
|
|
architecture syn of ibd_iist is
|
architecture syn of ibd_iist is
|
|
|
constant ibaddr_iist : slv16 := conv_std_logic_vector(8#177500#,16);
|
constant ibaddr_iist : slv16 := slv(to_unsigned(8#177500#,16));
|
|
|
constant tdlysnd : natural := 150; -- send delay timer
|
constant tdlysnd : natural := 150; -- send delay timer
|
|
|
constant ibaddr_acr : slv1 := "0"; -- acr address offset
|
constant ibaddr_acr : slv1 := "0"; -- acr address offset
|
constant ibaddr_adr : slv1 := "1"; -- adr address offset
|
constant ibaddr_adr : slv1 := "1"; -- adr address offset
|
Line 221... |
Line 222... |
|
|
begin
|
begin
|
|
|
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 -- BRESET is 1 for system and ibus reset
|
if BRESET = '1' or -- BRESET is 1 for system and ibus reset
|
R_REGS.req_clear='1' then
|
R_REGS.req_clear='1' then
|
R_REGS <= regs_init; --
|
R_REGS <= regs_init; --
|
if RESET = '0' then -- if RESET=0 we do just an ibus reset
|
if RESET = '0' then -- if RESET=0 we do just an ibus reset
|
R_REGS.pgf_pbf <= N_REGS.pgf_pbf; -- don't reset pg boot flags
|
R_REGS.pgf_pbf <= N_REGS.pgf_pbf; -- don't reset pg boot flags
|
Line 278... |
Line 279... |
r.stf_sif(i);
|
r.stf_sif(i);
|
end loop; -- i
|
end loop; -- i
|
|
|
tcnt256_end := '0';
|
tcnt256_end := '0';
|
if CE_USEC='1' and r.stc_enb='1'then -- if st enabled on every usec
|
if CE_USEC='1' and r.stc_enb='1'then -- if st enabled on every usec
|
n.tcnt256 := unsigned(r.tcnt256) + 1; -- advance 8 bit counter
|
n.tcnt256 := slv(unsigned(r.tcnt256) + 1); -- advance 8 bit counter
|
if unsigned(r.tcnt256) = 255 then -- if wrap
|
if unsigned(r.tcnt256) = 255 then -- if wrap
|
tcnt256_end := '1'; -- signal 256 usec passed
|
tcnt256_end := '1'; -- signal 256 usec passed
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
tcntsnd_end := '0';
|
tcntsnd_end := '0';
|
n.tcntsnd := unsigned(r.tcntsnd) + 1; -- advance send timer counter
|
n.tcntsnd := slv(unsigned(r.tcntsnd) + 1); -- advance send timer counter
|
if unsigned(r.tcntsnd) = tdlysnd-1 then -- if delay time reached
|
if unsigned(r.tcntsnd) = tdlysnd-1 then -- if delay time reached
|
tcntsnd_end := '1'; -- signal end
|
tcntsnd_end := '1'; -- signal end
|
end if;
|
end if;
|
|
|
eff_id := SID; -- effective self-id, normally SID
|
eff_id := SID; -- effective self-id, normally SID
|
Line 557... |
Line 558... |
|
|
end case;
|
end case;
|
|
|
if unsigned(r.acr_ac) <= unsigned(ac_exc) then -- if ac 0,..,10
|
if unsigned(r.acr_ac) <= unsigned(ac_exc) then -- if ac 0,..,10
|
if IB_MREQ.rmw = '0' then -- if not 1st part of rmw
|
if IB_MREQ.rmw = '0' then -- if not 1st part of rmw
|
n.acr_ac := unsigned(r.acr_ac) + 1; -- autoincrement
|
n.acr_ac := slv(unsigned(r.acr_ac) + 1); -- autoincrement
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
end if;
|
end if;
|
|
|
end if;
|
end if;
|
|
|
-- sanity timer
|
-- sanity timer
|
|
|
if tcnt256_end = '1' then -- if 256 usec expired (and enabled)
|
if tcnt256_end = '1' then -- if 256 usec expired (and enabled)
|
n.stc_count := unsigned(r.stc_count) - 1;
|
n.stc_count := slv(unsigned(r.stc_count) - 1);
|
if unsigned(r.stc_count) = 0 then -- if sanity timer expired
|
if unsigned(r.stc_count) = 0 then -- if sanity timer expired
|
n.stc_tmo := '1'; -- set timeout flag
|
n.stc_tmo := '1'; -- set timeout flag
|
n.req_stsnd := '1'; -- request st transmit
|
n.req_stsnd := '1'; -- request st transmit
|
if r.stc_lke = '1' then -- if lockup enabled
|
if r.stc_lke = '1' then -- if lockup enabled
|
n.req_lock := '1'; -- request lockup
|
n.req_lock := '1'; -- request lockup
|
Line 596... |
Line 597... |
eff_bus(i).imask(2) xor eff_bus(i).imask(3) xor
|
eff_bus(i).imask(2) xor eff_bus(i).imask(3) xor
|
eff_bus(i).bmask(0) xor eff_bus(i).bmask(1) xor
|
eff_bus(i).bmask(0) xor eff_bus(i).bmask(1) xor
|
eff_bus(i).bmask(2) xor eff_bus(i).bmask(3) xor
|
eff_bus(i).bmask(2) xor eff_bus(i).bmask(3) xor
|
not eff_bus(i).par;
|
not eff_bus(i).par;
|
|
|
act_ibit := eff_bus(i).imask(conv_integer(unsigned(eff_id)));
|
act_ibit := eff_bus(i).imask(to_integer(unsigned(eff_id)));
|
act_bbit := eff_bus(i).bmask(conv_integer(unsigned(eff_id)));
|
act_bbit := eff_bus(i).bmask(to_integer(unsigned(eff_id)));
|
|
|
n.dcf_brk(i) := eff_bus(i).dcf; -- trace dcf state in brk
|
n.dcf_brk(i) := eff_bus(i).dcf; -- trace dcf state in brk
|
|
|
if eff_bus(i).dcf = '1' then -- if disconnected
|
if eff_bus(i).dcf = '1' then -- if disconnected
|
if r.msk_im(i) = '0' then -- if not disabled
|
if r.msk_im(i) = '0' then -- if not disabled
|