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

Subversion Repositories vhdl_wb_tb

[/] [vhdl_wb_tb/] [trunk/] [bench/] [vhdl/] [stimulator.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 sinx
---------------------------------------------------------------------- 
2
----                                                              ---- 
3
----  VHDL Wishbone TESTBENCH                                     ---- 
4
----                                                              ---- 
5
----  This file is part of the vhdl_wb_tb project                 ---- 
6
----  http://www.opencores.org/cores/vhdl_wb_tb/                  ---- 
7
----                                                              ---- 
8
----  This file contains the top functional module of the design  ----
9
----  under test. The top functional module will be enclosed by   ----
10
----  the top module for synthesis or the tb_top for simulation.  ---- 
11
----  The top module can contain some synthesis specific code,    ----
12
----  where the tb_top contains simulation specific code.          ----
13
----                                                              ---- 
14
----  To Do:                                                      ---- 
15
----   -                                                          ---- 
16
----                                                              ---- 
17
----  Author(s):                                                  ---- 
18
----      - Sinx, email@opencores.org               ---- 
19
----                                                              ---- 
20
----------------------------------------------------------------------
21
--    SVN information
22
--
23
--      $URL:  $
24
-- $Revision:  $
25
--     $Date:  $
26
--   $Author:  $
27
--       $Id:  $
28
--
29
---------------------------------------------------------------------- 
30
----                                                              ---- 
31
---- Copyright (C) 2018 Authors and OPENCORES.ORG                 ---- 
32
----                                                              ---- 
33
---- This source file may be used and distributed without         ---- 
34
---- restriction provided that this copyright statement is not    ---- 
35
---- removed from the file and that any derivative work contains  ---- 
36
---- the original copyright notice and the associated disclaimer. ---- 
37
----                                                              ---- 
38
---- This source file is free software; you can redistribute it   ---- 
39
---- and/or modify it under the terms of the GNU Lesser General   ---- 
40
---- Public License as published by the Free Software Foundation; ---- 
41
---- either version 2.1 of the License, or (at your option) any   ---- 
42
---- later version.                                               ---- 
43
----                                                              ---- 
44
---- This source is distributed in the hope that it will be       ---- 
45
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ---- 
46
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ---- 
47
---- PURPOSE.  See the GNU Lesser General Public License for more ---- 
48
---- details.                                                     ---- 
49
----                                                              ---- 
50
---- You should have received a copy of the GNU Lesser General    ---- 
51
---- Public License along with this source; if not, download it   ---- 
52
---- from http://www.opencores.org/lgpl.shtml                     ---- 
53
----                                                              ---- 
54
----------------------------------------------------------------------
55
 
56
-- library -----------------------------------------------------------
57
library ieee;
58
use ieee.std_logic_1164.all;
59
use ieee.numeric_std.all;
60
library work;
61
use work.convert_pkg.all;
62
use work.wishbone_pkg.all;
63
use work.wishbone_bfm_pkg.all;
64
 
65
-- entity ------------------------------------------------------------
66
entity stimulator is
67
  generic(
68
    g_number_of_signals             : natural := 1
69
    );
70
  port(
71
    wb_i                            : in wishbone_slave_in_t;
72
    wb_o                            : out wishbone_slave_out_t;
73
 
74
    signals_o                       : out std_logic_vector(g_number_of_signals-1 downto 0)
75
    );
76
end stimulator;
77
 
78
--=architecture===============================================================
79
architecture rtl of stimulator is
80
  --============================================================================
81
  -- signal declaration
82
  --============================================================================
83
  signal  s_register0                    : std_logic_vector(wb_i.dat'left downto 0);
84
  signal  s_register1                    : std_logic_vector(wb_i.dat'left downto 0);
85
  --============================================================================
86
begin
87
  ------------------------------------------------------------------------------
88
  wb_o.ack <= '1';
89
  wb_o.err <= '0';
90
  wb_o.rty <= '0';
91
  wb_o.int <= '0';
92
  wb_o.tgd <= (others => '0');
93
  -- read data multiplexer
94
  proc_read_data_mux : process (all)
95
    begin
96
      case wb_i.adr(27 downto 0) is
97
        when 28X"000_0000" =>
98
          wb_o.dat <= s_register0;
99
        when 28X"000_0004" =>
100
          wb_o.dat <= s_register1;
101
        when others =>
102
          wb_o.dat <= (others =>'U');
103
      end case;
104
    end process;
105
  ------------------------------------------------------------------------------
106
  proc_avalon_write_data  : process (all)
107
    begin
108
      if (wb_i.rst = '1') then
109
        s_register0        <= (others => '0');
110
        s_register1        <= (others => '0');
111
      elsif (rising_edge(wb_i.clk)) then
112
        if (wb_i.we = '1' AND wb_i.stb = '1' AND wb_i.sel = X"F" AND wb_i.cyc = '1') then
113
          case wb_i.adr(27 downto 0) is
114
            when 28X"000_0000" =>
115
              s_register0        <= wb_i.dat;
116
            when 28X"000_0004" =>
117
              s_register1         <= wb_i.dat;
118
            when others =>
119
          end case;
120
        end if;
121
      end if;
122
    end process;
123
  ------------------------------------------------------------------------------
124
  signals_o <= s_register0(signals_o'left downto 0);
125
--============================================================================
126
end rtl; --stimulator
127
--============================================================================
128
-- end of file
129
--============================================================================

powered by: WebSVN 2.1.0

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