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

Subversion Repositories w11

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 wfjm
-- $Id: tb_nexys4_core.vhd 643 2015-02-07 17:41:53Z mueller $
2
--
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.serportlib.all;
39
use work.simbus.all;
40
 
41
entity tb_nexys4_core is
42
  port (
43
    I_SWI : out slv16;                  -- n4 switches
44
    I_BTN : out slv5;                   -- n4 buttons
45
    I_BTNRST_N : out slbit              -- n4 reset button
46
  );
47
end tb_nexys4_core;
48
 
49
architecture sim of tb_nexys4_core is
50
 
51
  signal R_SWI    : slv16 := (others=>'0');
52
  signal R_BTN    : slv5  := (others=>'0');
53
  signal R_BTNRST : slbit := '0';
54
 
55
  constant sbaddr_swi:  slv8 := slv(to_unsigned( 16,8));
56
  constant sbaddr_btn:  slv8 := slv(to_unsigned( 17,8));
57
 
58
begin
59
 
60
  proc_simbus: process (SB_VAL)
61
  begin
62
    if SB_VAL'event and to_x01(SB_VAL)='1' then
63
      if SB_ADDR = sbaddr_swi then
64
        R_SWI <= to_x01(SB_DATA(R_SWI'range));
65
      end if;
66
      if SB_ADDR = sbaddr_btn then
67
        R_BTN    <= to_x01(SB_DATA(R_BTN'range));
68
        R_BTNRST <= to_x01(SB_DATA(5));
69
      end if;
70
    end if;
71
  end process proc_simbus;
72
 
73
  I_SWI <= R_SWI;
74
  I_BTN <= R_BTN;
75
  I_BTNRST_N <= not R_BTNRST;
76
 
77
end sim;

powered by: WebSVN 2.1.0

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