w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
tb_nexys4_core.vhd
Go to the documentation of this file.
1-- $Id: tb_nexys4_core.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: tb_nexys4_core - sim
7-- Description: Test bench for nexys4 - core device handling
8--
9-- Dependencies: -
10--
11-- To test: generic, any nexys4 target
12--
13-- Target Devices: generic
14-- Tool versions: ise 14.5-14.7; viv 2014.4; ghdl 0.29-0.31
15-- Revision History:
16-- Date Rev Version Comment
17-- 2015-02-06 643 1.2 factor out memory
18-- 2015-02-01 641 1.1 separate I_BTNRST_N
19-- 2013-09-21 534 1.0 Initial version (derived from tb_nexys3_core)
20------------------------------------------------------------------------------
21
22library ieee;
23use ieee.std_logic_1164.all;
24use ieee.numeric_std.all;
25use ieee.std_logic_textio.all;
26use std.textio.all;
27
28use work.slvtypes.all;
29use work.simbus.all;
30
32 port (
33 I_SWI : out slv16; -- n4 switches
34 I_BTN : out slv5; -- n4 buttons
35 I_BTNRST_N : out slbit -- n4 reset button
36 );
38
39architecture sim of tb_nexys4_core is
40
41 signal R_SWI : slv16 := (others=>'0');
42 signal R_BTN : slv5 := (others=>'0');
43 signal R_BTNRST : slbit := '0';
44
45 constant sbaddr_swi: slv8 := slv(to_unsigned( 16,8));
46 constant sbaddr_btn: slv8 := slv(to_unsigned( 17,8));
47
48begin
49
50 proc_simbus: process (SB_VAL)
51 begin
52 if SB_VAL'event and to_x01(SB_VAL)='1' then
53 if SB_ADDR = sbaddr_swi then
54 R_SWI <= to_x01(SB_DATA(R_SWI'range));
55 end if;
56 if SB_ADDR = sbaddr_btn then
57 R_BTN <= to_x01(SB_DATA(R_BTN'range));
58 R_BTNRST <= to_x01(SB_DATA(5));
59 end if;
60 end if;
61 end process proc_simbus;
62
63 I_SWI <= R_SWI;
64 I_BTN <= R_BTN;
65 I_BTNRST_N <= not R_BTNRST;
66
67end sim;
std_logic_vector( 4 downto 0) slv5
Definition: slvtypes.vhd:37
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 slv
Definition: slvtypes.vhd:31
slbit := '0' R_BTNRST
slv8 := slv( to_unsigned( 16, 8) ) sbaddr_swi
slv8 := slv( to_unsigned( 17, 8) ) sbaddr_btn
slv16 :=( others => '0') R_SWI
slv5 :=( others => '0') R_BTN
out I_BTNRST_N slbit
out I_SWI slv16