19 uint64_t address_, uint32_t nBytes_, uint64_t bar_, uint32_t width_, int32_t nFractionalBits_,
bool signedFlag_,
20 Access dataAccess_,
Type dataType_, std::vector<size_t> interruptId_)
21 : pathName(pathName_), nElements(nElements_), elementPitchBits(nElements_ > 0 ? nBytes_ / nElements_ * 8 : 0),
22 bar(bar_), address(address_), registerAccess(dataAccess_), interruptId(std::move(interruptId_)),
23 channels({{0, dataType_, width_, nFractionalBits_, signedFlag_}}) {
24 assert(channels.size() == 1);
27 pathName.setAltSeparator(
".");
30 if(nBytes_ > 0 && nElements_ > 0) {
31 if(nBytes_ % nElements_ != 0) {
33 throw logic_error(
"Number of bytes is not a multiple of number of elements for register " + pathName +
34 ". Check your map file!");
38 computeDataDescriptor();
44 uint64_t address_, uint32_t nElements_, uint32_t elementPitchBits_, std::vector<ChannelInfo> channelInfo_,
45 Access dataAccess_, std::vector<size_t> interruptId_)
46 : pathName(pathName_), nElements(nElements_), elementPitchBits(elementPitchBits_), bar(bar_), address(address_),
47 registerAccess(dataAccess_), interruptId(std::move(interruptId_)), channels(std::move(channelInfo_)) {
53 computeDataDescriptor();
58 void NumericAddressedRegisterInfo::computeDataDescriptor() {
62 int32_t nFractionalBits = 0;
63 bool signedFlag =
false;
65 if(
int(c.dataType) >
int(dataType)) dataType = c.dataType;
66 if(c.width + c.nFractionalBits + c.signedFlag > width + nFractionalBits + signedFlag) {
68 nFractionalBits = c.nFractionalBits;
69 signedFlag = c.signedFlag;
113 else if(width == 64) {
123 throw logic_error(
"Wrong data width for data type IEEE754 for register " +
pathName +
". Check your map file!");
129 if(nFractionalBits > 0) {
130 auto nDigits =
static_cast<size_t>(
131 std::ceil(std::log10(std::pow(2, width))) + (signedFlag ? 1 : 0) + (nFractionalBits != 0 ? 1 : 0));
132 size_t nFractionalDigits = std::ceil(std::log10(std::pow(2, nFractionalBits)));
137 nDigits, nFractionalDigits, rawDataInfo);
141 static_cast<size_t>(std::ceil(std::log10(std::pow(2, width + nFractionalBits))) + (signedFlag ? 1 : 0));
146 nDigits, 0, rawDataInfo);
149 else if(width == 1) {
211 auto path = registerPathName;
216 auto components = path.getComponents();
217 if(components.size() != 3) {
220 auto bar = std::stoi(components[1]);
221 size_t pos = components[2].find_first_of(
'*');
222 auto address = std::stoi(components[2].substr(0, pos));
224 if(pos != std::string::npos) {
225 nBytes = std::stoi(components[2].substr(pos + 1));
228 nBytes =
sizeof(int32_t);
230 auto nElements = nBytes /
sizeof(int32_t);
231 if(nBytes == 0 || nBytes %
sizeof(int32_t) != 0) {
236 if(path.startsWith(
"!")) {
237 auto canonicalInterrupt = _canonicalInterrupts.find(path);
238 if(canonicalInterrupt == _canonicalInterrupts.end()) {
243 canonicalInterrupt->second);
255 if(_canonicalInterrupts.find(registerPathName) != _canonicalInterrupts.end()) {
264 return _listOfInterrupts;
271 _listOfInterrupts.insert(registerInfo.
interruptId);
273 std::vector<size_t> canonicalID = {registerInfo.
interruptId.front()};
274 _canonicalInterrupts[canonicalName] = canonicalID;
277 canonicalID.push_back(*subId);
278 _canonicalInterrupts[canonicalName] = canonicalID;
287 std::unique_ptr<BackendRegisterCatalogueBase> c = std::make_unique<NumericAddressedRegisterCatalogue>();
289 fillFromThis(casted_c);
290 casted_c->_listOfInterrupts = _listOfInterrupts;
291 casted_c->_canonicalInterrupts = _canonicalInterrupts;