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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [vlib/] [rlink/] [rlinklib.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 20 wfjm
-- $Id: rlinklib.vhd 509 2013-04-21 20:46:20Z mueller $
2 2 wfjm
--
3 20 wfjm
-- Copyright 2007-2013 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 9 wfjm
-- Package Name:   rlinklib
16
-- Description:    Definitions for rlink interface and bus entities
17 2 wfjm
--
18
-- Dependencies:   -
19 17 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 11.4, 12.1, 13.3; ghdl 0.18-0.29
20 9 wfjm
--
21 2 wfjm
-- Revision History: 
22
-- Date         Rev Version  Comment
23 20 wfjm
-- 2013-04-21   509   3.3.2  add rlb_moni record definition
24 17 wfjm
-- 2012-12-29   466   3.3.1  add rlink_rlbmux
25
-- 2011-12-23   444   3.3    CLK_CYCLE now integer
26 16 wfjm
-- 2011-12-21   442   3.2.1  retire old, deprecated interfaces
27
-- 2011-12-09   437   3.2    add rlink_core8
28 13 wfjm
-- 2011-11-18   427   3.1.3  now numeric_std clean
29 9 wfjm
-- 2010-12-25   348   3.1.2  drop RL_FLUSH support, add RL_MONI for rlink_core;
30
--                           new rlink_serport interface;
31
--                           rename rlink_core_serport->rlink_base_serport
32
-- 2010-12-24   347   3.1.1  rename: CP_*->RL->*
33
-- 2010-12-22   346   3.1    rename: [cd]crc->[cd]err, ioto->rbnak, ioerr->rberr
34
-- 2010-12-04   343   3.0    move rbus components to rbus/rblib; renames
35
--                           rri_ -> rlink and c_rri -> c_rlink;
36 2 wfjm
-- 2010-06-18   306   2.5.1  rename rbus data fields to _rbf_
37
-- 2010-06-06   302   2.5    use sop/eop framing instead of soc+chaining
38
-- 2010-06-03   300   2.1.5  use FAWIDTH=5 for rri_serport
39
-- 2010-05-02   287   2.1.4  ren CE_XSEC->CE_INT,RP_STAT->RB_STAT,AP_LAM->RB_LAM
40
--                           drop RP_IINT from interfaces; drop RTSFLUSH generic
41
-- 2010-05-01   285   2.1.3  remove rri_rb_rpcompat, now obsolete
42
-- 2010-04-18   279   2.1.2  rri_core_serport: drop RTSFBUF generic
43
-- 2010-04-10   275   2.1.1  add rri_core_serport
44
-- 2010-04-03   274   2.1    add CP_FLUSH for rri_core, rri_serport;
45
--                           CE_USEC, RTSFLUSH, CTS_N, RTS_N  for rri_serport
46
-- 2008-08-24   162   2.0    all with new rb_mreq/rb_sres interface
47
-- 2008-08-22   161   1.3    renamed rri_rbres_ -> rb_sres_; drop rri_[24]rp
48
-- 2008-02-16   116   1.2.1  added rri_wreg(rw|w|r)_3
49
-- 2008-01-20   113   1.2    added rb_[mreq|sres]; _rbres_or_*; _rb_rpcompat
50
-- 2007-11-24    98   1.1    added RP_IINT for rri_core.
51
-- 2007-09-09    81   1.0    Initial version 
52
------------------------------------------------------------------------------
53
 
54
library ieee;
55
use ieee.std_logic_1164.all;
56 13 wfjm
use ieee.numeric_std.all;
57 2 wfjm
 
58
use work.slvtypes.all;
59 9 wfjm
use work.rblib.all;
60 19 wfjm
use work.serportlib.all;
61 2 wfjm
 
62 9 wfjm
package rlinklib is
63 2 wfjm
 
64 9 wfjm
constant c_rlink_cpref : slv4 := "1000";  -- default comma prefix
65
constant c_rlink_ncomm : positive := 4;   -- number commas (sop,eop,nak,attn)
66 2 wfjm
 
67 9 wfjm
constant c_rlink_dat_idle : slv9 := "100000000";
68
constant c_rlink_dat_sop  : slv9 := "100000001";
69
constant c_rlink_dat_eop  : slv9 := "100000010";
70
constant c_rlink_dat_nak  : slv9 := "100000011";
71
constant c_rlink_dat_attn : slv9 := "100000100";
72 2 wfjm
 
73 9 wfjm
constant c_rlink_cmd_rreg : slv3 := "000";
74
constant c_rlink_cmd_rblk : slv3 := "001";
75
constant c_rlink_cmd_wreg : slv3 := "010";
76
constant c_rlink_cmd_wblk : slv3 := "011";
77
constant c_rlink_cmd_stat : slv3 := "100";
78
constant c_rlink_cmd_attn : slv3 := "101";
79
constant c_rlink_cmd_init : slv3 := "110";
80 2 wfjm
 
81 9 wfjm
constant c_rlink_iint_rbf_anena:    integer := 15;         -- anena flag
82
constant c_rlink_iint_rbf_itoena:   integer := 14;         -- itoena flag
83 19 wfjm
subtype  c_rlink_iint_rbf_itoval is integer range 7 downto 0; -- itoval value
84 2 wfjm
 
85 9 wfjm
subtype  c_rlink_cmd_rbf_seq is  integer range 7 downto 3; -- sequence number
86
subtype  c_rlink_cmd_rbf_code is integer range 2 downto 0; -- command code
87 2 wfjm
 
88 9 wfjm
subtype  c_rlink_stat_rbf_stat is integer range 7 downto 5;  -- ext status bits
89
constant c_rlink_stat_rbf_attn:   integer := 4;  -- attention flags set
90
constant c_rlink_stat_rbf_cerr:   integer := 3;  -- command error
91
constant c_rlink_stat_rbf_derr:   integer := 2;  -- data error
92
constant c_rlink_stat_rbf_rbnak:  integer := 1;  -- rbus no ack or timeout
93
constant c_rlink_stat_rbf_rberr:  integer := 0;  -- rbus err bit set
94 2 wfjm
 
95 9 wfjm
type rl_moni_type is record             -- rlink_core monitor port
96
  eop  : slbit;                         -- eop send in last cycle
97
  attn : slbit;                         -- attn send in last cycle
98
  lamp : slbit;                         -- attn (lam) pending
99
end record rl_moni_type;
100 2 wfjm
 
101 9 wfjm
constant rl_moni_init : rl_moni_type :=
102
  ('0','0','0');                        -- eop,attn,lamp
103 2 wfjm
 
104 20 wfjm
type rlb_moni_type is record            -- rlink 8b monitor port
105
  rxval : slbit;                        -- data in valid
106
  rxhold : slbit;                       -- data in hold
107
  txena : slbit;                        -- data out enable
108
  txbusy : slbit;                       -- data out busy
109
end record rlb_moni_type;
110
 
111
constant rlb_moni_init : rlb_moni_type :=
112
  ('0','0','0','0');                    -- rxval,rxhold,txena,txbusy
113
 
114 13 wfjm
-- ise 13.1 xst can bug check if generic defaults in a package are defined via 
115
-- 'slv(to_unsigned())'. The conv_ construct prior to numeric_std was ok.
116
-- As workaround the ibus default addresses are defined here as constant.
117
constant rbaddr_rlink_serport : slv8 := slv(to_unsigned(2#11111110#,8));
118
 
119 16 wfjm
-- this definition logically belongs into the 'for test benches' section'
120
-- must be here because it is needed as generic default in rlink_core8
121
-- simbus sb_cntl field usage for rlink
122
constant sbcntl_sbf_rlmon : integer := 15;
123
 
124 9 wfjm
component rlink_core is                 -- rlink core with 9bit iface
125 2 wfjm
  generic (
126
    ATOWIDTH : positive :=  5;          -- access timeout counter width
127
    ITOWIDTH : positive :=  6);         -- idle timeout counter width
128
  port (
129
    CLK  : in slbit;                    -- clock
130 9 wfjm
    CE_INT : in slbit := '0';           -- rlink ito time unit clock enable
131 2 wfjm
    RESET  : in slbit;                  -- reset
132 9 wfjm
    RL_DI : in slv9;                    -- rlink 9b: data in
133
    RL_ENA : in slbit;                  -- rlink 9b: data enable
134
    RL_BUSY : out slbit;                -- rlink 9b: data busy
135
    RL_DO : out slv9;                   -- rlink 9b: data out
136
    RL_VAL : out slbit;                 -- rlink 9b: data valid
137
    RL_HOLD : in slbit;                 -- rlink 9b: data hold
138
    RL_MONI : out rl_moni_type;         -- rlink: monitor port
139 2 wfjm
    RB_MREQ : out rb_mreq_type;         -- rbus: request
140
    RB_SRES : in rb_sres_type;          -- rbus: response
141
    RB_LAM : in slv16;                  -- rbus: look at me
142
    RB_STAT : in slv3                   -- rbus: status flags
143
  );
144
end component;
145
 
146 9 wfjm
component rlink_aif is                  -- rlink, abstract interface
147 2 wfjm
  port (
148
    CLK  : in slbit;                    -- clock
149 9 wfjm
    CE_INT : in slbit := '0';           -- rlink ito time unit clock enable
150 2 wfjm
    RESET  : in slbit :='0';            -- reset
151 9 wfjm
    RL_DI : in slv9;                    -- rlink 9b: data in
152
    RL_ENA : in slbit;                  -- rlink 9b: data enable
153
    RL_BUSY : out slbit;                -- rlink 9b: data busy
154
    RL_DO : out slv9;                   -- rlink 9b: data out
155
    RL_VAL : out slbit;                 -- rlink 9b: data valid
156
    RL_HOLD : in slbit := '0'           -- rlink 9b: data hold
157 2 wfjm
  );
158
end component;
159
 
160 16 wfjm
component rlink_core8 is                -- rlink core with 8bit iface
161 9 wfjm
  generic (
162
    ATOWIDTH : positive :=  5;          -- access timeout counter width
163
    ITOWIDTH : positive :=  6;          -- idle timeout counter width
164
    CPREF : slv4 := c_rlink_cpref;      -- comma prefix
165
    ENAPIN_RLMON : integer := sbcntl_sbf_rlmon;  -- SB_CNTL for rlmon (-1=none)
166
    ENAPIN_RBMON : integer := sbcntl_sbf_rbmon); -- SB_CNTL for rbmon (-1=none)
167
  port (
168
    CLK  : in slbit;                    -- clock
169
    CE_INT : in slbit := '0';           -- rlink ito time unit clock enable
170
    RESET  : in slbit;                  -- reset
171
    RLB_DI : in slv8;                   -- rlink 8b: data in
172
    RLB_ENA : in slbit;                 -- rlink 8b: data enable
173
    RLB_BUSY : out slbit;               -- rlink 8b: data busy
174
    RLB_DO : out slv8;                  -- rlink 8b: data out
175
    RLB_VAL : out slbit;                -- rlink 8b: data valid
176
    RLB_HOLD : in slbit;                -- rlink 8b: data hold
177
    RL_MONI : out rl_moni_type;         -- rlink: monitor port
178
    RB_MREQ : out rb_mreq_type;         -- rbus: request
179
    RB_SRES : in rb_sres_type;          -- rbus: response
180
    RB_LAM : in slv16;                  -- rbus: look at me
181
    RB_STAT : in slv3                   -- rbus: status flags
182
  );
183
end component;
184
 
185 17 wfjm
component rlink_rlbmux is               -- rlink rlb multiplexer
186
  port (
187
    SEL : in slbit;                     -- port select (0:RLB<->P0; 1:RLB<->P1)
188
    RLB_DI : out slv8;                  -- rlb: data in
189
    RLB_ENA : out slbit;                -- rlb: data enable
190
    RLB_BUSY : in slbit;                -- rlb: data busy
191
    RLB_DO : in slv8;                   -- rlb: data out
192
    RLB_VAL : in slbit;                 -- rlb: data valid
193
    RLB_HOLD : out slbit;               -- rlb: data hold
194
    P0_RXDATA : in slv8;                -- p0: rx data
195
    P0_RXVAL : in slbit;                -- p0: rx valid
196
    P0_RXHOLD : out slbit;              -- p0: rx hold
197
    P0_TXDATA : out slv8;               -- p0: tx data
198
    P0_TXENA : out slbit;               -- p0: tx enable
199
    P0_TXBUSY : in slbit;               -- p0: tx busy
200
    P1_RXDATA : in slv8;                -- p1: rx data
201
    P1_RXVAL : in slbit;                -- p1: rx valid
202
    P1_RXHOLD : out slbit;              -- p1: rx hold
203
    P1_TXDATA : out slv8;               -- p1: tx data
204
    P1_TXENA : out slbit;               -- p1: tx enable
205
    P1_TXBUSY : in slbit                -- p1: tx busy
206
  );
207
end component;
208
 
209 16 wfjm
--
210
-- core + concrete_interface combo's
211
--
212 9 wfjm
 
213 16 wfjm
component rlink_sp1c is                 -- rlink_core8+serport_1clock combo
214 9 wfjm
  generic (
215 2 wfjm
    ATOWIDTH : positive :=  5;          -- access timeout counter width
216
    ITOWIDTH : positive :=  6;          -- idle timeout counter width
217 9 wfjm
    CPREF : slv4 := c_rlink_cpref;      -- comma prefix
218
    IFAWIDTH : natural :=  5;           -- input fifo address width  (0=none)
219
    OFAWIDTH : natural :=  5;           -- output fifo address width (0=none)
220
    ENAPIN_RLMON : integer := sbcntl_sbf_rlmon;  -- SB_CNTL for rlmon (-1=none)
221
    ENAPIN_RBMON : integer := sbcntl_sbf_rbmon;  -- SB_CNTL for rbmon (-1=none)
222 2 wfjm
    CDWIDTH : positive := 13;           -- clk divider width
223
    CDINIT : natural   := 15);          -- clk divider initial/reset setting
224
  port (
225
    CLK  : in slbit;                    -- clock
226
    CE_USEC : in slbit;                 -- 1 usec clock enable
227
    CE_MSEC : in slbit;                 -- 1 msec clock enable
228
    CE_INT : in slbit := '0';           -- rri ito time unit clock enable
229
    RESET  : in slbit;                  -- reset
230 16 wfjm
    ENAXON : in slbit;                  -- enable xon/xoff handling
231
    ENAESC : in slbit;                  -- enable xon/xoff escaping
232 2 wfjm
    RXSD : in slbit;                    -- receive serial data      (board view)
233
    TXSD : out slbit;                   -- transmit serial data     (board view)
234
    CTS_N : in slbit := '0';            -- clear to send   (act.low, board view)
235
    RTS_N : out slbit;                  -- request to send (act.low, board view)
236
    RB_MREQ : out rb_mreq_type;         -- rbus: request
237
    RB_SRES : in rb_sres_type;          -- rbus: response
238
    RB_LAM : in slv16;                  -- rbus: look at me
239 9 wfjm
    RB_STAT : in slv3;                  -- rbus: status flags
240
    RL_MONI : out rl_moni_type;         -- rlink_core: monitor port
241 16 wfjm
    SER_MONI : out serport_moni_type    -- serport: monitor port
242 2 wfjm
  );
243
end component;
244
 
245 9 wfjm
--
246
-- components for use in test benches (not synthesizable)
247
--
248 2 wfjm
 
249 9 wfjm
component rlink_mon is                  -- rlink monitor
250 2 wfjm
  generic (
251 9 wfjm
    DWIDTH : positive :=  9);           -- data port width (8 or 9)
252 2 wfjm
  port (
253
    CLK  : in slbit;                    -- clock
254 17 wfjm
    CLK_CYCLE : in integer := 0;        -- clock cycle number
255 9 wfjm
    ENA  : in slbit := '1';             -- enable monitor output
256
    RL_DI : in slv(DWIDTH-1 downto 0);  -- rlink: data in
257
    RL_ENA : in slbit;                  -- rlink: data enable
258
    RL_BUSY : in slbit;                 -- rlink: data busy
259
    RL_DO : in slv(DWIDTH-1 downto 0);  -- rlink: data out
260
    RL_VAL : in slbit;                  -- rlink: data valid
261
    RL_HOLD : in slbit                  -- rlink: data hold
262 2 wfjm
  );
263
end component;
264
 
265 9 wfjm
component rlink_mon_sb is              -- simbus wrap for rlink monitor
266 2 wfjm
  generic (
267 9 wfjm
    DWIDTH : positive :=  9;            -- data port width (8 or 9)
268
    ENAPIN : integer := sbcntl_sbf_rlmon); -- SB_CNTL signal to use for enable
269 2 wfjm
  port (
270
    CLK  : in slbit;                    -- clock
271 9 wfjm
    RL_DI : in slv(DWIDTH-1 downto 0);  -- rlink: data in
272
    RL_ENA : in slbit;                  -- rlink: data enable
273
    RL_BUSY : in slbit;                 -- rlink: data busy
274
    RL_DO : in slv(DWIDTH-1 downto 0);  -- rlink: data out
275
    RL_VAL : in slbit;                  -- rlink: data valid
276
    RL_HOLD : in slbit                  -- rlink: data hold
277 2 wfjm
  );
278
end component;
279
 
280 12 wfjm
end package rlinklib;

powered by: WebSVN 2.1.0

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