mcontrol[i].type = 2;
}
+void sv_shape_t::setup_map()
+{
+ int order[3] = {};
+ int lims[3] = {xsz, ysz, zsz};
+ int idxs[3] = {0,0,0};
+
+ switch (permute) {
+ case SV_SHAPE_PERM_XYZ: order[0] = 0; order[1] = 1; order[2] = 2; break;
+ case SV_SHAPE_PERM_XZY: order[0] = 0; order[1] = 2; order[2] = 1; break;
+ case SV_SHAPE_PERM_YXZ: order[0] = 1; order[1] = 0; order[2] = 2; break;
+ case SV_SHAPE_PERM_YZX: order[0] = 1; order[1] = 2; order[2] = 0; break;
+ case SV_SHAPE_PERM_ZXY: order[0] = 2; order[1] = 0; order[2] = 1; break;
+ case SV_SHAPE_PERM_ZYX: order[0] = 2; order[1] = 1; order[2] = 0; break;
+ }
+ for (int i = 0; i < 128; i++)
+ {
+ uint8_t new_idx = idxs[0] + idxs[1] * xsz + idxs[2] * xsz * ysz;
+ map[i] = new_idx;
+ for (int j = 0; j < 3; j++)
+ {
+ idxs[order[j]] = idxs[order[j]] + 1;
+ if (idxs[order[j]] != lims[order[j]]) {
+ break;
+ }
+ idxs[order[i]] = 0;
+ }
+ }
+}
+
int state_t::sv_csr_sz()
{
if (prv == PRV_M)
(get_field(val, (1<<15)) ? 0x2 : 0) |
(get_field(val, (1<<23)) ? 0x4 : 0);
state.shape[shapeidx].permute = get_field(val, SV_SHAPE_PERM);
+ state.shape[shapeidx].setup_map();
break;
}
#endif
int zsz;
int offs;
int permute;
+ uint8_t map[128];
+ void setup_map();
} sv_shape_t;
#define SV_REMAP_REGIDX0 (0x7f)
#define SV_SHAPE_ZDIM (0x7f<<16)
#define SV_SHAPE_PERM (0x7<<24)
+#define SV_SHAPE_PERM_XYZ 0
+#define SV_SHAPE_PERM_XZY 1
+#define SV_SHAPE_PERM_YXZ 2
+#define SV_SHAPE_PERM_YZX 3
+#define SV_SHAPE_PERM_ZXY 4
+#define SV_SHAPE_PERM_ZYX 5
+
#endif
if (shape == NULL) {
return offs;
}
- return offs; // XXX TODO
+ return (unsigned int)shape->map[offs] + shape->offs;
}
void (sv_proc_t::DO_WRITE_FREG)(reg_spec_t const& spec, sv_freg_t const& value)