Line 1... |
Line 1... |
-- $Id: tbcore_rlink.vhd 351 2010-12-30 21:50:54Z mueller $
|
-- $Id: tbcore_rlink.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: simlib/simclk
|
-- Dependencies: simlib/simclk
|
--
|
--
|
-- To test: generic, any rlink_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, 13.1; ghdl 0.26-0.29
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2011-11-19 427 3.0.1 now numeric_std clean
|
-- 2010-12-29 351 3.0 rename rritb_core->tbcore_rlink; use rbv3 naming
|
-- 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-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)
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
|
|
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 ieee.std_logic_textio.all;
|
use ieee.std_logic_textio.all;
|
use std.textio.all;
|
use std.textio.all;
|
|
|
use work.slvtypes.all;
|
use work.slvtypes.all;
|
use work.simlib.all;
|
use work.simlib.all;
|
Line 179... |
Line 180... |
wait for CLK_OFFSET;
|
wait for CLK_OFFSET;
|
wait for 10*CLK_PERIOD;
|
wait for 10*CLK_PERIOD;
|
|
|
stim_loop: loop
|
stim_loop: loop
|
|
|
wait until CLK_L'event and CLK_L='1';
|
wait until rising_edge(CLK_L);
|
wait for CLK_PERIOD-SETUP_TIME;
|
wait for CLK_PERIOD-SETUP_TIME;
|
|
|
SB_ADDR <= (others=>'Z');
|
SB_ADDR <= (others=>'Z');
|
SB_DATA <= (others=>'Z');
|
SB_DATA <= (others=>'Z');
|
|
|
icycle := conv_integer(unsigned(SB_CLKCYCLE));
|
icycle := to_integer(unsigned(SB_CLKCYCLE));
|
RX_VAL <= '0';
|
RX_VAL <= '0';
|
|
|
if RX_HOLD = '0' then
|
if RX_HOLD = '0' then
|
irxint := rlink_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 <= slv(to_unsigned(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
|
irxslv := conv_std_logic_vector(irxint, 24);
|
irxslv := slv(to_unsigned(irxint mod 16#1000000#, 24));
|
iaddr := irxslv(23 downto 16);
|
iaddr := irxslv(23 downto 16);
|
idata := irxslv(15 downto 0);
|
idata := irxslv(15 downto 0);
|
writetimestamp(oline, SB_CLKCYCLE, ": OOB-MSG");
|
writetimestamp(oline, SB_CLKCYCLE, ": OOB-MSG");
|
write(oline, irxslv(23 downto 16), right, 9);
|
write(oline, irxslv(23 downto 16), right, 9);
|
write(oline, irxslv(15 downto 8), right, 9);
|
write(oline, irxslv(15 downto 8), right, 9);
|
Line 207... |
Line 208... |
write(oline, string'(" : "));
|
write(oline, string'(" : "));
|
writeoct(oline, iaddr, right, 3);
|
writeoct(oline, iaddr, right, 3);
|
writeoct(oline, idata, right, 7);
|
writeoct(oline, idata, right, 7);
|
writeline(output, oline);
|
writeline(output, oline);
|
if unsigned(iaddr) = 0 then
|
if unsigned(iaddr) = 0 then
|
ibit := conv_integer(unsigned(idata(15 downto 8)));
|
ibit := to_integer(unsigned(idata(15 downto 8)));
|
r_sb_cntl(ibit) := idata(0);
|
r_sb_cntl(ibit) := idata(0);
|
else
|
else
|
SB_ADDR <= iaddr;
|
SB_ADDR <= iaddr;
|
SB_DATA <= idata;
|
SB_DATA <= idata;
|
SB_VAL <= '1';
|
SB_VAL <= '1';
|
Line 248... |
Line 249... |
variable itxrc : integer := 0;
|
variable itxrc : integer := 0;
|
variable oline : line;
|
variable oline : line;
|
begin
|
begin
|
|
|
loop
|
loop
|
wait until CLK_L'event and CLK_L='1';
|
wait until rising_edge(CLK_L);
|
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 := to_integer(unsigned(TX_DATA));
|
itxrc := rlink_cext_putbyte(itxdata);
|
itxrc := rlink_cext_putbyte(itxdata);
|
assert itxrc=0
|
assert itxrc=0
|
report "rlink_cext_putbyte error: " & integer'image(itxrc)
|
report "rlink_cext_putbyte error: " & integer'image(itxrc)
|
severity failure;
|
severity failure;
|
end if;
|
end if;
|