1 # POWER9 Register Files
4 Defines the following register files:
6 * INT regfile - 32x 64-bit
7 * SPR regfile - 110x 64-bit
9 * XER regfile - XER.so, XER.ca/ca32, XER.ov/ov32
10 * FAST regfile - PC, MSR, CTR, LR, TAR, SRR1, SRR2
14 * https://bugs.libre-soc.org/show_bug.cgi?id=345
15 * https://bugs.libre-soc.org/show_bug.cgi?id=351
16 * https://libre-soc.org/3d_gpu/architecture/regfile/
17 * https://libre-soc.org/openpower/isatables/sprs.csv
22 from soc
.regfile
import RegFile
, RegFileArray
23 from soc
.regfile
.virtual_port
import VirtualRegPort
24 from soc
.decoder
.power_enums
import SPR
28 class IntRegs(RegFileArray
):
31 * QTY 32of 64-bit registers
33 * Array-based unary-indexed (not binary-indexed)
34 * write-through capability (read on same cycle as write)
37 super().__init
__(64, 32)
38 self
.w_ports
= [self
.write_port("dest")]
39 self
.r_ports
= [self
.write_port("src1"),
40 self
.write_port("src2"),
41 self
.write_port("src3")]
45 class CRRegs(VirtualRegPort
):
46 """Condition Code Registers (CR0-7)
48 * QTY 8of 8-bit registers
49 * 3R1W 4-bit-wide with additional 1R1W for the "full" 32-bit width
50 * Array-based unary-indexed (not binary-indexed)
51 * write-through capability (read on same cycle as write)
54 super().__init
__(32, 8)
55 self
.w_ports
= [self
.full_wr
, # 32-bit wide (masked, 8-en lines)
56 self
.write_port("dest")] # 4-bit wide, unary-indexed
57 self
.r_ports
= [self
.full_rd
, # 32-bit wide (masked, 8-en lines)
58 self
.write_port("src1"),
59 self
.write_port("src2"),
60 self
.write_port("src3")]
64 class XERRegs(VirtualRegPort
):
65 """XER Registers (SO, CA/CA32, OV/OV32)
67 * QTY 3of 2-bit registers
68 * 3R3W 2-bit-wide with additional 1R1W for the "full" 6-bit width
69 * Array-based unary-indexed (not binary-indexed)
70 * write-through capability (read on same cycle as write)
73 super().__init
__(6, 2)
74 self
.w_ports
= [self
.full_wr
, # 6-bit wide (masked, 3-en lines)
75 self
.write_port("dest1"),
76 self
.write_port("dest2",
77 self
.write_port("dest3")]
78 self
.r_ports
= [self
.full_rd
, # 6-bit wide (masked, 3-en lines)
79 self
.write_port("src1"),
80 self
.write_port("src2"),
81 self
.write_port("src3")]
85 class SPRRegs(RegFile
):
88 * QTY len(SPRs) 64-bit registers
90 * binary-indexed but REQUIRES MAPPING
91 * write-through capability (read on same cycle as write)
95 super().__init
__(64, n_sprs
)
96 self
.w_ports
= [self
.write_port("dest")]
97 self
.r_ports
= [self
.write_port("src")]