2
2
3
3
4
4
def prioritized_mux (selects , vals ):
5
- """
6
- Returns the value in the first wire for which its select bit is 1
5
+ """ Returns the value in the first wire for which its select bit is 1
7
6
8
7
:param [WireVector] selects: a list of WireVectors signaling whether
9
8
a wire should be chosen
@@ -36,8 +35,7 @@ def _is_equivalent(w1, w2):
36
35
37
36
38
37
def sparse_mux (sel , vals ):
39
- """
40
- Mux that avoids instantiating unnecessary mux_2s when possible.
38
+ """ Mux that avoids instantiating unnecessary mux_2s when possible.
41
39
42
40
:param WireVector sel: Select wire, determines what is selected on a given cycle
43
41
:param dictionary vals: dictionary of values at mux inputs (of type `{int:WireVector}`)
@@ -68,8 +66,7 @@ def sparse_mux(sel, vals):
68
66
69
67
70
68
def _sparse_mux (sel , vals ):
71
- """
72
- Mux that avoids instantiating unnecessary mux_2s when possible.
69
+ """ Mux that avoids instantiating unnecessary mux_2s when possible.
73
70
74
71
:param WireVector sel: Select wire, determines what is selected on a given cycle
75
72
:param {int: WireVector} vals: dictionary to store the values that are
@@ -109,8 +106,7 @@ def _sparse_mux(sel, vals):
109
106
110
107
111
108
class MultiSelector (object ):
112
- """
113
- The MultiSelector allows you to specify multiple wire value results
109
+ """ The MultiSelector allows you to specify multiple wire value results
114
110
for a single select wire.
115
111
116
112
Useful for processors, finite state machines and other places where the
@@ -119,9 +115,9 @@ class MultiSelector(object):
119
115
120
116
Example::
121
117
122
- with muxes.MultiSelector(select, res0, res1, res2, ...) as ms:
123
- ms.option(val1, data0, data1, data2, ...)
124
- ms.option(val2, data0_2, data1_2, data2_2, ...)
118
+ with muxes.MultiSelector(select, res0, res1, res2, ...) as ms:
119
+ ms.option(val1, data0, data1, data2, ...)
120
+ ms.option(val2, data0_2, data1_2, data2_2, ...)
125
121
126
122
This means that when the select wire equals the val1 wire
127
123
the results will have the values in the coresponding data wires
@@ -135,8 +131,7 @@ def __init__(self, signal_wire, *dest_wires):
135
131
self .dest_instrs_info = {dest_w : [] for dest_w in dest_wires }
136
132
137
133
def __enter__ (self ):
138
- """
139
- For compatibility with `with` statements, which is the recommended
134
+ """ For compatibility with `with` statements, which is the recommended
140
135
method of using a MultiSelector
141
136
"""
142
137
return self
@@ -176,8 +171,7 @@ def _add_signal(self, data_signals):
176
171
self .dest_instrs_info [dw ].append (data_signal )
177
172
178
173
def finalize (self ):
179
- """
180
- Connects the wires.
174
+ """ Connects the wires.
181
175
"""
182
176
self ._check_finalized ()
183
177
self ._final = True
@@ -188,8 +182,7 @@ def finalize(self):
188
182
189
183
190
184
def demux (select ):
191
- """
192
- Demultiplexes a wire of arbitrary bitwidth
185
+ """ Demultiplexes a wire of arbitrary bitwidth
193
186
194
187
:param WireVector select: indicates which wire to set on
195
188
:return (WireVector, ...): a tuple of wires corresponding to each demultiplexed wire
0 commit comments