Line 1... |
Line 1... |
-- $Id: rbd_rbmon.vhd 387 2011-07-03 17:24:52Z mueller $
|
-- $Id: rbd_rbmon.vhd 427 2011-11-19 21:04:11Z mueller $
|
--
|
--
|
-- Copyright 2010-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2010-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
|
Line 18... |
Line 18... |
-- Dependencies: memlib/ram_1swsr_wfirst_gen
|
-- Dependencies: memlib/ram_1swsr_wfirst_gen
|
--
|
--
|
-- Test bench: rlink/tb/tb_rlink_tba_ttcombo
|
-- Test bench: rlink/tb/tb_rlink_tba_ttcombo
|
--
|
--
|
-- Target Devices: generic
|
-- Target Devices: generic
|
-- Tool versions: xst 12.1; ghdl 0.29
|
-- Tool versions: xst 12.1, 13.1; ghdl 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-12-27 349 12.1 M53d xc3s1000-4 95 228 - 154 s 10.4
|
-- 2010-12-27 349 12.1 M53d xc3s1000-4 95 228 - 154 s 10.4
|
--
|
--
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2011-11-19 427 1.0.3 now numeric_std clean
|
-- 2011-03-27 374 1.0.2 rename ncyc -> nbusy because it counts busy cycles
|
-- 2011-03-27 374 1.0.2 rename ncyc -> nbusy because it counts busy cycles
|
-- 2010-12-31 352 1.0.1 simplify irb_ack logic
|
-- 2010-12-31 352 1.0.1 simplify irb_ack logic
|
-- 2010-12-27 349 1.0 Initial version
|
-- 2010-12-27 349 1.0 Initial version
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
--
|
--
|
Line 61... |
Line 62... |
--
|
--
|
|
|
|
|
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.rblib.all;
|
use work.rblib.all;
|
|
|
entity rbd_rbmon is -- rbus dev: rbus monitor
|
entity rbd_rbmon is -- rbus dev: rbus monitor
|
generic (
|
generic (
|
RB_ADDR : slv8 := conv_std_logic_vector(2#11111100#,8);
|
RB_ADDR : slv8 := slv(to_unsigned(2#11111100#,8));
|
AWIDTH : positive := 9);
|
AWIDTH : positive := 9);
|
port (
|
port (
|
CLK : in slbit; -- clock
|
CLK : in slbit; -- clock
|
RESET : in slbit; -- reset
|
RESET : in slbit; -- reset
|
RB_MREQ : in rb_mreq_type; -- rbus: request
|
RB_MREQ : in rb_mreq_type; -- rbus: request
|
Line 195... |
Line 196... |
DO => BRAM0_DO
|
DO => BRAM0_DO
|
);
|
);
|
|
|
proc_regs: process (CLK)
|
proc_regs: process (CLK)
|
begin
|
begin
|
if CLK'event and CLK='1' then
|
if rising_edge(CLK) then
|
if RESET = '1' then
|
if RESET = '1' then
|
R_REGS <= regs_init;
|
R_REGS <= regs_init;
|
else
|
else
|
R_REGS <= N_REGS;
|
R_REGS <= N_REGS;
|
end if;
|
end if;
|
Line 280... |
Line 281... |
when rbaddr_data =>
|
when rbaddr_data =>
|
if r.go='1' or RB_MREQ.we='1' then
|
if r.go='1' or RB_MREQ.we='1' then
|
irb_err := '1';
|
irb_err := '1';
|
end if;
|
end if;
|
if RB_MREQ.re = '1' then
|
if RB_MREQ.re = '1' then
|
n.waddr := unsigned(r.waddr) + 1;
|
n.waddr := slv(unsigned(r.waddr) + 1);
|
if r.waddr = "11" then
|
if r.waddr = "11" then
|
laddr_inc := '1';
|
laddr_inc := '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
Line 350... |
Line 351... |
else -- if non-initial cycles
|
else -- if non-initial cycles
|
if RB_SRES_SUM.err = '1' then -- keep track of err flags
|
if RB_SRES_SUM.err = '1' then -- keep track of err flags
|
n.rberr := '1';
|
n.rberr := '1';
|
end if;
|
end if;
|
if r.rbnbusy /= rbnbusylast then -- and count
|
if r.rbnbusy /= rbnbusylast then -- and count
|
n.rbnbusy := unsigned(r.rbnbusy) + 1;
|
n.rbnbusy := slv(unsigned(r.rbnbusy) + 1);
|
end if;
|
end if;
|
end if;
|
end if;
|
n.rbnak := not RB_SRES_SUM.ack;
|
n.rbnak := not RB_SRES_SUM.ack;
|
n.rbtout := RB_SRES_SUM.busy;
|
n.rbtout := RB_SRES_SUM.busy;
|
|
|
Line 366... |
Line 367... |
end if;
|
end if;
|
if r.rbtake_1 = '1' then -- rbus transaction just ended
|
if r.rbtake_1 = '1' then -- rbus transaction just ended
|
n.rbndly := (others=>'0'); -- clear delay counter
|
n.rbndly := (others=>'0'); -- clear delay counter
|
else -- just idle
|
else -- just idle
|
if r.rbndly /= rbndlylast then -- count cycles
|
if r.rbndly /= rbndlylast then -- count cycles
|
n.rbndly := unsigned(r.rbndly) + 1;
|
n.rbndly := slv(unsigned(r.rbndly) + 1);
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if laddr_inc = '1' then
|
if laddr_inc = '1' then
|
n.laddr := unsigned(r.laddr) + 1;
|
n.laddr := slv(unsigned(r.laddr) + 1);
|
if r.go='1' and r.laddr=laddrlast then
|
if r.go='1' and r.laddr=laddrlast then
|
n.wrap := '1';
|
n.wrap := '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|