w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
tb_nexys2_core.vhd
Go to the documentation of this file.
1-- $Id: tb_nexys2_core.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2010-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: tb_nexys2_core - sim
7-- Description: Test bench for nexys2 - core device handling
8--
9-- Dependencies: simlib/simbididly
10-- bplib/micron/mt45w8mw16b
11--
12-- To test: generic, any nexys2 target
13--
14-- Target Devices: generic
15-- Tool versions: xst 11.4-14.7; ghdl 0.26-0.33
16-- Revision History:
17-- Date Rev Version Comment
18-- 2016-07-20 791 1.2 use simbididly
19-- 2011-11-26 433 1.1.1 remove O_FLA_CE_N from tb_nexys2_core
20-- 2011-11-21 432 1.1 update O_FLA_CE_N usage
21-- 2011-11-19 427 1.0.1 now numeric_std clean
22-- 2010-05-23 294 1.0 Initial version (derived from tb_s3board_core)
23------------------------------------------------------------------------------
24
25library ieee;
26use ieee.std_logic_1164.all;
27use ieee.numeric_std.all;
28use ieee.std_logic_textio.all;
29use std.textio.all;
30
31use work.slvtypes.all;
32use work.simlib.all;
33use work.simbus.all;
34
36 port (
37 I_SWI : out slv8; -- n2 switches
38 I_BTN : out slv4; -- n2 buttons
39 O_MEM_CE_N : in slbit; -- cram: chip enable (act.low)
40 O_MEM_BE_N : in slv2; -- cram: byte enables (act.low)
41 O_MEM_WE_N : in slbit; -- cram: write enable (act.low)
42 O_MEM_OE_N : in slbit; -- cram: output enable (act.low)
43 O_MEM_ADV_N : in slbit; -- cram: address valid (act.low)
44 O_MEM_CLK : in slbit; -- cram: clock
45 O_MEM_CRE : in slbit; -- cram: command register enable
46 I_MEM_WAIT : out slbit; -- cram: mem wait
47 O_MEM_ADDR : in slv23; -- cram: address lines
48 IO_MEM_DATA : inout slv16 -- cram: data lines
49 );
51
52architecture sim of tb_nexys2_core is
53
54 signal MM_MEM_CE_N : slbit := '1';
55 signal MM_MEM_BE_N : slv2 := (others=>'1');
56 signal MM_MEM_WE_N : slbit := '1';
57 signal MM_MEM_OE_N : slbit := '1';
58 signal MM_MEM_ADV_N : slbit := '1';
59 signal MM_MEM_CLK : slbit := '0';
60 signal MM_MEM_CRE : slbit := '0';
61 signal MM_MEM_WAIT : slbit := '0';
62 signal MM_MEM_ADDR : slv23 := (others=>'Z');
63 signal MM_MEM_DATA : slv16 := (others=>'0');
64
65 signal R_SWI : slv8 := (others=>'0');
66 signal R_BTN : slv4 := (others=>'0');
67
68 constant sbaddr_swi: slv8 := slv(to_unsigned( 16,8));
69 constant sbaddr_btn: slv8 := slv(to_unsigned( 17,8));
70 constant pcb_delay : Delay_length := 1 ns;
71
72begin
73
83
84 BUSDLY: simbididly
85 generic map (
87 DWIDTH => 16)
88 port map (
89 A => IO_MEM_DATA,
91
92 MEM : entity work.mt45w8mw16b
93 port map (
94 CLK => MM_MEM_CLK,
98 UB_N => MM_MEM_BE_N(1),
99 LB_N => MM_MEM_BE_N(0),
101 CRE => MM_MEM_CRE,
103 ADDR => MM_MEM_ADDR,
105 );
106
107 proc_simbus: process (SB_VAL)
108 begin
109 if SB_VAL'event and to_x01(SB_VAL)='1' then
110 if SB_ADDR = sbaddr_swi then
111 R_SWI <= to_x01(SB_DATA(R_SWI'range));
112 end if;
113 if SB_ADDR = sbaddr_btn then
114 R_BTN <= to_x01(SB_DATA(R_BTN'range));
115 end if;
116 end if;
117 end process proc_simbus;
118
119 I_SWI <= R_SWI;
120 I_BTN <= R_BTN;
121
122end sim;
in UB_N slbit
Definition: mt45w8mw16b.vhd:64
in CRE slbit
Definition: mt45w8mw16b.vhd:67
in WE_N slbit
Definition: mt45w8mw16b.vhd:63
in CLK slbit
Definition: mt45w8mw16b.vhd:60
out MWAIT slbit
Definition: mt45w8mw16b.vhd:68
in CE_N slbit
Definition: mt45w8mw16b.vhd:61
in OE_N slbit
Definition: mt45w8mw16b.vhd:62
in ADV_N slbit
Definition: mt45w8mw16b.vhd:66
in LB_N slbit
Definition: mt45w8mw16b.vhd:65
inout DATA slv16
Definition: mt45w8mw16b.vhd:71
in ADDR slv23
Definition: mt45w8mw16b.vhd:69
inout B slv( DWIDTH- 1 downto 0)
Definition: simbididly.vhd:32
inout A slv( DWIDTH- 1 downto 0)
Definition: simbididly.vhd:30
DELAY Delay_length
Definition: simbididly.vhd:27
DWIDTH positive := 16
Definition: simbididly.vhd:28
std_logic_vector( 22 downto 0) slv23
Definition: slvtypes.vhd:56
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 7 downto 0) slv8
Definition: slvtypes.vhd:40
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
std_logic_vector slv
Definition: slvtypes.vhd:31
slv16 :=( others => '0') MM_MEM_DATA
slv8 := slv( to_unsigned( 16, 8) ) sbaddr_swi
slv8 := slv( to_unsigned( 17, 8) ) sbaddr_btn
slbit := '1' MM_MEM_OE_N
slbit := '0' MM_MEM_CRE
slbit := '1' MM_MEM_ADV_N
slbit := '1' MM_MEM_CE_N
slbit := '1' MM_MEM_WE_N
Delay_length := 1 ns pcb_delay
slv4 :=( others => '0') R_BTN
slv2 :=( others => '1') MM_MEM_BE_N
slbit := '0' MM_MEM_WAIT
slbit := '0' MM_MEM_CLK
slv8 :=( others => '0') R_SWI
slv23 :=( others => 'Z') MM_MEM_ADDR
in O_MEM_WE_N slbit
in O_MEM_ADV_N slbit
out I_MEM_WAIT slbit
in O_MEM_CLK slbit
in O_MEM_OE_N slbit
in O_MEM_ADDR slv23
in O_MEM_CRE slbit
in O_MEM_CE_N slbit
inout IO_MEM_DATA slv16
in O_MEM_BE_N slv2