aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/common/pmux2mux.v
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-01-17 20:06:15 +0100
committerClifford Wolf <clifford@clifford.at>2014-01-17 20:06:15 +0100
commitdb9cf544b8cf4c303610acc59c21a3dec346af62 (patch)
tree1d2285a4d488c6b8628851bdfd5056fca584c268 /techlibs/common/pmux2mux.v
parent6170cfe9cddfd0040fa9f7b535d25dd2c99cdb91 (diff)
downloadyosys-db9cf544b8cf4c303610acc59c21a3dec346af62.tar.gz
yosys-db9cf544b8cf4c303610acc59c21a3dec346af62.tar.bz2
yosys-db9cf544b8cf4c303610acc59c21a3dec346af62.zip
Added techlibs/common/pmux2mux.v
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