aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs
diff options
context:
space:
mode:
authorAhmed Irfan <ahmedirfan1983@gmail.com>2014-01-03 10:52:44 +0100
committerAhmed Irfan <ahmedirfan1983@gmail.com>2014-01-03 10:52:44 +0100
commitffd768ce865e330a631c56d63c6f472e9ad85511 (patch)
treefa04e846e43b66039b31a738fc6375c16c598046 /techlibs
parent09bd82db217d27930d1eeec8d0dfd1e014c675b4 (diff)
downloadyosys-ffd768ce865e330a631c56d63c6f472e9ad85511.tar.gz
yosys-ffd768ce865e330a631c56d63c6f472e9ad85511.tar.bz2
yosys-ffd768ce865e330a631c56d63c6f472e9ad85511.zip
btor
Diffstat (limited to 'techlibs')
-rw-r--r--techlibs/common/pmux2mux.v22
1 files changed, 22 insertions, 0 deletions
diff --git a/techlibs/common/pmux2mux.v b/techlibs/common/pmux2mux.v
new file mode 100644
index 000000000..72e97c080
--- /dev/null
+++ b/techlibs/common/pmux2mux.v
@@ -0,0 +1,22 @@
+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