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

Subversion Repositories ht_tunnel

[/] [ht_tunnel/] [tags/] [START/] [bench/] [link_l2/] [link_frame_rx_l3_tb/] [link_rx_transmitter.h] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 acastong
//link_rx_transmitter.h
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is HyperTransport Tunnel IP Core.
16
 *
17
 * The Initial Developer of the Original Code is
18
 * Ecole Polytechnique de Montreal.
19
 * Portions created by the Initial Developer are Copyright (C) 2005
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Ami Castonguay <acastong@grm.polymtl.ca>
24
 *
25
 * Alternatively, the contents of this file may be used under the terms
26
 * of the Polytechnique HyperTransport Tunnel IP Core Source Code License
27
 * (the  "PHTICSCL License", see the file PHTICSCL.txt), in which case the
28
 * provisions of PHTICSCL License are applicable instead of those
29
 * above. If you wish to allow use of your version of this file only
30
 * under the terms of the PHTICSCL License and not to allow others to use
31
 * your version of this file under the MPL, indicate your decision by
32
 * deleting the provisions above and replace them with the notice and
33
 * other provisions required by the PHTICSCL License. If you do not delete
34
 * the provisions above, a recipient may use your version of this file
35
 * under either the MPL or the PHTICSCL License."
36
 *
37
 * ***** END LICENSE BLOCK ***** */
38
 
39
#ifndef LINK_RX_TRANSMITTER_H
40
#define LINK_RX_TRANSMITTER_H
41
 
42
#include "../../../rtl/systemc/core_synth/synth_datatypes.h"
43
 
44
///Allows to transmit data to the link in order to test it
45
/**
46
        @class link_rx_transmitter
47
        @author Ami Castonguay
48
        @description
49
        This is a module that takes care of transmitting data to the
50
        link in order to test it.  It takes care of sending an initial
51
        sequence and afterwards transmitting valid data.  It does not
52
        take care of CRC's.
53
 
54
        The transmitter can run at various bit-widths and also at
55
        different offsets.  What is meant by offset is that when data
56
        is received by the HT tunnel, it is deserialized to 32 bits from
57
        its original bit-width.  Because of this deserialization, the
58
        final data might not be alligned naturally (the received 32-bit
59
        might contain the end of a dword and the beggining of another
60
        dword).  The transmitter takes care of simulating this.
61
 
62
 
63
        Natural allignment (offset of 0) is this for a 4 bit link:
64
        output0:  28 ... 9  5 1
65
        output1:  29 ... 10 6 2
66
        output2:  30 ... 11 7 3
67
        output3:  31 ... 12 8 4
68
 
69
        Offset of 2 is this for a 4 bit link:
70
        output0:  20 ... 9  5 1 + 28 24
71
        output1:  21 ... 10 6 2 + 29 25
72
        output2:  22 ... 11 7 3 + 30 26
73
        output3:  23 ... 12 8 4 + 31 27
74
 
75
        The (+) marks a change in data dword, even if it's received in the same
76
        phy_cad_lk.
77
*/
78
class link_rx_transmitter : public sc_module{
79
 
80
public:
81
 
82
        sc_in<bool > clk;
83
 
84
        ///CTL value sent to the HT tunnel
85
        sc_out<sc_bv<CAD_IN_DEPTH> >    phy_ctl_lk;
86
        ///CAD value sent to the tunnel
87
        /** Every element of the array represent one input of the tunnel
88
                that was deserialized to a factor of CAD_IN_DEPTH*/
89
        sc_out<sc_bv<CAD_IN_DEPTH> >    phy_cad_lk[CAD_IN_WIDTH];
90
        ///If CAD and CTL values are available to be consumed
91
        /** True when a dword is sent through the transmitter, false
92
                otherwise*/
93
        sc_out<bool>                                    phy_available_lk;
94
 
95
        ///The bit-width of the link
96
        int bit_width;
97
        ///The offset : how the data is offset from its natural allignment
98
        int transmission_offset;
99
        ///The last data sent, so that it can be used when sending the data with offset
100
        sc_bv<32>       last_sent_dword;
101
        ///The last lctl sent, so that it can be used when sending the data with offset
102
        bool            last_sent_lctl;
103
        ///The last hctl sent, so that it can be used when sending the data with offset
104
        bool            last_sent_hctl;
105
 
106
#ifndef INTERNAL_SHIFTER_ALIGNMENT
107
        ///High speed deserializer should stall shifting bits for lk_deser_stall_cycles_phy cycles
108
        /** Cannot be asserted with a lk_deser_stall_cycles_phy value of 0*/
109
        sc_in<bool > lk_deser_stall_phy;
110
        ///Number of bit times to stall deserializing incoming data when lk_deser_stall_phy is asserted
111
        sc_in<sc_uint<LOG2_CAD_IN_DEPTH> > lk_deser_stall_cycles_phy;
112
 
113
        void realign();
114
 
115
        SC_HAS_PROCESS(link_rx_transmitter);
116
#endif
117
 
118
 
119
        ///Constructor
120
        link_rx_transmitter(sc_module_name name);
121
 
122
        ///Sends the correct CAD and CTL values to initialize the link
123
        /**
124
                @param offset1 Offset at the beggining of the init sequence
125
                @param offset2 Offset at the end of the init sequence.  It does not
126
                        have to be the same as offset1.  offset2 will be the final offset
127
                        that will be kept after the init sequence is done
128
        */
129
        void send_init_sequence(int offset1, int offset2);
130
        ///Sends a dword on the link
131
        /**
132
                @param dword The dword to send
133
                @param lctl The CTL value sent with the dword for first half of transmission
134
                @param hctl The CTL value sent with the dword for last half of transmission
135
                @param ctl_error If a CTL transition error should be introduced.  A
136
                        transition at another moment than the half of the transmission will
137
                        be made (which is illegal in HT)
138
        */
139
        void send_dword_link(const sc_bv<32> & dword,
140
                                 bool lctl, bool hctl, bool ctl_error = false);
141
        ///Send reset signaling
142
        void send_initial_value(int nb_cyles);
143
};
144
 
145
#endif

powered by: WebSVN 2.1.0

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