📄 sc_streamraw.i
字号:
#line 11 "D:/working/tools/isim/isimhostdll2/sc_streamraw.cpp"
char* AccessTypeEnumStr[] = {
"stride",
"index",
"bit reverse"
};
#line 1 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"
#line 1 "D:/working/tools/isim\\libapi.hpp"
#line 13 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"
#line 1 "D:/working/tools/isim/isimhostdll2/asynch.hpp"
#line 1 "D:/working/tools/isim\\libapi.hpp"
#line 9 "D:/working/tools/isim/isimhostdll2/asynch.hpp"
class AsynchProducer;
class AsynchConsumer;
typedef void (*AsynchWaitPtr)(AsynchProducer* producer,
void* waitObj, unsigned int waitID);
class __declspec(dllexport) AsynchProducer
{
private:
AsynchWaitPtr waitFn;
void* waitObj;
unsigned int waitID;
AsynchConsumer* consumerStart;
#line 30 "D:/working/tools/isim/isimhostdll2/asynch.hpp"
public:
AsynchProducer();
~AsynchProducer();
#line 39 "D:/working/tools/isim/isimhostdll2/asynch.hpp"
void attach(AsynchWaitPtr _waitFn, void* _waitObj);
bool isPending();
void set(const unsigned int& data);
friend class AsynchConsumer;
};
class __declspec(dllexport) AsynchConsumer
{
private:
unsigned int* data;
unsigned int reps;
AsynchProducer* producer;
AsynchConsumer* next;
void copy(const AsynchConsumer& _sc);
public:
AsynchConsumer();
~AsynchConsumer();
#line 65 "D:/working/tools/isim/isimhostdll2/asynch.hpp"
AsynchConsumer(AsynchConsumer& _sc);
AsynchConsumer& operator=(AsynchConsumer& _sc);
void attach(unsigned int* _data, unsigned int _reps);
void setPending(AsynchProducer* _producer, unsigned int waitID = 0);
bool isPending();
void copy(AsynchConsumer& _sc);
void reset();
void wait();
void set(const unsigned int& _data, AsynchProducer* _producer = 0);
friend class AsynchProducer;
};
#line 79 "D:/working/tools/isim/isimhostdll2/asynch.hpp"
#line 14 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"
#line 1 "D:/working/tools/isim\\string.hpp"
#line 15 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"
#line 1 "D:/working/tools/isim/isimhostdll2/sc_streamraw.hpp"
#line 16 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"
class IDebugScheduler;
class IdbStreamData;
class __declspec(dllexport) IdbStreamRaw : public StreamRaw
{
public:
IdbStreamData* streamData;
int streamDataImIdx;
int streamDataSize;
bool derived;
#line 50 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"
unsigned int length;
AsynchConsumer consumer;
IdbStreamRaw();
IdbStreamRaw(IdbStreamRaw& s);
~IdbStreamRaw();
IdbStreamRaw& operator=(IdbStreamRaw& s);
void initNew(unsigned int _size, unsigned int _flags,
unsigned int _recLength);
void initCopy(IdbStreamRaw* s);
StreamRaw* allocCopy();
void initDerived(const IdbStreamRaw* s,
unsigned int _start, unsigned int _end, unsigned int _flags,
StreamAccessEnum _accessType, int _stride, IdbStreamRaw* _index,
unsigned int _recLength, bool coordWords);
void destroy();
unsigned int const getLength(bool coordWords = false);
int const getLengthDebugOnly(bool coordWords = false);
int resolvePos(int pos, unsigned int numClusters,
unsigned int clusterRecLength);
inline unsigned int const __getLength() { return length; }
inline void __setLength(unsigned int _length) { length = _length; }
};
#line 122 "D:/working/tools/isim/isimhostdll2/idb_streamraw.hpp"
#line 20 "D:/working/tools/isim/isimhostdll2/sc_streamraw.cpp"
#line 24 "D:/working/tools/isim/isimhostdll2/sc_streamraw.cpp"
StreamRaw::StreamRaw():
valid(false), index(0),
debugName("<no name>")
{}
void StreamRaw::initNew(unsigned int _size, unsigned int _flags,
unsigned int _recLength)
{
valid = true;
start = 0;
end = _size * _recLength;
flags = _flags;
countup = (_flags & im_countup) != 0;
varPos = (_flags & (im_pvt_var_pos | im_align | im_incr)) != 0;
varSize = (_flags & (im_pvt_var_size | im_countup)) != 0;
varAlign = (_flags & im_align) != 0;
varIncr = (_flags & im_incr) != 0;
cacheable = (_flags & im_cacheable) != 0;
size = _size * _recLength;
accessType = im_acc_stride;
stride = _recLength;
recLength = _recLength;
index = 0;
debugName = "<no name>";
}
StreamRaw::StreamRaw(const StreamRaw& s):
valid(false), index(0),
debugName("<no name>")
{
initCopy(&s);
}
StreamRaw::~StreamRaw()
{
destroy();
}
StreamRaw& StreamRaw::operator=(const StreamRaw& s)
{
initCopy(&s);
return(*this);
}
void StreamRaw::initCopy(const StreamRaw* s)
{
destroy();
valid = s->valid;
start = s->start;
end = s->end;
size = s->size;
accessType = s->accessType;
stride = s->stride;
if (s->index) {
index = ((IdbStreamRaw*)(s->index))->allocCopy();
index->debugName = s->index->debugName;
} else {
index = 0;
}
recLength = s->recLength;
flags = s->flags;
countup = s->countup;
varPos = s->varPos;
varSize = s->varSize;
varAlign = s->varAlign;
varIncr = s->varIncr;
cacheable = s->cacheable;
}
StreamRaw* StreamRaw::allocCopy()
{
StreamRaw* s = new StreamRaw();
s->initCopy(this);
return(s);
}
void StreamRaw::updateSize()
{
unsigned int sizeRecs;
int effStride = stride == 0 ? recLength : stride;
if (accessType == im_acc_stride) {
unsigned int totalWords = end >= start ? end - start : start - end;
sizeRecs = (totalWords - recLength)/ effStride + 1;
} else if (accessType == im_acc_bit_reverse) {
unsigned int totalWords = end >= start ? end - start : start - end;
sizeRecs = totalWords / effStride;
} else if (accessType == im_acc_index) {
sizeRecs = index->getSize(true);
}
size = sizeRecs * recLength;
}
void StreamRaw::initDerived(const StreamRaw* s,
unsigned int _start, unsigned int _end, unsigned int _flags,
StreamAccessEnum _accessType, int _stride, StreamRaw* _index,
unsigned int _recLength, bool coordWords)
{
destroy();
test_error(s->valid, "Cannot derive a stream from a null stream!");
valid = true;
if (_recLength == 0) {
_recLength = 1;
}
if (s->accessType == im_acc_stride) {
if (s->stride == (int)s->recLength) {
int coordMult = coordWords ? 1 : s->recLength;
start = s->start + _start * coordMult;
end = s->start + _end * coordMult;
accessType = _accessType;
recLength = _recLength * coordMult;
if (accessType == im_acc_stride) {
if (_stride == DefaultStride) {
_stride = 1;
}
stride = _stride * coordMult;
index = 0;
} else if (accessType == im_acc_bit_reverse) {
int length = end - start;
test_error(length == 0 || exactLog2(length) >= 0,
"Length of a bit-reversed stream must be a power of two!");
if (_stride == DefaultStride) {
_stride = 1 << ceilLog2(recLength);
} else {
_stride *= coordMult;
}
stride = _stride;
test_error(stride >= (int)recLength && exactLog2(stride) >= 0,
"Stride of a bit-reversed stream must be "
"greater than or equal to record length and a power of two!");
index = 0;
} else if (accessType == im_acc_index) {
stride = recLength;
index = ((IdbStreamRaw*)(_index))->allocCopy();
index->debugName = _index->debugName;
test_error((_flags & ~(im_pvt_var_pos | im_cacheable)) == 0,
"Variable position or cacheable is the only modifier "
"allowed for an indexed stream!");
}
} else {
test_error(_accessType == im_acc_stride &&
_recLength ==
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -