1 from nmigen
import Array
, Module
, Signal
2 from nmigen
.cli
import main
4 class VectorAssembler():
7 The purpose of this module is to take a generic number of inputs
8 and cleanly combine them into one vector. While this is very much
9 possible through raw code it may result in a very unfortunate sight
10 in a yosys graph. Thus this class was born! No more will ugly loops
11 exist in my graphs! Get outta here ya goddam Lochness Monster.
13 def __init__(self
, width
):
15 * width: (bit count) The desiered size of the output vector
22 self
.i
= Array(Signal(1) for index
in range(width
))
25 self
.o
= Signal(width
)
27 def elaborate(self
, platform
=None):
29 for index
in range(self
.width
):
30 m
.d
.comb
+= self
.o
[index
].eq(self
.i
[index
])