OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [rtl/] [bplib/] [nexys4/] [tb/] [tb_nexys4_core.vhd] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 35 wfjm
-- $Id: tb_nexys4_core.vhd 724 2016-01-03 22:53:53Z mueller $
2 29 wfjm
--
3
-- Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
-- 
14
------------------------------------------------------------------------------
15
-- Module Name:    tb_nexys4_core - sim
16
-- Description:    Test bench for nexys4 - core device handling
17
--
18
-- Dependencies:   -
19
--
20
-- To test:        generic, any nexys4 target
21
--
22
-- Target Devices: generic
23
-- Tool versions:  ise 14.5-14.7; viv 2014.4; ghdl 0.29-0.31
24
-- Revision History: 
25
-- Date         Rev Version  Comment
26
-- 2015-02-06   643   1.2    factor out memory
27
-- 2015-02-01   641   1.1    separate I_BTNRST_N
28
-- 2013-09-21   534   1.0    Initial version (derived from tb_nexys3_core)
29
------------------------------------------------------------------------------
30
 
31
library ieee;
32
use ieee.std_logic_1164.all;
33
use ieee.numeric_std.all;
34
use ieee.std_logic_textio.all;
35
use std.textio.all;
36
 
37
use work.slvtypes.all;
38
use work.simbus.all;
39
 
40
entity tb_nexys4_core is
41
  port (
42
    I_SWI : out slv16;                  -- n4 switches
43
    I_BTN : out slv5;                   -- n4 buttons
44
    I_BTNRST_N : out slbit              -- n4 reset button
45
  );
46
end tb_nexys4_core;
47
 
48
architecture sim of tb_nexys4_core is
49
 
50
  signal R_SWI    : slv16 := (others=>'0');
51
  signal R_BTN    : slv5  := (others=>'0');
52
  signal R_BTNRST : slbit := '0';
53
 
54
  constant sbaddr_swi:  slv8 := slv(to_unsigned( 16,8));
55
  constant sbaddr_btn:  slv8 := slv(to_unsigned( 17,8));
56
 
57
begin
58
 
59
  proc_simbus: process (SB_VAL)
60
  begin
61
    if SB_VAL'event and to_x01(SB_VAL)='1' then
62
      if SB_ADDR = sbaddr_swi then
63
        R_SWI <= to_x01(SB_DATA(R_SWI'range));
64
      end if;
65
      if SB_ADDR = sbaddr_btn then
66
        R_BTN    <= to_x01(SB_DATA(R_BTN'range));
67
        R_BTNRST <= to_x01(SB_DATA(5));
68
      end if;
69
    end if;
70
  end process proc_simbus;
71
 
72
  I_SWI <= R_SWI;
73
  I_BTN <= R_BTN;
74
  I_BTNRST_N <= not R_BTNRST;
75
 
76
end sim;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.