Lines Matching refs:addr
343 static int get_array_idx_offset(struct rnndelem *elem, uint64_t addr, uint64_t *idx, uint64_t *offset)
349 if ((o <= addr) && (addr < (o + elem->stride))) {
351 *offset = addr - o;
357 if (addr < elem->offset)
360 *idx = (addr - elem->offset) / elem->stride;
361 *offset = (addr - elem->offset) % elem->stride;
370 static struct rnndecaddrinfo *trymatch (struct rnndeccontext *ctx, struct rnndelem **elems, int elemsnum, uint64_t addr, int write, int dwidth, uint64_t *indices, int indicesnum) {
380 if (addr < elems[i]->offset)
383 idx = (addr-elems[i]->offset)/elems[i]->stride;
384 offset = (addr-elems[i]->offset)%elems[i]->stride;
387 offset = addr-elems[i]->offset;
416 if (addr < elems[i]->offset + elems[i]->stride * idx)
418 offset = addr - (elems[i]->offset + elems[i]->stride * idx);
446 if (get_array_idx_offset(elems[i], addr, &idx, &offset))
472 int rnndec_checkaddr(struct rnndeccontext *ctx, struct rnndomain *domain, uint64_t addr, int write) {
473 struct rnndecaddrinfo *res = trymatch(ctx, domain->subelems, domain->subelemsnum, addr, write, domain->width, 0, 0);
481 struct rnndecaddrinfo *rnndec_decodeaddr(struct rnndeccontext *ctx, struct rnndomain *domain, uint64_t addr, int write) {
482 struct rnndecaddrinfo *res = trymatch(ctx, domain->subelems, domain->subelemsnum, addr, write, domain->width, 0, 0);
486 asprintf (&res->name, "%s%#"PRIx64"%s", ctx->colors->err, addr, ctx->colors->reset);