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

Subversion Repositories vhdl_wb_tb

[/] [vhdl_wb_tb/] [trunk/] [rtl/] [vhdl/] [packages/] [wishbone_pkg.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 wishbone_pkg package and defines     ----
9
----  basic wishbone types.                                       ---- 
10
----                                                              ---- 
11
----  This file bases on the file wishbone_pkg.vhd located at     ----
12
----  https://github.com/twlostow/dsi-shield/blob/master/hdl/ip_cores/local/wishbone_pkg.vhd ---
13
----  See this file also for the authors name.                    ---- 
14
----  Its original file was licensed under LGPL 3.0               ---- 
15
----                                                              ---- 
16
----  To Do:                                                      ---- 
17
----   -                                                          ---- 
18
----                                                              ---- 
19
----  Author(s):                                                  ---- 
20
----      - Sinx, email@opencores.org               ---- 
21
----                                                              ---- 
22
----------------------------------------------------------------------
23
--    SVN information
24
--
25
--      $URL:  $
26
-- $Revision:  $
27
--     $Date:  $
28
--   $Author:  $
29
--       $Id:  $
30
--
31
---------------------------------------------------------------------- 
32
----                                                              ---- 
33
---- Copyright (C) 2018 Authors and OPENCORES.ORG                 ---- 
34
----                                                              ---- 
35
---- This source file may be used and distributed without         ---- 
36
---- restriction provided that this copyright statement is not    ---- 
37
---- removed from the file and that any derivative work contains  ---- 
38
---- the original copyright notice and the associated disclaimer. ---- 
39
----                                                              ---- 
40
---- This source file is free software; you can redistribute it   ---- 
41
---- and/or modify it under the terms of the GNU Lesser General   ---- 
42
---- Public License as published by the Free Software Foundation; ---- 
43
---- either version 2.1 of the License, or (at your option) any   ---- 
44
---- later version.                                               ---- 
45
----                                                              ---- 
46
---- This source is distributed in the hope that it will be       ---- 
47
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ---- 
48
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ---- 
49
---- PURPOSE.  See the GNU Lesser General Public License for more ---- 
50
---- details.                                                     ---- 
51
----                                                              ---- 
52
---- You should have received a copy of the GNU Lesser General    ---- 
53
---- Public License along with this source; if not, download it   ---- 
54
---- from http://www.opencores.org/lgpl.shtml                     ---- 
55
----                                                              ---- 
56
----------------------------------------------------------------------
57
 
58
-- library -----------------------------------------------------------
59
library ieee;
60
use ieee.std_logic_1164.all;
61
use ieee.numeric_std.all;
62
 
63
library work;
64
use work.my_project_pkg.all;
65
 
66
-- package -----------------------------------------------------------
67
package wishbone_pkg is
68
 
69
  subtype wishbone_address_t is std_logic_vector(wishbone_address_width_c-1 downto 0);
70
  subtype wishbone_data_t is std_logic_vector(wishbone_data_width_c-1 downto 0);
71
  subtype wishbone_byte_select_t is std_logic_vector((wishbone_address_width_c/8)-1 downto 0);
72
  --subtype wishbone_cycle_type_t is std_logic_vector(2 downto 0);
73
  --subtype wishbone_burst_type_t is std_logic_vector(1 downto 0);
74
 
75
  type wishbone_master_out_t is record
76
    -- 2.2.2 Signals Common to MASTER and SLAVE Interfaces 
77
    clk : std_logic; -- clock [mandatory RULE 3.40]
78
    dat : wishbone_data_t; -- data []
79
    rst : std_logic; -- reset [mandatory RULE 3.40]
80
    tgd : wishbone_tag_data_t; -- data tag []
81
    -- 2.2.3 MASTER Signals
82
    adr : wishbone_address_t; -- address [optional]
83
    cyc : std_logic; -- cycle [mandatory RULE 3.40]
84
    lock: std_logic; -- lock []
85
    sel : wishbone_byte_select_t;
86
    stb : std_logic; -- strobe [mandatory RULE 3.40]
87
    tga : wishbone_tag_address_t; -- address tag []
88
    tgc : wishbone_tag_cycle_t; -- cycle tag []
89
    we  : std_logic; -- write enable []
90
  end record wishbone_master_out_t;
91
  subtype wishbone_slave_in_t is wishbone_master_out_t;
92
 
93
  type wishbone_slave_out_t is record
94
    -- 2.2.2 Signals Common to MASTER and SLAVE Interfaces 
95
    dat   : wishbone_data_t; -- read data []
96
    tgd   : wishbone_tag_data_t; -- read data tag []
97
    -- 2.2.4 SLAVE Signals 
98
    ack   : std_logic; -- acknowledge [mandatory RULE 3.40]
99
    err   : std_logic; -- error [optional PERMISSION 3.20]
100
    rty   : std_logic; -- retry [optional PERMISSION 3.25]
101
    --stall : std_logic;
102
    int   : std_logic; -- interrupt [non WB signal]
103
  end record wishbone_slave_out_t;
104
  subtype wishbone_master_in_t is wishbone_slave_out_t;
105
 
106
  -- subtype wishbone_device_descriptor_t is std_logic_vector(255 downto 0);
107
 
108
  -- type wishbone_byte_select_array_t is array(natural range <>) of wishbone_byte_select_t; 
109
  -- type wishbone_data_array_t is array(natural range <>) of wishbone_data_t; 
110
  type wishbone_address_array_t is array(natural range <>) of wishbone_address_t;
111
  type wishbone_master_out_array_t is array (natural range <>) of wishbone_master_out_t;
112
  type wishbone_slave_in_array_t is array (natural range <>) of wishbone_slave_in_t;
113
  -- subtype wishbone_slave_in_array_t is wishbone_master_out_array_t;
114
  type wishbone_slave_out_array_t is array (natural range <>) of wishbone_slave_out_t;
115
  --type wishbone_master_in_array_t is array (natural range <>) of wishbone_master_in_t;
116
  subtype wishbone_master_in_array_t is wishbone_slave_out_array_t;
117
 
118
  constant wb_master_out_idle_c : wishbone_master_out_t := (
119
                                                        clk  =>  '0',
120
                                                        dat  =>  wishbone_data_of_unused_address_c,
121
                                                        rst  =>  '0',
122
                                                        tgd  =>  (others=>'0'),
123
                                                        adr  =>  (others=>'U'),
124
                                                        cyc  =>  '0',
125
                                                        lock =>  '0',
126
                                                        sel  =>  (others=>'0'),
127
                                                        stb  =>  '0',
128
                                                        tga  =>  (others=>'0'),
129
                                                        tgc  =>  (others=>'0'),
130
                                                        we   =>  '0'
131
                                                        );
132
 
133
  -- constant cc_dummy_address : std_logic_vector(wishbone_address_width_c-1 downto 0) :=(others => 'X');
134
  -- constant cc_dummy_data : std_logic_vector(wishbone_address_width_c-1 downto 0) := (others => 'X');
135
  -- constant cc_dummy_sel : std_logic_vector(wishbone_data_width_c/8-1 downto 0) := (others => 'X');
136
  -- constant cc_dummy_slave_in : wishbone_slave_in_t :=('0', '0', cc_dummy_address, cc_dummy_sel, 'X', cc_dummy_data);
137
  -- constant cc_dummy_master_out : wishbone_master_out_t := cc_dummy_slave_in;
138
 
139
  -- -- Dangerous! Will stall a bus.
140
  -- constant cc_dummy_slave_out : wishbone_slave_out_t :=('X', 'X', 'X', 'X', 'X', cc_dummy_data);
141
  -- constant cc_dummy_master_in : wishbone_master_in_t := cc_dummy_slave_out;
142
 
143
  -- constant cc_dummy_address_array : wishbone_address_array_t(0 downto 0) := (0 => cc_dummy_address);
144
 
145
end wishbone_pkg;
146
 
147
-- package body ------------------------------------------------------
148
package body wishbone_pkg is
149
end wishbone_pkg;
150
----------------------------------------------------------------------
151
---- end of file                                                  ---- 
152
----------------------------------------------------------------------

powered by: WebSVN 2.1.0

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