1 |
8 |
wfjm |
-- $Id: iblib.vhd 335 2010-10-24 22:24:23Z mueller $
|
2 |
2 |
wfjm |
--
|
3 |
|
|
-- Copyright 2008-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
4 |
|
|
--
|
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 |
8 |
wfjm |
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2, 12.1; ghdl 0.18-0.29
|
20 |
2 |
wfjm |
-- Revision History:
|
21 |
|
|
-- Date Rev Version Comment
|
22 |
8 |
wfjm |
-- 2010-10-23 335 2.0.1 add ib_sel; add ib_sres_or_mon
|
23 |
|
|
-- 2010-10-17 333 2.0 ibus V2 interface: use aval,re,we,rmw
|
24 |
2 |
wfjm |
-- 2010-06-11 303 1.1 added racc,cacc signals to ib_mreq_type
|
25 |
|
|
-- 2009-06-01 221 1.0.1 added dip signal to ib_mreq_type
|
26 |
|
|
-- 2008-08-22 161 1.0 Initial version (extracted from pdp11.vhd)
|
27 |
|
|
------------------------------------------------------------------------------
|
28 |
|
|
|
29 |
|
|
library ieee;
|
30 |
|
|
use ieee.std_logic_1164.all;
|
31 |
|
|
use ieee.std_logic_arith.all;
|
32 |
|
|
|
33 |
|
|
use work.slvtypes.all;
|
34 |
|
|
|
35 |
|
|
package iblib is
|
36 |
|
|
|
37 |
|
|
type ib_mreq_type is record -- ibus - master request
|
38 |
8 |
wfjm |
aval : slbit; -- address valid
|
39 |
|
|
re : slbit; -- read enable
|
40 |
2 |
wfjm |
we : slbit; -- write enable
|
41 |
8 |
wfjm |
rmw : slbit; -- read-modify-write
|
42 |
2 |
wfjm |
be0 : slbit; -- byte enable low
|
43 |
|
|
be1 : slbit; -- byte enable high
|
44 |
|
|
cacc : slbit; -- console access
|
45 |
|
|
racc : slbit; -- remote access
|
46 |
|
|
addr : slv13_1; -- address bit(12:1)
|
47 |
|
|
din : slv16; -- data (input to slave)
|
48 |
|
|
end record ib_mreq_type;
|
49 |
|
|
|
50 |
|
|
constant ib_mreq_init : ib_mreq_type :=
|
51 |
8 |
wfjm |
('0','0','0','0', -- aval, re, we, rmw
|
52 |
|
|
'0','0','0','0', -- be0, be1, cacc, racc
|
53 |
2 |
wfjm |
(others=>'0'), -- addr
|
54 |
|
|
(others=>'0')); -- din
|
55 |
|
|
|
56 |
|
|
type ib_sres_type is record -- ibus - slave response
|
57 |
|
|
ack : slbit; -- acknowledge
|
58 |
|
|
busy : slbit; -- busy
|
59 |
|
|
dout : slv16; -- data (output from slave)
|
60 |
|
|
end record ib_sres_type;
|
61 |
|
|
|
62 |
|
|
constant ib_sres_init : ib_sres_type :=
|
63 |
|
|
('0','0', -- ack, busy
|
64 |
|
|
(others=>'0')); -- dout
|
65 |
|
|
|
66 |
|
|
type ib_sres_vector is array (natural range <>) of ib_sres_type;
|
67 |
|
|
|
68 |
|
|
subtype ibf_byte1 is integer range 15 downto 8;
|
69 |
|
|
subtype ibf_byte0 is integer range 7 downto 0;
|
70 |
|
|
|
71 |
8 |
wfjm |
component ib_sel is -- ibus address select logic
|
72 |
|
|
generic (
|
73 |
|
|
IB_ADDR : slv16; -- ibus address base
|
74 |
|
|
SAWIDTH : natural := 0); -- device subaddress space width
|
75 |
|
|
port (
|
76 |
|
|
CLK : in slbit; -- clock
|
77 |
|
|
IB_MREQ : in ib_mreq_type; -- ibus request
|
78 |
|
|
SEL : out slbit -- select state bit
|
79 |
|
|
);
|
80 |
|
|
end component;
|
81 |
|
|
|
82 |
2 |
wfjm |
component ib_sres_or_2 is -- ibus result or, 2 input
|
83 |
|
|
port (
|
84 |
|
|
IB_SRES_1 : in ib_sres_type; -- ib_sres input 1
|
85 |
|
|
IB_SRES_2 : in ib_sres_type := ib_sres_init; -- ib_sres input 2
|
86 |
|
|
IB_SRES_OR : out ib_sres_type -- ib_sres or'ed output
|
87 |
|
|
);
|
88 |
|
|
end component;
|
89 |
|
|
component ib_sres_or_3 is -- ibus result or, 3 input
|
90 |
|
|
port (
|
91 |
|
|
IB_SRES_1 : in ib_sres_type; -- ib_sres input 1
|
92 |
|
|
IB_SRES_2 : in ib_sres_type := ib_sres_init; -- ib_sres input 2
|
93 |
|
|
IB_SRES_3 : in ib_sres_type := ib_sres_init; -- ib_sres input 3
|
94 |
|
|
IB_SRES_OR : out ib_sres_type -- ib_sres or'ed output
|
95 |
|
|
);
|
96 |
|
|
end component;
|
97 |
|
|
component ib_sres_or_4 is -- ibus result or, 4 input
|
98 |
|
|
port (
|
99 |
|
|
IB_SRES_1 : in ib_sres_type; -- ib_sres input 1
|
100 |
|
|
IB_SRES_2 : in ib_sres_type := ib_sres_init; -- ib_sres input 2
|
101 |
|
|
IB_SRES_3 : in ib_sres_type := ib_sres_init; -- ib_sres input 3
|
102 |
|
|
IB_SRES_4 : in ib_sres_type := ib_sres_init; -- ib_sres input 4
|
103 |
|
|
IB_SRES_OR : out ib_sres_type -- ib_sres or'ed output
|
104 |
|
|
);
|
105 |
|
|
end component;
|
106 |
|
|
|
107 |
|
|
component ib_sres_or_gen is -- ibus result or, generic
|
108 |
|
|
generic (
|
109 |
|
|
WIDTH : natural := 4); -- number of input ports
|
110 |
|
|
port (
|
111 |
|
|
IB_SRES_IN : in ib_sres_vector(1 to WIDTH); -- ib_sres input array
|
112 |
|
|
IB_SRES_OR : out ib_sres_type -- ib_sres or'ed output
|
113 |
|
|
);
|
114 |
|
|
end component;
|
115 |
|
|
|
116 |
8 |
wfjm |
component ib_sres_or_mon is -- ibus result or monitor
|
117 |
|
|
port (
|
118 |
|
|
IB_SRES_1 : in ib_sres_type; -- ib_sres input 1
|
119 |
|
|
IB_SRES_2 : in ib_sres_type := ib_sres_init; -- ib_sres input 2
|
120 |
|
|
IB_SRES_3 : in ib_sres_type := ib_sres_init; -- ib_sres input 3
|
121 |
|
|
IB_SRES_4 : in ib_sres_type := ib_sres_init -- ib_sres input 4
|
122 |
|
|
);
|
123 |
|
|
end component;
|
124 |
|
|
|
125 |
2 |
wfjm |
type intmap_type is record -- interrupt map entry type
|
126 |
|
|
vec : integer; -- vector address
|
127 |
|
|
pri : integer; -- priority
|
128 |
|
|
end record intmap_type;
|
129 |
|
|
constant intmap_init : intmap_type := (0,0);
|
130 |
|
|
|
131 |
|
|
type intmap_array_type is array (15 downto 0) of intmap_type;
|
132 |
|
|
constant intmap_array_init : intmap_array_type := (others=>intmap_init);
|
133 |
|
|
|
134 |
|
|
component ib_intmap is -- external interrupt mapper
|
135 |
|
|
generic (
|
136 |
|
|
INTMAP : intmap_array_type := intmap_array_init);
|
137 |
|
|
port (
|
138 |
|
|
EI_REQ : in slv16_1; -- interrupt request lines
|
139 |
|
|
EI_ACKM : in slbit; -- interrupt acknowledge (from master)
|
140 |
|
|
EI_ACK : out slv16_1; -- interrupt acknowledge (to requestor)
|
141 |
|
|
EI_PRI : out slv3; -- interrupt priority
|
142 |
|
|
EI_VECT : out slv9_2 -- interrupt vector
|
143 |
|
|
);
|
144 |
|
|
end component;
|
145 |
|
|
|
146 |
|
|
end package iblib;
|