Added techlibs/common/pmux2mux.v
authorClifford Wolf <clifford@clifford.at>
Fri, 17 Jan 2014 19:06:15 +0000 (20:06 +0100)
committerClifford Wolf <clifford@clifford.at>
Fri, 17 Jan 2014 19:06:15 +0000 (20:06 +0100)
techlibs/common/Makefile.inc
techlibs/common/pmux2mux.v [new file with mode: 0644]

index e2e1ba25ad2c4621f5ffbdd6c2b129642cf610d7..6d94d5c9b8a4b27adf3480b0f8b5446056b26bff 100644 (file)
@@ -5,7 +5,7 @@ techlibs/common/blackbox.v: techlibs/common/blackbox.sed techlibs/common/simlib.
        cat techlibs/common/simlib.v techlibs/common/simcells.v | sed -rf techlibs/common/blackbox.sed > techlibs/common/blackbox.v.new
        mv techlibs/common/blackbox.v.new techlibs/common/blackbox.v
 
-EXTRA_TARGETS += share/simlib.v share/simcells.v share/blackbox.v
+EXTRA_TARGETS += share/simlib.v share/simcells.v share/blackbox.v share/pmux2mux.v
 
 share/simlib.v: techlibs/common/simlib.v
        mkdir -p share
@@ -19,3 +19,7 @@ share/blackbox.v: techlibs/common/blackbox.v
        mkdir -p share
        cp techlibs/common/blackbox.v share/blackbox.v
 
+share/pmux2mux.v: techlibs/common/pmux2mux.v
+       mkdir -p share
+       cp techlibs/common/pmux2mux.v share/pmux2mux.v
+
diff --git a/techlibs/common/pmux2mux.v b/techlibs/common/pmux2mux.v
new file mode 100644 (file)
index 0000000..9c97245
--- /dev/null
@@ -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