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