1 |
2 |
idiolatrie |
--------------------------------------------------------------------------------
|
2 |
|
|
-- Wishbone Interface --
|
3 |
|
|
--------------------------------------------------------------------------------
|
4 |
|
|
-- The WB interface specification types and some convinience functions. --
|
5 |
|
|
-- This definition lacks the CYC and the tag signals. --
|
6 |
|
|
-- --
|
7 |
|
|
--------------------------------------------------------------------------------
|
8 |
|
|
-- Copyright (C)2011 Mathias Hörtnagl <mathias.hoertnagl@gmail.comt> --
|
9 |
|
|
-- --
|
10 |
|
|
-- This program is free software: you can redistribute it and/or modify --
|
11 |
|
|
-- it under the terms of the GNU General Public License as published by --
|
12 |
|
|
-- the Free Software Foundation, either version 3 of the License, or --
|
13 |
|
|
-- (at your option) any later version. --
|
14 |
|
|
-- --
|
15 |
|
|
-- This program is distributed in the hope that it will be useful, --
|
16 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
|
17 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --
|
18 |
|
|
-- GNU General Public License for more details. --
|
19 |
|
|
-- --
|
20 |
|
|
-- You should have received a copy of the GNU General Public License --
|
21 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>. --
|
22 |
|
|
--------------------------------------------------------------------------------
|
23 |
|
|
library ieee;
|
24 |
|
|
use ieee.std_logic_1164.all;
|
25 |
|
|
use ieee.numeric_std.all;
|
26 |
|
|
|
27 |
|
|
package iwb is
|
28 |
|
|
|
29 |
|
|
-- WB MASTER
|
30 |
|
|
type master_out_t is record
|
31 |
|
|
dat : std_logic_vector(31 downto 0); -- DAT_O
|
32 |
|
|
sel : std_logic_vector(3 downto 0); -- SEL_O
|
33 |
|
|
adr : std_logic_vector(31 downto 0); -- ADR_O
|
34 |
|
|
stb : std_logic; -- STB_O
|
35 |
|
|
we : std_logic; -- WE_O
|
36 |
|
|
end record;
|
37 |
|
|
|
38 |
|
|
type master_in_t is record
|
39 |
|
|
clk : std_logic; -- CLK_I
|
40 |
|
|
rst : std_logic; -- RST_I
|
41 |
|
|
dat : std_logic_vector(31 downto 0); -- DAT_I
|
42 |
|
|
ack : std_logic; -- ACK_I
|
43 |
|
|
end record;
|
44 |
|
|
|
45 |
|
|
-- WB SLAVE
|
46 |
|
|
type slave_out_t is record
|
47 |
|
|
dat : std_logic_vector(31 downto 0); -- DAT_O
|
48 |
|
|
ack : std_logic; -- ACK_O
|
49 |
|
|
end record;
|
50 |
|
|
|
51 |
|
|
type slave_in_t is record
|
52 |
|
|
clk : std_logic; -- CLK_I
|
53 |
|
|
rst : std_logic; -- RST_I
|
54 |
|
|
dat : std_logic_vector(31 downto 0); -- DAT_I
|
55 |
|
|
sel : std_logic_vector(3 downto 0); -- SEL_I
|
56 |
|
|
adr : std_logic_vector(31 downto 0); -- ADR_I
|
57 |
|
|
stb : std_logic; -- STB_I
|
58 |
|
|
we : std_logic; -- WE_I
|
59 |
|
|
end record;
|
60 |
|
|
|
61 |
|
|
-- Indicates a Wb read or Wb write respectivly.
|
62 |
|
|
function wb_read(si : slave_in_t) return boolean;
|
63 |
|
|
function wb_write(si : slave_in_t) return boolean;
|
64 |
|
|
end iwb;
|
65 |
|
|
|
66 |
|
|
package body iwb is
|
67 |
|
|
|
68 |
|
|
function wb_read(si : slave_in_t) return boolean is
|
69 |
|
|
begin
|
70 |
|
|
return (si.stb = '1') and (si.we = '0');
|
71 |
|
|
end wb_read;
|
72 |
|
|
|
73 |
|
|
function wb_write(si : slave_in_t) return boolean is
|
74 |
|
|
begin
|
75 |
|
|
return (si.stb = '1') and (si.we = '1');
|
76 |
|
|
end wb_write;
|
77 |
|
|
|
78 |
|
|
end iwb;
|