Line 1... |
Line 1... |
-- $Id: tb_nexys2_fusp.vhd 314 2010-07-09 17:38:41Z mueller $
|
-- $Id: tb_nexys2_fusp.vhd 339 2010-11-22 21:20:51Z 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 13... |
Line 13... |
--
|
--
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
-- Module Name: tb_nexys2_fusp - sim
|
-- Module Name: tb_nexys2_fusp - sim
|
-- Description: Test bench for nexys2 (base+fusp)
|
-- Description: Test bench for nexys2 (base+fusp)
|
--
|
--
|
-- Dependencies: vlib/rri/tb/rritb_core
|
-- Dependencies: vlib/rri/tb/rritb_core_dcm
|
-- tb_nexys2_core
|
-- tb_nexys2_core
|
-- vlib/serport/serport_uart_rxtx
|
-- vlib/serport/serport_uart_rxtx
|
-- nexys2_fusp_aif [UUT]
|
-- nexys2_fusp_aif [UUT]
|
--
|
--
|
-- To test: generic, any nexys2_fusp_aif target
|
-- To test: generic, any nexys2_fusp_aif target
|
--
|
--
|
-- Target Devices: generic
|
-- Target Devices: generic
|
-- Tool versions: xst 11.4; ghdl 0.26
|
-- Tool versions: xst 11.4, 12.1; ghdl 0.26-0.29
|
|
--
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2010-11-13 338 1.0.2 now dcm aware: add O_CLKSYS, use rritb_core_dcm
|
|
-- 2010-11-06 336 1.0.1 rename input pin CLK -> I_CLK50
|
-- 2010-05-28 295 1.0 Initial version (derived from tb_s3board_fusp)
|
-- 2010-05-28 295 1.0 Initial version (derived from tb_s3board_fusp)
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
Line 46... |
Line 49... |
entity tb_nexys2_fusp is
|
entity tb_nexys2_fusp is
|
end tb_nexys2_fusp;
|
end tb_nexys2_fusp;
|
|
|
architecture sim of tb_nexys2_fusp is
|
architecture sim of tb_nexys2_fusp is
|
|
|
signal CLK : slbit := '0';
|
signal CLKOSC : slbit := '0';
|
|
signal CLKSYS : slbit := '0';
|
|
|
signal RESET : slbit := '0';
|
signal RESET : slbit := '0';
|
signal CLKDIV : slv2 := "00"; -- run with 1 clocks / bit !!
|
signal CLKDIV : slv2 := "00"; -- run with 1 clocks / bit !!
|
signal RXDATA : slv8 := (others=>'0');
|
signal RXDATA : slv8 := (others=>'0');
|
signal RXVAL : slbit := '0';
|
signal RXVAL : slbit := '0';
|
Line 95... |
Line 99... |
|
|
signal R_PORTSEL : slbit := '0';
|
signal R_PORTSEL : slbit := '0';
|
|
|
constant sbaddr_portsel: slv8 := conv_std_logic_vector( 8,8);
|
constant sbaddr_portsel: slv8 := conv_std_logic_vector( 8,8);
|
|
|
constant clock_period : time := 20 ns;
|
constant clockosc_period : time := 20 ns;
|
constant clock_offset : time := 200 ns;
|
constant clockosc_offset : time := 200 ns;
|
constant setup_time : time := 5 ns;
|
constant setup_time : time := 5 ns;
|
constant c2out_time : time := 10 ns;
|
constant c2out_time : time := 9 ns;
|
|
|
begin
|
begin
|
|
|
TBCORE : rritb_core
|
TBCORE : rritb_core_dcm
|
generic map (
|
generic map (
|
CLK_PERIOD => clock_period,
|
CLKOSC_PERIOD => clockosc_period,
|
CLK_OFFSET => clock_offset,
|
CLKOSC_OFFSET => clockosc_offset,
|
SETUP_TIME => setup_time,
|
SETUP_TIME => setup_time,
|
C2OUT_TIME => c2out_time)
|
C2OUT_TIME => c2out_time)
|
port map (
|
port map (
|
CLK => CLK,
|
CLKOSC => CLKOSC,
|
|
CLKSYS => CLKSYS,
|
RX_DATA => TXDATA,
|
RX_DATA => TXDATA,
|
RX_VAL => TXENA,
|
RX_VAL => TXENA,
|
RX_HOLD => RX_HOLD,
|
RX_HOLD => RX_HOLD,
|
TX_DATA => RXDATA,
|
TX_DATA => RXDATA,
|
TX_ENA => RXVAL
|
TX_ENA => RXVAL
|
Line 138... |
Line 143... |
IO_MEM_DATA => IO_MEM_DATA
|
IO_MEM_DATA => IO_MEM_DATA
|
);
|
);
|
|
|
UUT : nexys2_fusp_aif
|
UUT : nexys2_fusp_aif
|
port map (
|
port map (
|
CLK => CLK,
|
I_CLK50 => CLKOSC,
|
|
O_CLKSYS => CLKSYS,
|
I_RXD => I_RXD,
|
I_RXD => I_RXD,
|
O_TXD => O_TXD,
|
O_TXD => O_TXD,
|
I_SWI => I_SWI,
|
I_SWI => I_SWI,
|
I_BTN => I_BTN,
|
I_BTN => I_BTN,
|
O_LED => O_LED,
|
O_LED => O_LED,
|
Line 167... |
Line 173... |
|
|
UART : serport_uart_rxtx
|
UART : serport_uart_rxtx
|
generic map (
|
generic map (
|
CDWIDTH => CLKDIV'length)
|
CDWIDTH => CLKDIV'length)
|
port map (
|
port map (
|
CLK => CLK,
|
CLK => CLKSYS,
|
RESET => UART_RESET,
|
RESET => UART_RESET,
|
CLKDIV => CLKDIV,
|
CLKDIV => CLKDIV,
|
RXSD => UART_RXD,
|
RXSD => UART_RXD,
|
RXDATA => RXDATA,
|
RXDATA => RXDATA,
|
RXVAL => RXVAL,
|
RXVAL => RXVAL,
|
Line 206... |
Line 212... |
proc_moni: process
|
proc_moni: process
|
variable oline : line;
|
variable oline : line;
|
begin
|
begin
|
|
|
loop
|
loop
|
wait until CLK'event and CLK='1';
|
wait until CLKSYS'event and CLKSYS='1';
|
wait for c2out_time;
|
wait for c2out_time;
|
|
|
if RXERR = '1' then
|
if RXERR = '1' then
|
writetimestamp(oline, SB_CLKCYCLE, " : seen RXERR=1");
|
writetimestamp(oline, SB_CLKCYCLE, " : seen RXERR=1");
|
writeline(output, oline);
|
writeline(output, oline);
|