Line 1... |
Line 1... |
-- $Id: rritb_core.vhd 314 2010-07-09 17:38:41Z mueller $
|
-- $Id: tbcore_rlink.vhd 351 2010-12-30 21:50:54Z mueller $
|
--
|
--
|
-- Copyright 2010- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 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 10... |
Line 10... |
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
-- for complete details.
|
-- for complete details.
|
--
|
--
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
-- Module Name: rritb_core - sim
|
-- Module Name: tbcore_rlink - sim
|
-- Description: Core for a rri and cext based test bench
|
-- Description: Core for a rlink_cext based test bench
|
--
|
--
|
-- Dependencies: simlib/simclk
|
-- Dependencies: simlib/simclk
|
--
|
--
|
-- To test: generic, any rri/cext based target
|
-- To test: generic, any rlink_cext based target
|
--
|
--
|
-- Target Devices: generic
|
-- Target Devices: generic
|
-- Tool versions: xst 11.4; ghdl 0.26
|
-- Tool versions: xst 11.4; ghdl 0.26
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
-- 2010-06-05 301 1.1.2 renamed .rpmon -> .rbmon
|
-- 2010-12-29 351 3.0 rename rritb_core->tbcore_rlink; use rbv3 naming
|
|
-- 2010-06-05 301 1.1.2 rename .rpmon -> .rbmon
|
-- 2010-05-02 287 1.1.1 rename config command .sdata -> .sinit;
|
-- 2010-05-02 287 1.1.1 rename config command .sdata -> .sinit;
|
-- use sbcntl_sbf_(cp|rp)mon defs, use rritblib;
|
-- use sbcntl_sbf_(cp|rp)mon defs, use rritblib;
|
-- 2010-04-25 283 1.1 new clk handling in proc_stim, wait period-setup
|
-- 2010-04-25 283 1.1 new clk handling in proc_stim, wait period-setup
|
-- 2010-04-24 282 1.0 Initial version (from vlib/s3board/tb/tb_s3board)
|
-- 2010-04-24 282 1.0 Initial version (from vlib/s3board/tb/tb_s3board)
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
Line 37... |
Line 38... |
use std.textio.all;
|
use std.textio.all;
|
|
|
use work.slvtypes.all;
|
use work.slvtypes.all;
|
use work.simlib.all;
|
use work.simlib.all;
|
use work.simbus.all;
|
use work.simbus.all;
|
use work.rritblib.all;
|
use work.rblib.all;
|
use work.vhpi_rriext.all;
|
use work.rlinklib.all;
|
|
use work.rlinktblib.all;
|
|
use work.rlink_cext_vhpi.all;
|
|
|
entity rritb_core is -- core of rri/cext based test bench
|
entity tbcore_rlink is -- core of rlink_cext based test bench
|
generic (
|
generic (
|
CLK_PERIOD : time := 20 ns; -- clock period
|
CLK_PERIOD : time := 20 ns; -- clock period
|
CLK_OFFSET : time := 200 ns; -- clock offset (time to start clock)
|
CLK_OFFSET : time := 200 ns; -- clock offset (time to start clock)
|
SETUP_TIME : time := 5 ns; -- setup time
|
SETUP_TIME : time := 5 ns; -- setup time
|
C2OUT_TIME : time := 10 ns); -- clock to output time
|
C2OUT_TIME : time := 10 ns); -- clock to output time
|
Line 54... |
Line 57... |
RX_VAL : out slbit; -- read data valid (data ext->tb)
|
RX_VAL : out slbit; -- read data valid (data ext->tb)
|
RX_HOLD : in slbit; -- read data hold (data ext->tb)
|
RX_HOLD : in slbit; -- read data hold (data ext->tb)
|
TX_DATA : in slv8; -- write data (data tb->ext)
|
TX_DATA : in slv8; -- write data (data tb->ext)
|
TX_ENA : in slbit -- write data enable (data tb->ext)
|
TX_ENA : in slbit -- write data enable (data tb->ext)
|
);
|
);
|
end rritb_core;
|
end tbcore_rlink;
|
|
|
architecture sim of rritb_core is
|
architecture sim of tbcore_rlink is
|
|
|
signal CLK_L : slbit := '0';
|
signal CLK_L : slbit := '0';
|
signal CLK_STOP : slbit := '0';
|
signal CLK_STOP : slbit := '0';
|
|
|
begin
|
begin
|
Line 76... |
Line 79... |
);
|
);
|
|
|
CLK <= CLK_L;
|
CLK <= CLK_L;
|
|
|
proc_conf: process
|
proc_conf: process
|
file fconf : text open read_mode is "tb_rriext_conf";
|
file fconf : text open read_mode is "rlink_cext_conf";
|
variable iline : line;
|
variable iline : line;
|
variable oline : line;
|
variable oline : line;
|
variable ok : boolean;
|
variable ok : boolean;
|
variable dname : string(1 to 6) := (others=>' ');
|
variable dname : string(1 to 6) := (others=>' ');
|
variable ien : slbit := '0';
|
variable ien : slbit := '0';
|
Line 114... |
Line 117... |
SB_CNTL(ibit) <= 'H';
|
SB_CNTL(ibit) <= 'H';
|
else
|
else
|
SB_CNTL(ibit) <= 'L';
|
SB_CNTL(ibit) <= 'L';
|
end if;
|
end if;
|
|
|
when ".cpmon" => -- .cpmon
|
when ".rlmon" => -- .rlmon
|
read_ea(iline, ien);
|
read_ea(iline, ien);
|
if ien = '1' then
|
if ien = '1' then
|
SB_CNTL(sbcntl_sbf_cpmon) <= 'H';
|
SB_CNTL(sbcntl_sbf_rlmon) <= 'H';
|
else
|
else
|
SB_CNTL(sbcntl_sbf_cpmon) <= 'L';
|
SB_CNTL(sbcntl_sbf_rlmon) <= 'L';
|
end if;
|
end if;
|
|
|
when ".rbmon" => -- .rbmon
|
when ".rbmon" => -- .rbmon
|
read_ea(iline, ien);
|
read_ea(iline, ien);
|
if ien = '1' then
|
if ien = '1' then
|
Line 186... |
Line 189... |
|
|
icycle := conv_integer(unsigned(SB_CLKCYCLE));
|
icycle := conv_integer(unsigned(SB_CLKCYCLE));
|
RX_VAL <= '0';
|
RX_VAL <= '0';
|
|
|
if RX_HOLD = '0' then
|
if RX_HOLD = '0' then
|
irxint := cext_getbyte(icycle);
|
irxint := rlink_cext_getbyte(icycle);
|
if irxint >= 0 then
|
if irxint >= 0 then
|
if irxint <= 16#ff# then -- normal data byte
|
if irxint <= 16#ff# then -- normal data byte
|
RX_DATA <= conv_std_logic_vector(irxint, 8);
|
RX_DATA <= conv_std_logic_vector(irxint, 8);
|
RX_VAL <= '1';
|
RX_VAL <= '1';
|
elsif irxint >= 16#1000000# then -- out-of-band message
|
elsif irxint >= 16#1000000# then -- out-of-band message
|
Line 218... |
Line 221... |
end if;
|
end if;
|
end if;
|
end if;
|
elsif irxint = -1 then -- end-of-file seen
|
elsif irxint = -1 then -- end-of-file seen
|
exit stim_loop;
|
exit stim_loop;
|
else
|
else
|
report "cext_getbyte error: " & integer'image(-irxint)
|
report "rlink_cext_getbyte error: " & integer'image(-irxint)
|
severity failure;
|
severity failure;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
SB_CNTL <= r_sb_cntl;
|
SB_CNTL <= r_sb_cntl;
|
Line 249... |
Line 252... |
loop
|
loop
|
wait until CLK_L'event and CLK_L='1';
|
wait until CLK_L'event and CLK_L='1';
|
wait for C2OUT_TIME;
|
wait for C2OUT_TIME;
|
if TX_ENA = '1' then
|
if TX_ENA = '1' then
|
itxdata := conv_integer(unsigned(TX_DATA));
|
itxdata := conv_integer(unsigned(TX_DATA));
|
itxrc := cext_putbyte(itxdata);
|
itxrc := rlink_cext_putbyte(itxdata);
|
assert itxrc=0
|
assert itxrc=0
|
report "cext_putbyte error: " & integer'image(itxrc)
|
report "rlink_cext_putbyte error: " & integer'image(itxrc)
|
severity failure;
|
severity failure;
|
end if;
|
end if;
|
|
|
end loop;
|
end loop;
|
|
|