a7291c6c3d4e1d6cec184193fff7bf6f86b7be4d
3 * https://libre-soc.org/3d_gpu/architecture/regfile/ section on regspecs
5 from nmigen
import Signal
, Const
, Cat
6 from ieee754
.fpcommon
.getop
import FPPipeContext
7 from soc
.fu
.pipe_data
import IntegerData
, CommonPipeSpec
8 from soc
.fu
.cr
.cr_input_record
import CompCROpSubset
9 from soc
.decoder
.power_decoder2
import Data
12 class CRInputData(IntegerData
):
13 regspec
= [('INT', 'ra', '0:63'), # 64 bit range
14 ('INT', 'rb', '0:63'), # 64 bit range
15 ('CR', 'full_cr', '0:31'), # 32 bit range
16 ('CR', 'cr_a', '0:3'), # 4 bit range
17 ('CR', 'cr_b', '0:3'), # 4 bit range
18 ('CR', 'cr_c', '0:3')] # 4 bit range
19 def __init__(self
, pspec
):
20 super().__init
__(pspec
)
21 self
.ra
= Signal(64, reset_less
=True) # RA
22 self
.rb
= Signal(64, reset_less
=True) # RB
23 self
.full_cr
= Signal(32, reset_less
=True) # full CR in
24 self
.cr_a
= Signal(4, reset_less
=True)
25 self
.cr_b
= Signal(4, reset_less
=True)
26 self
.cr_c
= Signal(4, reset_less
=True) # needed for CR_OP partial update
28 self
.a
, self
.b
= self
.ra
, self
.rb
31 yield from super().__iter
__()
41 return lst
+ [self
.ra
.eq(i
.ra
),
43 self
.full_cr
.eq(i
.full_cr
),
49 class CROutputData(IntegerData
):
50 regspec
= [('INT', 'o', '0:63'), # 64 bit range
51 ('CR', 'full_cr', '0:31'), # 32 bit range
52 ('CR', 'cr_a', '0:3')] # 4 bit range
53 def __init__(self
, pspec
):
54 super().__init
__(pspec
)
55 self
.o
= Data(64, name
="o") # RA
56 self
.full_cr
= Data(32, name
="full_cr")
57 self
.cr_a
= Data(4, name
="cr_a")
62 yield from super().__iter
__()
69 return lst
+ [self
.o
.eq(i
.o
),
70 self
.full_cr
.eq(i
.full_cr
),
74 class CRPipeSpec(CommonPipeSpec
):
75 regspec
= (CRInputData
.regspec
, CROutputData
.regspec
)
76 opsubsetkls
= CompCROpSubset
77 def rdflags(self
, e
): # in order of regspec
78 reg1_ok
= e
.read_reg1
.ok
# RA/RC
79 reg2_ok
= e
.read_reg2
.ok
# RB
80 full_reg
= e
.read_cr_whole
# full CR
81 cr1_en
= e
.read_cr1
.ok
# CR A
82 cr2_en
= e
.read_cr2
.ok
# CR B
83 cr3_en
= e
.read_cr3
.ok
# CR C
84 return Cat(reg1_ok
, reg2_ok
, full_reg
, cr1_en
, cr2_en
, cr3_en
)