aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/common/pmux2mux.v
diff options
context:
space:
mode:
authorAhmed Irfan <irfan@ubuntu.(none)>2014-01-18 18:10:31 +0100
committerAhmed Irfan <irfan@ubuntu.(none)>2014-01-18 18:10:31 +0100
commit1dd797ab09d2fb6a4ab903cfa050fa51cfcc6dcd (patch)
tree3c254e7a3ca11831e463d9a4ce88b5aea0677952 /techlibs/common/pmux2mux.v
parent66198d8591a66b8ec34237c1151d992c7f4d5224 (diff)
parentbef17eeb109dd2dc4eaba6eb808a0172c0c53265 (diff)
downloadyosys-1dd797ab09d2fb6a4ab903cfa050fa51cfcc6dcd.tar.gz
yosys-1dd797ab09d2fb6a4ab903cfa050fa51cfcc6dcd.tar.bz2
yosys-1dd797ab09d2fb6a4ab903cfa050fa51cfcc6dcd.zip
Merge branch 'master' of https://github.com/cliffordwolf/yosys
Diffstat (limited to 'techlibs/common/pmux2mux.v')
-rw-r--r--techlibs/common/pmux2mux.v21
1 files changed, 21 insertions, 0 deletions
diff --git a/techlibs/common/pmux2mux.v b/techlibs/common/pmux2mux.v
new file mode 100644
index 000000000..9c97245a1
--- /dev/null
+++ b/techlibs/common/pmux2mux.v
@@ -0,0 +1,21 @@
+module \$pmux (A, B, S, Y);
+
+wire [1023:0] _TECHMAP_DO_ = "proc; clean";
+
+parameter WIDTH = 1;
+parameter S_WIDTH = 1;
+
+input [WIDTH-1:0] A;
+input [WIDTH*S_WIDTH-1:0] B;
+input [S_WIDTH-1:0] S;
+output reg [WIDTH-1:0] Y;
+
+integer i;
+
+always @* begin
+ Y <= A;
+ for (i = 0; i < S_WIDTH; i=i+1)
+ if (S[i]) Y <= B[WIDTH*i +: WIDTH];
+end
+
+endmodule