3ceab14a1d69704b638f8a54ab323958b937727a
[soc.git] / src / soc / fu / pipe_data.py
1 from ieee754.fpcommon.getop import FPPipeContext
2 from nmutil.dynamicpipe import SimpleHandshakeRedir
3
4
5 class IntegerData:
6
7 def __init__(self, pspec):
8 self.ctx = FPPipeContext(pspec)
9 self.muxid = self.ctx.muxid
10
11 def __iter__(self):
12 yield from self.ctx
13
14 def eq(self, i):
15 return [self.ctx.eq(i.ctx)]
16
17 def ports(self):
18 return self.ctx.ports()
19
20 # hmmm there has to be a better way than this
21 def get_rec_width(rec):
22 recwidth = 0
23 # Setup random inputs for dut.op
24 for p in rec.ports():
25 width = p.width
26 recwidth += width
27 return recwidth
28
29
30 class CommonPipeSpec:
31 def __init__(self, id_wid):
32 self.pipekls = SimpleHandshakeRedir
33 self.id_wid = id_wid
34 self.opkls = lambda _: self.opsubsetkls(name="op")
35 self.op_wid = get_rec_width(self.opkls(None)) # hmm..
36 self.stage = None