OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [java/] [src/] [edu/] [byu/] [cc/] [plieber/] [fpgaenet/] [debug/] [llparse/] [RAMGroup.java] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 peteralieb
/*
2
@LICENSE@
3
*/
4
 
5
package edu.byu.cc.plieber.fpgaenet.debug.llparse;
6
import java.lang.String;
7
 
8
/**
9
 * This class stores all of the readback bitstream offset information
10
 * for an entire LUT RAM or BlockRAM.  It contains such information as
11
 * the name of the physical block containing the RAM, the type of the
12
 * RAM, an array of {@link RBLocation} objects (one object per bit in
13
 * the RAM), and the name of the RAM's output.
14
 *
15
 * @author Paul Graham */
16
public class RAMGroup {
17
 
18
  /* The sizes of basic RAM elements */
19
  /** The number of bits in a LUT RAM */
20
  static final int LUTSIZE = 64;
21
  /** The number of bits in a BlockRAM */
22
  static final int BLOCKRAMSIZE = 36864;
23
 
24
  /** Holds the block location of the RAM */
25
  String block;
26
  /** Holds the type of the RAM as defined by {@link RAMTypes}. */
27
  RAMTypes RAMType;
28
  /** Holds the readback offsets of the various RAM bits. The index
29
   * into the array is the same as the address for the RAM's bit, in
30
   * other words, the readback bitstream offset information for
31
   * address 10 of the RAM is accessed using an index of 10. */
32
  RBLocation[] offsets ;
33
  /**
34
   * Refers to the name of the RAM's output net. An artifact of the
35
   * old way readback was performed. */
36
  String netName;
37
 
38
  /**
39
   * Creates the object with the block location and with an array of
40
   * readback offsets appropriate to the <code>RAMType</code>. The
41
   * <code>RAMType</code> is also set for the RAM.
42
   *
43
   * @param new_block A <code>String</code> representing the physical
44
   *                  location of the block (SLICE/BlockRAM)
45
   *                  containing the RAM.
46
   *
47
   * @param new_RAMType The type of the RAM being represented by this
48
   *                    object (see {@link RAMTypes} to discover the
49
   *                    appropriate values).
50
   **/
51
  RAMGroup(String new_block,RAMTypes new_RAMType) throws RAMTypeException{
52
    block = new_block;
53
    RAMType = new_RAMType;
54
    switch(RAMType) {
55
    case A:
56
    case B:
57
    case C:
58
    case D:
59
      offsets = new RBLocation[RAMGroup.LUTSIZE];
60
      break;
61
    case BRAM:
62
      offsets = new RBLocation[RAMGroup.BLOCKRAMSIZE];
63
      break;
64
    default:
65
      throw new RAMTypeException("Invalid RAM Type Value:"+RAMType);
66
    }
67
  }
68
 
69
  /**
70
   * Creates the object with the block location and with an array of
71
   * readback offsets appropriate to the <code>RAMType</code> and
72
   * records the readback offset information for one bit of the RAM.
73
   * The <code>RAMType</code> is also set for the RAM.
74
   *
75
   * @param RE A <code>RAMRBEntry</code> object reflecting the FPGA
76
   *           block containing the RAM as well as the readback
77
   *           bitstream offset data.
78
   *  */
79
  RAMGroup(RAMRBEntry RE) throws RAMTypeException{
80
    block = RE.getBlock();
81
    RAMType = RE.RAMType;
82
    switch(RAMType) {
83
    case A:
84
    case B:
85
    case C:
86
    case D:
87
      offsets = new RBLocation[RAMGroup.LUTSIZE];
88
      break;
89
    case BRAM:
90
      offsets = new RBLocation[RAMGroup.BLOCKRAMSIZE];
91
      break;
92
    default:
93
      throw new RAMTypeException("Invalid RAM Type Value:"+RAMType);
94
    }
95
    offsets[RE.address]=new RBLocation(RE.getOffset(),RE.getFrame(),
96
                                       RE.getFrameOffset());
97
  }
98
 
99
  /**
100
   * Sets the name of the RAM's data output signal (not necessary with
101
   * the current scheme).
102
   *
103
   * @param net_netName The name of the RAM's data output signal
104
   *  */
105
  void setNetName(String new_netName) {
106
    netName = new_netName;
107
  }
108
 
109
  /**
110
   * Retrieves the name of the RAM's data output signal.
111
   *
112
   * @return  The name of the RAM's data output signal.
113
   */
114
  String getNetName() {
115
    return netName;
116
  }
117
 
118
  /**
119
   * Adds a readback bitstream offset entry for a bit of the RAM.
120
   *
121
   * @param RE A <code>RAMRBEntry</code> object reflecting the
122
   *           readback bitstream offset data for a specific bi in the
123
   *           RAM.  */
124
  void addRAMEntry(RAMRBEntry RE) {
125
    offsets[RE.address] = new RBLocation(RE.getOffset(),RE.getFrame(),
126
                                         RE.getFrameOffset());
127
  }
128
 
129
  /**
130
   * Returns the type of the RAM (see {@link RAMTypes}).
131
   *
132
   * @return The encoded type of the RAM as defined in
133
   *         <code>RAMTypes</code>.  */
134
  RAMTypes getRAMType() {
135
    return RAMType;
136
  }
137
 
138
  /**
139
   * Returns the block location string for the block containing the
140
   * RAM.
141
   *
142
   * @return The block location string for the block containing the
143
   *         RAM.  */
144
  String getBlock() {
145
    return block;
146
  }
147
 
148
 
149
  /**
150
   * Returns an array of <code>RBLocation</code> objects representing
151
   * the readback bitstream offsets for bits in the RAM.  The index
152
   * into the array is the same as the address for the RAM's bit, in
153
   * other words, the readback bitstream offset information for
154
   * address 10 of the RAM is accessed using an index of 10. */
155
  RBLocation[] getOffsets() {
156
    return offsets;
157
  }
158
 
159
  /**
160
   * Returns a <code>String</code> with all of the readback bitstream
161
   * offset information.
162
   *
163
   * @return A <code>String</code> with readback bitstream offset
164
   *         information.
165
   *  */
166
  public String toString() {
167
    StringBuffer retval;
168
 
169
    retval = new StringBuffer();
170
    for(int i=0;i<offsets.length;i++) {
171
      retval.append("  " +offsets[i]+" " +netName+"."+
172
                  RAMType.toString()+"."+i+"\n");
173
    }
174
    return retval.toString();
175
  }
176
 
177
  /**
178
   * Returns a <code>String</code> with all of the readback bitstream
179
   * offset information after a header describing the RAMGroup (output
180
   * net name and RAM size in bits).
181
   *
182
   * @return A <code>String</code> with readback bitstream offset
183
   *         information.
184
   *  */
185
  public String toGroupString() {
186
    StringBuffer retval;
187
 
188
    retval = new StringBuffer();
189
    retval.append("RAMGroup: "+netName+" "+offsets.length+"\n");
190
    for(int i=0;i<offsets.length;i++) {
191
      retval.append("  " +netName+"."+
192
                  RAMType.toString()+"."+i+" "+i+"\n");
193
    }
194
    return retval.toString();
195
  }
196
}
197
 

powered by: WebSVN 2.1.0

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