mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-24 21:27:00 +00:00
RIP $safe_pmux
This commit is contained in:
parent
28cf48e31f
commit
13f2f36884
16 changed files with 21 additions and 98 deletions
|
@ -938,39 +938,16 @@ input [S_WIDTH-1:0] S;
|
|||
output reg [WIDTH-1:0] Y;
|
||||
|
||||
integer i;
|
||||
reg found_active_sel_bit;
|
||||
|
||||
always @* begin
|
||||
Y = A;
|
||||
for (i = 0; i < S_WIDTH; i = i+1)
|
||||
if (S[i])
|
||||
Y = B >> (WIDTH*i);
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
module \$safe_pmux (A, B, S, Y);
|
||||
|
||||
parameter WIDTH = 0;
|
||||
parameter S_WIDTH = 0;
|
||||
|
||||
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, j;
|
||||
|
||||
always @* begin
|
||||
j = 0;
|
||||
found_active_sel_bit = 0;
|
||||
for (i = 0; i < S_WIDTH; i = i+1)
|
||||
if (S[i]) begin
|
||||
Y = B >> (WIDTH*i);
|
||||
j = j + 1;
|
||||
Y = found_active_sel_bit ? 'bx : B >> (WIDTH*i);
|
||||
found_active_sel_bit = 1;
|
||||
end
|
||||
if (j != 1)
|
||||
Y = A;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue