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

Subversion Repositories ht_tunnel

[/] [ht_tunnel/] [tags/] [START/] [bench/] [core/] [ResponsePacket.cpp] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 acastong
//ResponsePacket.cpp
2
 
3
/* ***** BEGIN LICENSE BLOCK *****
4
 * Version: MPL 1.1
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version
7
 * 1.1 (the "License"); you may not use this file except in compliance with
8
 * the License. You may obtain a copy of the License at
9
 * http://www.mozilla.org/MPL/
10
 *
11
 * Software distributed under the License is distributed on an "AS IS" basis,
12
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
 * for the specific language governing rights and limitations under the
14
 * License.
15
 *
16
 * The Original Code is HyperTransport Tunnel IP Core.
17
 *
18
 * The Initial Developer of the Original Code is
19
 * Ecole Polytechnique de Montreal.
20
 * Portions created by the Initial Developer are Copyright (C) 2005
21
 * the Initial Developer. All Rights Reserved.
22
 *
23
 * Contributor(s):
24
 *   Ami Castonguay <acastong@grm.polymtl.ca>
25
 *
26
 * Alternatively, the contents of this file may be used under the terms
27
 * of the Polytechnique HyperTransport Tunnel IP Core Source Code License
28
 * (the  "PHTICSCL License", see the file PHTICSCL.txt), in which case the
29
 * provisions of PHTICSCL License are applicable instead of those
30
 * above. If you wish to allow use of your version of this file only
31
 * under the terms of the PHTICSCL License and not to allow others to use
32
 * your version of this file under the MPL, indicate your decision by
33
 * deleting the provisions above and replace them with the notice and
34
 * other provisions required by the PHTICSCL License. If you do not delete
35
 * the provisions above, a recipient may use your version of this file
36
 * under either the MPL or the PHTICSCL License."
37
 *
38
 * ***** END LICENSE BLOCK ***** */
39
 
40
#include "ResponsePacket.h"
41
 
42
ResponsePacket::ResponsePacket(const sc_bv<6> &command,
43
                                                                           const sc_bv<5> &unitID,
44
                                                                           const sc_bv<5> &srcTag,
45
                                                                           const sc_bv<2> &rqUID,
46
                                                                           bool bridge,
47
                                                                           ResponseError error,
48
                                                                           bool passPW,
49
                                                                           bool isoc)
50
{
51
        bv.range(5,0) = command;
52
        bv.range(12,8) = unitID;
53
        bv.range(20,16) = srcTag;
54
        bv.range(31,30) = rqUID;
55
 
56
        //Error 0 => bv[20]
57
        //Error 1 => bv[28]
58
 
59
        if(error == RE_NORMAL || error == RE_DATA_ERROR)
60
                bv[20] = false;
61
        else
62
                bv[20] = true;
63
 
64
        if(error == RE_NORMAL || error == RE_TARGET_ABORT)
65
                bv[28] = false;
66
        else
67
                bv[28] = true;
68
 
69
        bv[14] = bridge;
70
        bv[15] = passPW;
71
        bv[7] = isoc;
72
}
73
 
74
        //If the packet has a data packet associated to it
75
bool ResponsePacket::hasDataAssociated() const{
76
        if(bv(5 , 0) == "110000") return true;
77
        return false;
78
}
79
 
80
sc_uint<4> ResponsePacket::getDataLengthm1() const {
81
        sc_bv<4> temp = bv.range(25,22);
82
        return temp;
83
}
84
 
85
ResponseError ResponsePacket::getResponseError() const{
86
        if(bv[20] == false){
87
                if(bv[28] == false) return RE_NORMAL;
88
                return RE_DATA_ERROR;
89
        }
90
        else{
91
                if(bv[28] == false) return RE_TARGET_ABORT;
92
                return RE_MASTER_ABORT;
93
        }
94
}
95
 
96
/**
97
        @return unitID of the device that sent the response
98
*/
99
sc_bv<5> ResponsePacket::getUnitID() const{
100
        return bv.range(12,8);
101
}
102
 
103
bool ResponsePacket::getPassPW() const{
104
        return (sc_bit)bv[15];
105
}
106
 
107
 

powered by: WebSVN 2.1.0

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