1 |
30 |
wfjm |
-- $Id: iblib.vhd 672 2015-05-02 21:58:28Z mueller $
|
2 |
2 |
wfjm |
--
|
3 |
30 |
wfjm |
-- Copyright 2008-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
4 |
2 |
wfjm |
--
|
5 |
|
|
-- This program is free software; you may redistribute and/or modify it under
|
6 |
|
|
-- the terms of the GNU General Public License as published by the Free
|
7 |
|
|
-- Software Foundation, either version 2, or at your option any later version.
|
8 |
|
|
--
|
9 |
|
|
-- This program is distributed in the hope that it will be useful, but
|
10 |
|
|
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
11 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
12 |
|
|
-- for complete details.
|
13 |
|
|
--
|
14 |
|
|
------------------------------------------------------------------------------
|
15 |
|
|
-- Package Name: iblib
|
16 |
|
|
-- Description: Definitions for ibus interface and bus entities
|
17 |
|
|
--
|
18 |
|
|
-- Dependencies: -
|
19 |
29 |
wfjm |
-- Tool versions: ise 8.1-14.7; viv 2014.4; ghdl 0.18-0.31
|
20 |
2 |
wfjm |
-- Revision History:
|
21 |
|
|
-- Date Rev Version Comment
|
22 |
30 |
wfjm |
-- 2015-04-24 668 2.1 add ibd_ibmon
|
23 |
8 |
wfjm |
-- 2010-10-23 335 2.0.1 add ib_sel; add ib_sres_or_mon
|
24 |
|
|
-- 2010-10-17 333 2.0 ibus V2 interface: use aval,re,we,rmw
|
25 |
2 |
wfjm |
-- 2010-06-11 303 1.1 added racc,cacc signals to ib_mreq_type
|
26 |
|
|
-- 2009-06-01 221 1.0.1 added dip signal to ib_mreq_type
|
27 |
|
|
-- 2008-08-22 161 1.0 Initial version (extracted from pdp11.vhd)
|
28 |
|
|
------------------------------------------------------------------------------
|
29 |
|
|
|
30 |
|
|
library ieee;
|
31 |
|
|
use ieee.std_logic_1164.all;
|
32 |
30 |
wfjm |
use ieee.numeric_std.all;
|
33 |
2 |
wfjm |
|
34 |
|
|
use work.slvtypes.all;
|
35 |
|
|
|
36 |
|
|
package iblib is
|
37 |
|
|
|
38 |
|
|
type ib_mreq_type is record -- ibus - master request
|
39 |
8 |
wfjm |
aval : slbit; -- address valid
|
40 |
|
|
re : slbit; -- read enable
|
41 |
2 |
wfjm |
we : slbit; -- write enable
|
42 |
8 |
wfjm |
rmw : slbit; -- read-modify-write
|
43 |
2 |
wfjm |
be0 : slbit; -- byte enable low
|
44 |
|
|
be1 : slbit; -- byte enable high
|
45 |
|
|
cacc : slbit; -- console access
|
46 |
|
|
racc : slbit; -- remote access
|
47 |
|
|
addr : slv13_1; -- address bit(12:1)
|
48 |
|
|
din : slv16; -- data (input to slave)
|
49 |
|
|
end record ib_mreq_type;
|
50 |
|
|
|
51 |
|
|
constant ib_mreq_init : ib_mreq_type :=
|
52 |
8 |
wfjm |
('0','0','0','0', -- aval, re, we, rmw
|
53 |
|
|
'0','0','0','0', -- be0, be1, cacc, racc
|
54 |
2 |
wfjm |
(others=>'0'), -- addr
|
55 |
|
|
(others=>'0')); -- din
|
56 |
|
|
|
57 |
|
|
type ib_sres_type is record -- ibus - slave response
|
58 |
|
|
ack : slbit; -- acknowledge
|
59 |
|
|
busy : slbit; -- busy
|
60 |
|
|
dout : slv16; -- data (output from slave)
|
61 |
|
|
end record ib_sres_type;
|
62 |
|
|
|
63 |
|
|
constant ib_sres_init : ib_sres_type :=
|
64 |
|
|
('0','0', -- ack, busy
|
65 |
|
|
(others=>'0')); -- dout
|
66 |
|
|
|
67 |
|
|
type ib_sres_vector is array (natural range <>) of ib_sres_type;
|
68 |
|
|
|
69 |
|
|
subtype ibf_byte1 is integer range 15 downto 8;
|
70 |
|
|
subtype ibf_byte0 is integer range 7 downto 0;
|
71 |
|
|
|
72 |
8 |
wfjm |
component ib_sel is -- ibus address select logic
|
73 |
|
|
generic (
|
74 |
|
|
IB_ADDR : slv16; -- ibus address base
|
75 |
|
|
SAWIDTH : natural := 0); -- device subaddress space width
|
76 |
|
|
port (
|
77 |
|
|
CLK : in slbit; -- clock
|
78 |
|
|
IB_MREQ : in ib_mreq_type; -- ibus request
|
79 |
|
|
SEL : out slbit -- select state bit
|
80 |
|
|
);
|
81 |
|
|
end component;
|
82 |
|
|
|
83 |
2 |
wfjm |
component ib_sres_or_2 is -- ibus result or, 2 input
|
84 |
|
|
port (
|
85 |
|
|
IB_SRES_1 : in ib_sres_type; -- ib_sres input 1
|
86 |
|
|
IB_SRES_2 : in ib_sres_type := ib_sres_init; -- ib_sres input 2
|
87 |
|
|
IB_SRES_OR : out ib_sres_type -- ib_sres or'ed output
|
88 |
|
|
);
|
89 |
|
|
end component;
|
90 |
|
|
component ib_sres_or_3 is -- ibus result or, 3 input
|
91 |
|
|
port (
|
92 |
|
|
IB_SRES_1 : in ib_sres_type; -- ib_sres input 1
|
93 |
|
|
IB_SRES_2 : in ib_sres_type := ib_sres_init; -- ib_sres input 2
|
94 |
|
|
IB_SRES_3 : in ib_sres_type := ib_sres_init; -- ib_sres input 3
|
95 |
|
|
IB_SRES_OR : out ib_sres_type -- ib_sres or'ed output
|
96 |
|
|
);
|
97 |
|
|
end component;
|
98 |
|
|
component ib_sres_or_4 is -- ibus result or, 4 input
|
99 |
|
|
port (
|
100 |
|
|
IB_SRES_1 : in ib_sres_type; -- ib_sres input 1
|
101 |
|
|
IB_SRES_2 : in ib_sres_type := ib_sres_init; -- ib_sres input 2
|
102 |
|
|
IB_SRES_3 : in ib_sres_type := ib_sres_init; -- ib_sres input 3
|
103 |
|
|
IB_SRES_4 : in ib_sres_type := ib_sres_init; -- ib_sres input 4
|
104 |
|
|
IB_SRES_OR : out ib_sres_type -- ib_sres or'ed output
|
105 |
|
|
);
|
106 |
|
|
end component;
|
107 |
|
|
|
108 |
|
|
component ib_sres_or_gen is -- ibus result or, generic
|
109 |
|
|
generic (
|
110 |
|
|
WIDTH : natural := 4); -- number of input ports
|
111 |
|
|
port (
|
112 |
|
|
IB_SRES_IN : in ib_sres_vector(1 to WIDTH); -- ib_sres input array
|
113 |
|
|
IB_SRES_OR : out ib_sres_type -- ib_sres or'ed output
|
114 |
|
|
);
|
115 |
|
|
end component;
|
116 |
|
|
|
117 |
|
|
type intmap_type is record -- interrupt map entry type
|
118 |
|
|
vec : integer; -- vector address
|
119 |
|
|
pri : integer; -- priority
|
120 |
|
|
end record intmap_type;
|
121 |
|
|
constant intmap_init : intmap_type := (0,0);
|
122 |
|
|
|
123 |
|
|
type intmap_array_type is array (15 downto 0) of intmap_type;
|
124 |
|
|
constant intmap_array_init : intmap_array_type := (others=>intmap_init);
|
125 |
|
|
|
126 |
|
|
component ib_intmap is -- external interrupt mapper
|
127 |
|
|
generic (
|
128 |
|
|
INTMAP : intmap_array_type := intmap_array_init);
|
129 |
|
|
port (
|
130 |
|
|
EI_REQ : in slv16_1; -- interrupt request lines
|
131 |
|
|
EI_ACKM : in slbit; -- interrupt acknowledge (from master)
|
132 |
|
|
EI_ACK : out slv16_1; -- interrupt acknowledge (to requestor)
|
133 |
|
|
EI_PRI : out slv3; -- interrupt priority
|
134 |
|
|
EI_VECT : out slv9_2 -- interrupt vector
|
135 |
|
|
);
|
136 |
|
|
end component;
|
137 |
9 |
wfjm |
|
138 |
30 |
wfjm |
component ibd_ibmon is -- ibus dev: ibus monitor
|
139 |
|
|
generic (
|
140 |
|
|
IB_ADDR : slv16 := slv(to_unsigned(8#160000#,16));
|
141 |
|
|
AWIDTH : natural := 9);
|
142 |
|
|
port (
|
143 |
|
|
CLK : in slbit; -- clock
|
144 |
|
|
RESET : in slbit; -- reset
|
145 |
|
|
IB_MREQ : in ib_mreq_type; -- ibus: request
|
146 |
|
|
IB_SRES : out ib_sres_type; -- ibus: response
|
147 |
|
|
IB_SRES_SUM : in ib_sres_type -- ibus: response (sum for monitor)
|
148 |
|
|
);
|
149 |
|
|
end component;
|
150 |
|
|
|
151 |
9 |
wfjm |
--
|
152 |
|
|
-- components for use in test benches (not synthesizable)
|
153 |
|
|
--
|
154 |
2 |
wfjm |
|
155 |
9 |
wfjm |
component ib_sres_or_mon is -- ibus result or monitor
|
156 |
|
|
port (
|
157 |
|
|
IB_SRES_1 : in ib_sres_type; -- ib_sres input 1
|
158 |
|
|
IB_SRES_2 : in ib_sres_type := ib_sres_init; -- ib_sres input 2
|
159 |
|
|
IB_SRES_3 : in ib_sres_type := ib_sres_init; -- ib_sres input 3
|
160 |
|
|
IB_SRES_4 : in ib_sres_type := ib_sres_init -- ib_sres input 4
|
161 |
|
|
);
|
162 |
|
|
end component;
|
163 |
|
|
|
164 |
2 |
wfjm |
end package iblib;
|