2 module clkbuf (input i, (* clkbuf_driver *) output o); endmodule
3 module inbuf (input i, output o); endmodule
4 module clkinbuf (input i, (* clkbuf_driver *) output o); endmodule
5 module dff ((* clkbuf_sink *) input clk, input d, output q); endmodule
6 module dffe ((* clkbuf_sink *) input c, input d, e, output q); endmodule
7 module latch (input e, d, output q); endmodule
8 module clkgen (output o); endmodule
9 module inv ((* clkbuf_inv = "i" *) output o, input i); endmodule
11 module top(input clk1, clk2, clk3, d, e, output [4:0] q);
12 wire clk4, clk5, clk6;
13 dff s0 (.clk(clk1), .d(d), .q(q[0]));
14 dffe s1 (.c(clk2), .d(d), .e(e), .q(q[1]));
15 latch s2 (.e(clk3), .d(d), .q(q[2]));
16 sub s3 (.sclk4(clk4), .sclk5(clk5), .sclk6(clk6), .sd(d), .sq(q[3]));
17 dff s4 (.clk(clk4), .d(d), .q(q[4]));
18 dff s5 (.clk(clk5), .d(d), .q(q[4]));
19 dff s6 (.clk(clk6), .d(d), .q(q[4]));
22 module sub(output sclk4, output sclk5, output sclk6, input sd, output sq);
23 wire sclk7, sclk8, sclk9;
29 clkbuf s10(.i(tmp), .o(sclk7));
30 dff s11(.clk(sclk4), .d(sd), .q(siq));
31 inv s15(.i(sclk7), .o(sclk6));
32 clkgen s12(.o(sclk8));
33 inv s13(.o(sclk9), .i(sclk8));
34 dff s14(.clk(sclk9), .d(siq), .q(sq));
41 # ----------------------
44 clkbufmap -buf clkbuf o:i
45 select -assert-count 3 top/t:clkbuf
46 select -assert-count 3 sub/t:clkbuf
47 select -set clk1 w:clk1 %a %co t:clkbuf %i # Find 'clk1' fanouts that are 'clkbuf'
48 select -assert-count 1 @clk1 # Check there is one such fanout
49 select -assert-count 1 @clk1 %x:+[o] %co c:s* %i # Check that the 'o' of that clkbuf drives one fanout
50 select -assert-count 1 @clk1 %x:+[o] %co c:s0 %i # And that one fanout is 's0'
51 select -set clk2 w:clk2 %a %co t:clkbuf %i
52 select -assert-count 1 @clk2
53 select -assert-count 1 @clk2 %x:+[o] %co c:s* %i
54 select -assert-count 1 @clk2 %x:+[o] %co c:s1 %i
55 select -set clk5 w:clk5 %a %ci t:clkbuf %i
56 select -assert-count 1 @clk5
57 select -assert-count 1 @clk5 %x:+[o] %co c:s5 %i
58 select -assert-count 1 @clk5 %x:+[i] %ci c:s3 %i
59 select -set sclk4 w:sclk4 %a %ci t:clkbuf %i
60 select -assert-count 1 @sclk4
61 select -assert-count 1 @sclk4 %x:+[o] %co c:s11 %i
62 select -assert-count 1 @sclk4 %x:+[i] %ci c:s7 %i
63 select -set sclk8 w:sclk8 %a %ci t:clkbuf %i
64 select -assert-count 1 @sclk8
65 select -assert-count 1 @sclk8 %x:+[o] %co c:s13 %i
66 select -assert-count 1 @sclk8 %x:+[i] %ci c:s12 %i
68 # ----------------------
71 setattr -set clkbuf_inhibit 0 w:clk1
72 setattr -set clkbuf_inhibit 1 w:clk2
73 clkbufmap -buf clkbuf o:i
74 select -assert-count 2 top/t:clkbuf
75 select -set clk1 w:clk1 %a %co t:clkbuf %i # Find 'clk1' fanouts that are 'clkbuf'
76 select -assert-count 1 @clk1 # Check there is one such fanout
77 select -assert-count 1 @clk1 %x:+[o] %co c:s* %i # Check that the 'o' of that clkbuf drives one fanout
78 select -assert-count 1 @clk1 %x:+[o] %co c:s0 %i # And that one fanout is 's0'
79 select -assert-count 0 w:clk2 %a %co t:clkbuf %i
81 # ----------------------
84 setattr -set clkbuf_inhibit 1 w:clk1
85 setattr -set buffer_type "bufg" w:clk2
86 clkbufmap -buf clkbuf o:i w:* a:buffer_type=none a:buffer_type=bufr %u %d
87 select -assert-count 3 top/t:clkbuf
88 select -assert-count 3 sub/t:clkbuf
89 select -set clk1 w:clk1 %a %co t:clkbuf %i # Find 'clk1' fanouts that are 'clkbuf'
90 select -assert-count 1 @clk1 # Check there is one such fanout
91 select -assert-count 1 @clk1 %x:+[o] %co c:s* %i # Check that the 'o' of that clkbuf drives one fanout
92 select -assert-count 1 @clk1 %x:+[o] %co c:s0 %i # And that one fanout is 's0'
93 select -set clk2 w:clk2 %a %co t:clkbuf %i # Find 'clk1' fanouts that are 'clkbuf'
94 select -assert-count 1 @clk2 # Check there is one such fanout
95 select -assert-count 1 @clk2 %x:+[o] %co c:s* %i # Check that the 'o' of that clkbuf drives one fanout
96 select -assert-count 1 @clk2 %x:+[o] %co c:s1 %i # And that one fanout is 's0'
98 # ----------------------
101 setattr -set buffer_type "none" w:clk1
102 setattr -set buffer_type "bufr" w:clk2
103 setattr -set buffer_type "bufr" w:sclk4
104 setattr -set buffer_type "bufr" w:sclk5
105 clkbufmap -buf clkbuf o:i w:* a:buffer_type=none a:buffer_type=bufr %u %d
106 select -assert-count 0 w:clk1 %a %co t:clkbuf %i
107 select -assert-count 0 w:clk2 %a %co t:clkbuf %i
108 select -assert-count 0 top/t:clkbuf
109 select -assert-count 2 sub/t:clkbuf
111 # ----------------------
114 clkbufmap -buf clkbuf o:i -inpad inbuf o:i
115 select -assert-count 3 top/t:clkbuf
116 select -assert-count 3 sub/t:clkbuf
117 select -assert-count 2 top/t:inbuf
118 select -assert-count 0 sub/t:inbuf
119 select -set clk1 w:clk1 %a %co t:inbuf %i
120 select -assert-count 1 @clk1
121 select -assert-count 1 @clk1 %x:+[o] %co t:clkbuf %i
122 select -set clk1b @clk1 %x:+[o] %co t:clkbuf %i
123 select -assert-count 1 @clk1b %x:+[o] %co c:s* %i
124 select -assert-count 1 @clk1b %x:+[o] %co c:s0 %i
125 select -set clk2 w:clk2 %a %co t:inbuf %i
126 select -assert-count 1 @clk2
127 select -assert-count 1 @clk2 %x:+[o] %co t:clkbuf %i
128 select -set clk2b @clk2 %x:+[o] %co t:clkbuf %i
129 select -assert-count 1 @clk2b %x:+[o] %co c:s* %i
130 select -assert-count 1 @clk2b %x:+[o] %co c:s1 %i
131 select -set clk5 w:clk5 %a %ci t:clkbuf %i
132 select -assert-count 1 @clk5
133 select -assert-count 1 @clk5 %x:+[o] %co c:s5 %i
134 select -assert-count 1 @clk5 %x:+[i] %ci c:s3 %i
135 select -set sclk4 w:sclk4 %a %ci t:clkbuf %i
136 select -assert-count 1 @sclk4
137 select -assert-count 1 @sclk4 %x:+[o] %co c:s11 %i
138 select -assert-count 1 @sclk4 %x:+[i] %ci c:s7 %i
139 select -set sclk8 w:sclk8 %a %ci t:clkbuf %i
140 select -assert-count 1 @sclk8
141 select -assert-count 1 @sclk8 %x:+[o] %co c:s13 %i
142 select -assert-count 1 @sclk8 %x:+[i] %ci c:s12 %i
144 # ----------------------
147 clkbufmap -inpad inbuf o:i
148 select -assert-count 2 top/t:inbuf
149 select -assert-count 0 sub/t:inbuf
150 select -set clk1 w:clk1 %a %co t:inbuf %i
151 select -assert-count 1 @clk1
152 select -assert-count 1 @clk1 %x:+[o] %co c:s* %i
153 select -assert-count 1 @clk1 %x:+[o] %co c:s0 %i
154 select -set clk2 w:clk2 %a %co t:inbuf %i
155 select -assert-count 1 @clk2
156 select -assert-count 1 @clk2 %x:+[o] %co c:s* %i
157 select -assert-count 1 @clk2 %x:+[o] %co c:s1 %i
159 # ----------------------
162 clkbufmap -buf clkbuf o:i -inpad clkinbuf o:i
163 select -assert-count 1 top/t:clkbuf
164 select -assert-count 3 sub/t:clkbuf
165 select -assert-count 2 top/t:clkinbuf
166 select -assert-count 0 sub/t:clkinbuf
167 select -set clk1 w:clk1 %a %co t:clkinbuf %i
168 select -assert-count 1 @clk1
169 select -assert-count 1 @clk1 %x:+[o] %co c:s* %i
170 select -assert-count 1 @clk1 %x:+[o] %co c:s0 %i
171 select -set clk2 w:clk2 %a %co t:clkinbuf %i
172 select -assert-count 1 @clk2
173 select -assert-count 1 @clk2 %x:+[o] %co c:s* %i
174 select -assert-count 1 @clk2 %x:+[o] %co c:s1 %i
175 select -set clk5 w:clk5 %a %ci t:clkbuf %i
176 select -assert-count 1 @clk5
177 select -assert-count 1 @clk5 %x:+[o] %co c:s5 %i
178 select -assert-count 1 @clk5 %x:+[i] %ci c:s3 %i
179 select -set sclk4 w:sclk4 %a %ci t:clkbuf %i
180 select -assert-count 1 @sclk4
181 select -assert-count 1 @sclk4 %x:+[o] %co c:s11 %i
182 select -assert-count 1 @sclk4 %x:+[i] %ci c:s7 %i
183 select -set sclk8 w:sclk8 %a %ci t:clkbuf %i
184 select -assert-count 1 @sclk8
185 select -assert-count 1 @sclk8 %x:+[o] %co c:s13 %i
186 select -assert-count 1 @sclk8 %x:+[i] %ci c:s12 %i