yosys/tests/various/submod.ys

125 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2019-11-22 18:41:05 -06:00
read_verilog <<EOT
2019-11-27 01:38:49 -06:00
module top(input a, output b);
2019-11-22 18:41:05 -06:00
wire c;
(* submod="bar" *) sub s1(a, c);
2019-11-27 01:38:49 -06:00
assign b = c;
2019-11-22 18:41:05 -06:00
endmodule
module sub(input a, output c);
assign c = a;
endmodule
EOT
hierarchy -top top
proc
design -save gold
2019-11-22 18:50:09 -06:00
2019-11-22 18:41:05 -06:00
submod
2019-11-27 15:22:26 -06:00
check -assert
2019-11-22 18:41:05 -06:00
design -stash gate
design -import gold -as gold
design -import gate -as gate
miter -equiv -flatten -make_assert -make_outputs gold gate miter
sat -verify -prove-asserts -show-ports miter
2019-11-22 19:23:34 -06:00
design -reset
read_verilog <<EOT
module top(input a, output [1:0] b);
(* submod="bar" *) sub s1(a, b[1]);
assign b[0] = 1'b0;
endmodule
module sub(input a, output c);
assign c = a;
endmodule
EOT
hierarchy -top top
proc
design -save gold
submod
2019-11-27 15:22:26 -06:00
check -assert top
2019-11-22 19:23:34 -06:00
design -stash gate
design -import gold -as gold
design -import gate -as gate
miter -equiv -flatten -make_assert -make_outputs gold gate miter
sat -verify -prove-asserts -show-ports miter
2019-11-25 18:07:35 -06:00
2019-11-27 15:22:26 -06:00
design -reset
read_verilog <<EOT
module top(input a, output [1:0] b, c);
(* submod="bar" *) sub s1(a, b[0]);
(* submod="bar" *) sub s2(a, c[1]);
assign c = b;
endmodule
module sub(input a, output c);
assign c = a;
endmodule
EOT
hierarchy -top top
proc
design -save gold
submod
check -assert top
design -stash gate
design -import gold -as gold
design -import gate -as gate
miter -equiv -flatten -make_assert -make_outputs gold gate miter
sat -verify -prove-asserts -show-ports miter
2019-11-25 18:07:35 -06:00
design -reset
read_verilog <<EOT
module top(input d, c, (* init = 3'b011 *) output reg [2:0] q);
(* submod="bar" *) DFF s1(.D(d), .C(c), .Q(q[1]));
DFF s2(.D(d), .C(c), .Q(q[0]));
DFF s3(.D(d), .C(c), .Q(q[2]));
2019-11-25 18:07:35 -06:00
endmodule
module DFF(input D, C, output Q);
parameter INIT = 1'b0;
endmodule
EOT
hierarchy -top top
proc
2019-11-25 18:07:35 -06:00
submod
dffinit -ff DFF Q INIT
check -noinit -assert
design -reset
read_verilog <<EOT
module top(input d, c, output reg [2:0] q);
(* submod="bar" *) DFF s1(.D(d), .C(c), .Q(q[1]));
DFF s2(.D(d), .C(c), .Q(q[0]));
DFF s3(.D(d), .C(c), .Q(q[2]));
endmodule
EOT
hierarchy -top top
proc
submod
flatten
read_verilog <<EOT
module DFF(input D, C, output Q);
endmodule
EOT
check -assert