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 25

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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