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 4

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

powered by: WebSVN 2.1.0

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