power_insn: bind records to operands
[openpower-isa.git] / src / openpower / sv / svstate.py
1 # SPDX-License-Identifier: LGPLv3+
2 # Copyright (C) 2021 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
3 # Funded by NLnet http://nlnet.nl
4 """SVSATE SPR Record. actually a peer of PC (CIA/NIA) and MSR
5
6 https://libre-soc.org/openpower/sv/sprs/
7
8 | Field | Name | Description |
9 | ----- | -------- | --------------------- |
10 | 0:6 | maxvl | Max Vector Length |
11 | 7:13 | vl | Vector Length |
12 | 14:20 | srcstep | for srcstep = 0..VL-1 |
13 | 21:27 | dststep | for dststep = 0..VL-1 |
14 | 28:29 | dsubstep | for dsubstep = 0..SUBVL-1 |
15 | 30:31 | ssubstep | for ssubstep = 0..SUBVL-1 |
16 | 32:33 | mi0 | REMAP RA SVSHAPE0-3 |
17 | 34:35 | mi1 | REMAP RB SVSHAPE0-3 |
18 | 36:37 | mi2 | REMAP RC SVSHAPE0-3 |
19 | 38:39 | mo0 | REMAP RT SVSHAPE0-3 |
20 | 40:41 | mo1 | REMAP EA SVSHAPE0-3 |
21 | 42:46 | SVme | REMAP enable (RA-RT) |
22 | 47:52 | rsvd | reserved |
23 | 53 | pack | PACK (srcstrp reorder) |
24 | 54 | unpack | UNPACK (dststep order) |
25 | 55:61 | hphint | Horizontal Hint |
26 | 62 | RMpst | REMAP persistence |
27 | 63 | vfirst | Vertical First mode |
28 """
29
30 from nmigen import Signal, Record
31
32
33 # In nMigen, Record order is from LSB to MSB
34 # but Power ISA specs are all MSB to LSB (MSB0).
35 class SVSTATERec(Record):
36 layout = [("vfirst", 1),
37 ("RMpst", 1),
38 ("hphint", 7),
39 ("unpack", 1),
40 ("pack", 1),
41 ("rsvd", 6),
42 ("SVme", 5),
43 ("mo1", 2),
44 ("mo0", 2),
45 ("mi2", 2),
46 ("mi1", 2),
47 ("mi0", 2),
48 ("ssubstep", 2),
49 ("dsubstep", 2),
50 ("dststep", 7),
51 ("srcstep", 7),
52 ("vl", 7),
53 ("maxvl", 7),
54 ]
55
56 def __init__(self, name=None):
57 super().__init__(name=name, layout=SVSTATERec.layout)