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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 37 wfjm
-- $Id: tb_nexys3_core.vhd 791 2016-07-21 22:01:10Z mueller $
2 15 wfjm
--
3 37 wfjm
-- Copyright 2011-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 15 wfjm
--
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_nexys3_core - sim
16
-- Description:    Test bench for nexys3 - core device handling
17
--
18 37 wfjm
-- Dependencies:   simlib/simbididly
19
--                 vlib/parts/micron/mt45w8mw16b
20 15 wfjm
--
21
-- To test:        generic, any nexys3 target
22
--
23
-- Target Devices: generic
24 37 wfjm
-- Tool versions:  xst 11.4-14.7; ghdl 0.26-0.33
25 15 wfjm
-- Revision History: 
26
-- Date         Rev Version  Comment
27 37 wfjm
-- 2016-07-20   791   1.1    use simbididly
28 15 wfjm
-- 2011-11-25   432   1.0    Initial version (derived from tb_nexys2_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 37 wfjm
use work.simlib.all;
39 15 wfjm
use work.simbus.all;
40
 
41
entity tb_nexys3_core is
42
  port (
43
    I_SWI : out slv8;                   -- n3 switches
44
    I_BTN : out slv5;                   -- n3 buttons
45
    O_MEM_CE_N : in slbit;              -- cram: chip enable   (act.low)
46
    O_MEM_BE_N : in slv2;               -- cram: byte enables  (act.low)
47
    O_MEM_WE_N : in slbit;              -- cram: write enable  (act.low)
48
    O_MEM_OE_N : in slbit;              -- cram: output enable (act.low)
49
    O_MEM_ADV_N  : in slbit;            -- cram: address valid (act.low)
50
    O_MEM_CLK : in slbit;               -- cram: clock
51
    O_MEM_CRE : in slbit;               -- cram: command register enable
52
    I_MEM_WAIT : out slbit;             -- cram: mem wait
53
    O_MEM_ADDR  : in slv23;             -- cram: address lines
54
    IO_MEM_DATA : inout slv16           -- cram: data lines
55
  );
56
end tb_nexys3_core;
57
 
58
architecture sim of tb_nexys3_core is
59
 
60 37 wfjm
  signal MM_MEM_CE_N  : slbit := '1';
61
  signal MM_MEM_BE_N  : slv2 := (others=>'1');
62
  signal MM_MEM_WE_N  : slbit := '1';
63
  signal MM_MEM_OE_N  : slbit := '1';
64
  signal MM_MEM_ADV_N : slbit := '1';
65
  signal MM_MEM_CLK   : slbit := '0';
66
  signal MM_MEM_CRE   : slbit := '0';
67
  signal MM_MEM_WAIT  : slbit := '0';
68
  signal MM_MEM_ADDR  : slv23 := (others=>'Z');
69
  signal MM_MEM_DATA  : slv16 := (others=>'0');
70
 
71 15 wfjm
  signal R_SWI : slv8 := (others=>'0');
72
  signal R_BTN : slv5 := (others=>'0');
73
 
74
  constant sbaddr_swi:  slv8 := slv(to_unsigned( 16,8));
75
  constant sbaddr_btn:  slv8 := slv(to_unsigned( 17,8));
76 37 wfjm
  constant pcb_delay : Delay_length := 1 ns;
77 15 wfjm
 
78
begin
79
 
80 37 wfjm
  MM_MEM_CE_N  <= O_MEM_CE_N  after pcb_delay;
81
  MM_MEM_BE_N  <= O_MEM_BE_N  after pcb_delay;
82
  MM_MEM_WE_N  <= O_MEM_WE_N  after pcb_delay;
83
  MM_MEM_OE_N  <= O_MEM_OE_N  after pcb_delay;
84
  MM_MEM_ADV_N <= O_MEM_ADV_N after pcb_delay;
85
  MM_MEM_CLK   <= O_MEM_CLK   after pcb_delay;
86
  MM_MEM_CRE   <= O_MEM_CRE   after pcb_delay;
87
  MM_MEM_ADDR  <= O_MEM_ADDR  after pcb_delay;
88
  I_MEM_WAIT   <= MM_MEM_WAIT after pcb_delay;
89
 
90
  BUSDLY: simbididly
91
    generic map (
92
      DELAY  => pcb_delay,
93
      DWIDTH => 16)
94
    port map (
95
      A => IO_MEM_DATA,
96
      B => MM_MEM_DATA);
97
 
98 15 wfjm
  MEM : entity work.mt45w8mw16b
99
    port map (
100 37 wfjm
      CLK   => MM_MEM_CLK,
101
      CE_N  => MM_MEM_CE_N,
102
      OE_N  => MM_MEM_OE_N,
103
      WE_N  => MM_MEM_WE_N,
104
      UB_N  => MM_MEM_BE_N(1),
105
      LB_N  => MM_MEM_BE_N(0),
106
      ADV_N => MM_MEM_ADV_N,
107
      CRE   => MM_MEM_CRE,
108
      MWAIT => MM_MEM_WAIT,
109
      ADDR  => MM_MEM_ADDR,
110
      DATA  => MM_MEM_DATA
111 15 wfjm
    );
112
 
113
  proc_simbus: process (SB_VAL)
114
  begin
115
    if SB_VAL'event and to_x01(SB_VAL)='1' then
116
      if SB_ADDR = sbaddr_swi then
117
        R_SWI <= to_x01(SB_DATA(R_SWI'range));
118
      end if;
119
      if SB_ADDR = sbaddr_btn then
120
        R_BTN <= to_x01(SB_DATA(R_BTN'range));
121
      end if;
122
    end if;
123
  end process proc_simbus;
124
 
125
  I_SWI <= R_SWI;
126
  I_BTN <= R_BTN;
127
 
128
end sim;

powered by: WebSVN 2.1.0

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