1+ // Defines a leaf-level module with a simple register-to-register path
2+ // including a buffer chain. This creates a straightforward sequential path.
3+ module leaf1 (
4+ input clk,
5+ input in1,
6+ output out1
7+ );
8+
9+ wire n1, n2, n3;
10+ DFF_X1 dff1 (.D(in1), .CK(clk), .Q(n1));
11+ BUF_X1 buf1 (.A(n1), .Z (n2));
12+ BUF_X1 buf2 (.A(n2), .Z (n3));
13+ DFF_X1 dff2 (.D(n3), .CK(clk), .Q(out1));
14+
15+ endmodule
16+
17+ // Defines a leaf-level module with fanout, where one signal drives
18+ // multiple buffers and registers. This introduces path divergence.
19+ module leaf2 (
20+ input clk,
21+ input in1,
22+ output out1,
23+ output out2
24+ );
25+
26+ wire n1, n2, n3;
27+ DFF_X1 dff1 (.D(in1), .CK(clk), .Q(n1));
28+ BUF_X1 buf1 (.A(n1), .Z (n2));
29+ BUF_X1 buf2 (.A(n1), .Z (n3));
30+ DFF_X1 dff2 (.D(n2), .CK(clk), .Q(out1));
31+ DFF_X1 dff3 (.D(n3), .CK(clk), .Q(out2));
32+
33+ endmodule
34+
35+ // Defines a leaf-level module with a longer buffer chain to create
36+ // a path with more significant delay.
37+ module leaf3 (
38+ input clk,
39+ input in1,
40+ output out1
41+ );
42+
43+ wire n1, n2, n3, n4, n5;
44+ DFF_X1 dff1 (.D(in1), .CK(clk), .Q(n1));
45+ BUF_X1 buf1 (.A(n1), .Z (n2));
46+ BUF_X1 buf2 (.A(n2), .Z (n3));
47+ BUF_X1 buf3 (.A(n3), .Z (n4));
48+ BUF_X1 buf4 (.A(n4), .Z (n5));
49+ DFF_X1 dff2 (.D(n5), .CK(clk), .Q(out1));
50+
51+ endmodule
52+
53+ // Defines a simple leaf-level module that registers its input.
54+ // This serves as a basic sequential element.
55+ module leaf4 (
56+ input clk,
57+ input in1,
58+ output out1
59+ );
60+
61+ DFF_X1 dff1 (.D(in1), .CK(clk), .Q(out1));
62+
63+ endmodule
64+
65+ // Defines a mid-level module that instantiates leaf1 and leaf2,
66+ // creating longer and more complex paths between them.
67+ module mid1 (
68+ input clk,
69+ input in1,
70+ input in2,
71+ output out1,
72+ output out2
73+ );
74+
75+ wire l1_out, l2_out1, l2_out2;
76+
77+ leaf1 u_leaf1 (
78+ .clk(clk),
79+ .in1(in1),
80+ .out1(l1_out)
81+ );
82+
83+ leaf2 u_leaf2 (
84+ .clk(clk),
85+ .in1(in2),
86+ .out1(l2_out1),
87+ .out2(l2_out2)
88+ );
89+
90+ DFF_X1 dff_out1 (.D(l1_out), .CK(clk), .Q(out1));
91+ DFF_X1 dff_out2 (.D(l2_out1), .CK(clk), .Q(out2));
92+ DFF_X1 dff_load1 (.D(l2_out1), .CK(clk), .Q());
93+ DFF_X1 dff_load2 (.D(l2_out1), .CK(clk), .Q());
94+ DFF_X1 dff_load3 (.D(l2_out1), .CK(clk), .Q());
95+ DFF_X1 dff_load4 (.D(l2_out1), .CK(clk), .Q());
96+ DFF_X1 dff_load5 (.D(l2_out1), .CK(clk), .Q());
97+ DFF_X1 dff_load6 (.D(l2_out1), .CK(clk), .Q());
98+ DFF_X1 dff_load7 (.D(l2_out1), .CK(clk), .Q());
99+ DFF_X1 dff_load8 (.D(l2_out1), .CK(clk), .Q());
100+ DFF_X1 dff_load9 (.D(l2_out1), .CK(clk), .Q());
101+ DFF_X1 dff_load10 (.D(l2_out1), .CK(clk), .Q());
102+
103+ endmodule
104+
105+ // Defines another mid-level module that instantiates leaf3 and leaf4,
106+ // combining their paths.
107+ module mid2 (
108+ input clk,
109+ input in1,
110+ input in2,
111+ output out1
112+ );
113+
114+ wire l3_out, l4_out;
115+
116+ leaf3 u_leaf3 (
117+ .clk(clk),
118+ .in1(in1),
119+ .out1(l3_out)
120+ );
121+
122+ leaf4 u_leaf4 (
123+ .clk(clk),
124+ .in1(in2),
125+ .out1(l4_out)
126+ );
127+
128+ wire n1;
129+ BUF_X1 buf1 (.A(l3_out), .Z (n1));
130+ DFF_X1 dff_out1 (.D(n1), .CK(clk), .Q(out1));
131+
132+ endmodule
133+
134+ // Defines the top-level module that instantiates the mid-level modules,
135+ // creating the final hierarchical structure with various timing paths.
136+ module top (
137+ input clk,
138+ input in1,
139+ input in2,
140+ input in3,
141+ input in4,
142+ output out1,
143+ output out2
144+ );
145+
146+ wire m1_out1, m1_out2, m2_out1;
147+
148+ mid1 u_mid1 (
149+ .clk(clk),
150+ .in1(in1),
151+ .in2(in2),
152+ .out1(m1_out1),
153+ .out2(m1_out2)
154+ );
155+
156+ mid2 u_mid2 (
157+ .clk(clk),
158+ .in1(in3),
159+ .in2(in4),
160+ .out1(m2_out1)
161+ );
162+
163+ wire n1, n2;
164+ BUF_X1 buf1 (.A(m1_out1), .Z (n1));
165+ BUF_X1 buf2 (.A(m2_out1), .Z (n2));
166+
167+ DFF_X1 dff_out1 (.D(n1), .CK(clk), .Q(out1));
168+ DFF_X1 dff_out2 (.D(n2), .CK(clk), .Q(out2));
169+
170+ endmodule
0 commit comments