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 16

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

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