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

Subversion Repositories ht_tunnel

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 acastong
//link_tx_validator.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_TX_VALIDATOR_H
40
#define LINK_TX_VALIDATOR_H
41
 
42
#include <queue>
43
#include "../../../rtl/systemc/core_synth/synth_datatypes.h"
44
#include "../../../rtl/systemc/core_synth/constants.h"
45
 
46
 
47
///Verfies what is sent by TX part of the link to check it is correct
48
class link_tx_validator : public sc_module{
49
public:
50
        ///struct regrouping dword and CTL values to send on link
51
        struct LinkTransmission_TX{
52
                sc_bv<32>       dword;
53
                bool            lctl;
54
                bool            hctl;
55
        };
56
 
57
        ///Possible values of the state of the link for the testbenches
58
        enum LinkTBState {
59
                LinkTBState_INACTIVE,///<Warm reset signaling
60
                LinkTBState_CTL_ACTIVE,///<CTL has been activated
61
                LinkTBState_SYNC,///<CTL returns to 0
62
                LinkTBState_PRERUN,///<Last dword of init before starting normal operation
63
                LinkTBState_RUN///<Normal operation of the link
64
        };
65
 
66
        ///Main clock of the system
67
        sc_in<bool >            clk;
68
 
69
        ///CTL sent by the link
70
        sc_in<sc_bv<CAD_OUT_DEPTH> >    lk_ctl_phy;
71
        ///CAD sent by the link
72
        sc_in<sc_bv<CAD_OUT_DEPTH> >    lk_cad_phy[CAD_OUT_WIDTH];
73
        ///If we consume the CTL and CAD signals
74
        sc_out<bool>            phy_consume_lk;
75
 
76
        ///If the data to frame sent to the TX is consumed
77
        sc_in<bool>             tx_consume_data;
78
        ///Data to frame and to sent on the link
79
        sc_out<sc_bv<32> >      cad_to_frame;
80
        ///LCTL to grame and send on the link
81
        sc_out<bool>            lctl_to_frame;
82
        ///HCTL to grame and send on the link
83
        sc_out<bool >           hctl_to_frame;
84
 
85
        ///Current state of the link
86
        LinkTBState state;
87
        ///Counter to keep track of how many cycles is spent in each init state
88
        int counter;
89
        ///The width of the link
90
        int bit_width;
91
 
92
        ///What we are expected to received from the TX
93
        std::queue< LinkTransmission_TX >       expected_transmission;
94
        ///Next transmissions that we want to pass to the TX
95
        std::queue< LinkTransmission_TX >       to_transmit;
96
 
97
        ///Framed version of what is sent on the link
98
        /**     When data is sent on the link, it is sent in a serialized
99
                way.  If the link width is smaller than the physical width,
100
                then it might take multiple cycles to deserialize a full dword.
101
                Intermediate result is stored in this variable.  New data is
102
                shifter from the left into the vector as it arrives.
103
        */
104
        sc_bv<32>       cad_output;
105
        ///Framed version of the CTL that is sent on the link See ::cad_output
106
        sc_bv<16>       ctl_output;
107
 
108
        ///If the TX part of the link is expected to consume data
109
        int expect_tx_consume_data;
110
        ///If we are checking for invalid behavious and warning when it happens
111
        bool checking_errors;
112
 
113
        ///SystemC Macro
114
        SC_HAS_PROCESS(link_tx_validator);
115
 
116
        ///Constructor
117
        link_tx_validator(sc_module_name name);
118
 
119
        ///Generates data that the TX link can send
120
        void send_data();
121
 
122
        ///Verifies that the output of the TX link is correct
123
        void validate_outputs();
124
 
125
        ///Sets internal state of this class to an initial value
126
        void reset();
127
};
128
 
129
#endif

powered by: WebSVN 2.1.0

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