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 19

Go to most recent revision | Details | Compare with Previous | View Log

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