Line 1... |
Line 1... |
-- $Id: rbd_tester.vhd 369 2011-03-13 22:39:26Z mueller $
|
-- $Id: rbd_tester.vhd 427 2011-11-19 21:04:11Z mueller $
|
--
|
--
|
-- Copyright 2010- 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
|
-- 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 18... |
Line 18... |
-- Dependencies: memlib/fifo_1c_dram_raw
|
-- Dependencies: memlib/fifo_1c_dram_raw
|
--
|
--
|
-- Test bench: rlink/tb/tb_rlink (used as test target)
|
-- Test bench: rlink/tb/tb_rlink (used as test target)
|
--
|
--
|
-- 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-12 344 12.1 M53d xc3s1000-4 78 204 32 133 s 8.0
|
-- 2010-12-12 344 12.1 M53d xc3s1000-4 78 204 32 133 s 8.0
|
-- 2010-12-04 343 12.1 M53d xc3s1000-4 75 214 32 136 s 9.3
|
-- 2010-12-04 343 12.1 M53d xc3s1000-4 75 214 32 136 s 9.3
|
--
|
--
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2011-11-19 427 1.0.4 now numeric_std clean
|
-- 2010-12-31 352 1.0.3 simplify irb_ack logic
|
-- 2010-12-31 352 1.0.3 simplify irb_ack logic
|
-- 2010-12-29 351 1.0.2 default addr 111101xx->111100xx
|
-- 2010-12-29 351 1.0.2 default addr 111101xx->111100xx
|
-- 2010-12-12 344 1.0.1 send 0101.. on busy or err; fix init and busy logic
|
-- 2010-12-12 344 1.0.1 send 0101.. on busy or err; fix init and busy logic
|
-- 2010-12-04 343 1.0 Initial version
|
-- 2010-12-04 343 1.0 Initial version
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
Line 49... |
Line 50... |
-- 9:00 r: return cycle length of last access
|
-- 9:00 r: return cycle length of last access
|
--
|
--
|
|
|
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_tester is -- rbus dev: rbus tester
|
entity rbd_tester is -- rbus dev: rbus tester
|
-- complete rrirp_aif interface
|
-- complete rrirp_aif interface
|
generic (
|
generic (
|
RB_ADDR : slv8 := conv_std_logic_vector(2#11110000#,8));
|
RB_ADDR : slv8 := slv(to_unsigned(2#11110000#,8)));
|
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
|
RB_SRES : out rb_sres_type; -- rbus: response
|
RB_SRES : out rb_sres_type; -- rbus: response
|
Line 144... |
Line 145... |
FULL => FIFO_FULL
|
FULL => FIFO_FULL
|
);
|
);
|
|
|
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 206... |
Line 207... |
-- rbus transactions
|
-- rbus transactions
|
if r.rbsel = '1' then
|
if r.rbsel = '1' then
|
|
|
if irbena = '1' then -- if request active
|
if irbena = '1' then -- if request active
|
if unsigned(r.cntbusy) /= 0 then -- if busy timer > 0
|
if unsigned(r.cntbusy) /= 0 then -- if busy timer > 0
|
n.cntbusy := unsigned(r.cntbusy) - 1; -- decrement busy timer
|
n.cntbusy := slv(unsigned(r.cntbusy) - 1); -- decrement busy timer
|
end if;
|
end if;
|
if r.cntcyc /= cntcyc_max then -- if cycle counter < max
|
if r.cntcyc /= cntcyc_max then -- if cycle counter < max
|
n.cntcyc := unsigned(r.cntcyc) + 1; -- increment cycle counter
|
n.cntcyc := slv(unsigned(r.cntcyc) + 1); -- increment cycle counter
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
irb_ack := irbena; -- ack all (some rejects later)
|
irb_ack := irbena; -- ack all (some rejects later)
|
|
|