3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 17:15:33 +00:00

Sync with upstream

This commit is contained in:
Akash Levy 2025-01-13 17:20:59 -08:00
commit 5c514e00a4
15 changed files with 183 additions and 79 deletions

View file

@ -0,0 +1,50 @@
# We don't set the B port on $macc cells anymore,
# test compatibility with older RTLIL files which can
# have the B port populated
read_verilog <<EOF
module gold(input signed [2:0] a1, input signed [2:0] b1,
input [1:0] a2, input [3:0] b2, input c, input d, output signed [3:0] y);
wire signed [3:0] ab1;
assign ab1 = a1 * b1;
assign y = ab1 + a2*b2 + c + d + 1;
endmodule
EOF
prep
# test the model for $macc including the retired B parameter
# matches the gold module
read_rtlil <<EOF
attribute \src "<<EOF:1.1-4.10"
module \gate
wire width 3 input 1 signed \a1
wire width 2 input 3 \a2
wire width 3 input 2 signed \b1
wire width 4 input 4 \b2
wire input 5 \c
wire input 6 \d
wire width 4 output 7 signed \y
cell $macc $1
parameter \A_WIDTH 12
parameter \B_WIDTH 3
parameter \CONFIG 20'01010000011011010011
parameter \CONFIG_WIDTH 20
parameter \Y_WIDTH 4
connect \A { \a2 \b2 \b1 \a1 }
connect \B { \d \c 1'1 }
connect \Y \y
end
end
EOF
design -save gold_gate
equiv_make gold gate equiv
equiv_induct equiv
equiv_status -assert equiv
design -load gold_gate
maccmap gate
equiv_make gold gate equiv
equiv_induct equiv
equiv_status -assert equiv

View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -e
for x in *.ys; do
echo "Running $x.."
../../yosys -ql ${x%.ys}.log $x
done

View file

@ -0,0 +1,38 @@
read_verilog <<EOT
module top(input in, output out);
wire [1:0] w1, w2;
f1_test u1 (.in(in), .out(w1[0]));
f2_test u2 (.in(w1), .out(w2));
f3_test u3 (.in(w2[0]), .out(out));
endmodule
module f1_test(input in, output out);
assign out = in;
endmodule
module f2_test(input [1:0] in, output [1:0] out);
assign out[0] = in[0];
assign out[1] = in[1];
endmodule
module f3_test(input in, output [1:0] out);
assign out[0] = in;
assign out[1] = in;
endmodule
EOT
hierarchy -top top
flatten -scopename
prep
write_json json_scopeinfo.out
!grep -qF '$scopeinfo' json_scopeinfo.out
write_json -noscopeinfo json_scopeinfo.out
!grep -qvF '$scopeinfo' json_scopeinfo.out
json -o json_scopeinfo.out
!grep -qF '$scopeinfo' json_scopeinfo.out
json -noscopeinfo -o json_scopeinfo.out
!grep -qvF '$scopeinfo' json_scopeinfo.out