1 from ieee754
.fpcommon
.getop
import FPPipeContext
2 from nmutil
.dynamicpipe
import SimpleHandshakeRedir
3 from nmigen
import Signal
4 from soc
.decoder
.power_decoder2
import Data
5 from soc
.fu
.regspec
import get_regspec_bitwidth
9 def __init__(self
, pspec
, output
):
10 self
.ctx
= FPPipeContext(pspec
)
11 self
.muxid
= self
.ctx
.muxid
13 self
.is_output
= output
14 for i
, (regfile
, regname
, widspec
) in enumerate(self
.regspec
):
15 wid
= get_regspec_bitwidth([self
.regspec
], 0, i
)
17 sig
= Data(wid
, name
=regname
)
19 sig
= Signal(wid
, name
=regname
, reset_less
=True)
20 setattr(self
, regname
, sig
)
28 eqs
= [self
.ctx
.eq(i
.ctx
)]
29 for j
in range(len(self
.data
)):
30 eqs
.append(self
.data
[j
].eq(i
.data
[j
]))
34 return self
.ctx
.ports() # TODO: include self.data
37 # hmmm there has to be a better way than this
38 def get_rec_width(rec
):
40 # Setup random inputs for dut.op
48 def __init__(self
, id_wid
):
49 self
.pipekls
= SimpleHandshakeRedir
51 self
.opkls
= lambda _
: self
.opsubsetkls(name
="op")
52 self
.op_wid
= get_rec_width(self
.opkls(None)) # hmm..