2 from nmigen
.cli
import main
5 class ParMux(Elaboratable
):
6 def __init__(self
, width
):
10 self
.c
= Signal(width
)
11 self
.o
= Signal(width
)
13 def elaborate(self
, platform
):
15 with m
.Switch(self
.s
):
17 m
.d
.comb
+= self
.o
.eq(self
.a
)
19 m
.d
.comb
+= self
.o
.eq(self
.b
)
21 m
.d
.comb
+= self
.o
.eq(self
.c
)
23 m
.d
.comb
+= self
.o
.eq(0)
27 if __name__
== "__main__":
28 pmux
= ParMux(width
=16)
29 main(pmux
, ports
=[pmux
.s
, pmux
.a
, pmux
.b
, pmux
.c
, pmux
.o
])