source: vis_dev/vis-2.1/examples/eight_queens/eight_queens.v @ 11

Last change on this file since 11 was 11, checked in by cecile, 13 years ago

Add vis

File size: 7.9 KB
Line 
1/************************************************************************/
2
3module  game(clk, consistent);
4  input clk;
5  output consistent;
6  wire consistent;
7
8wire  a11, a12, a13, a14, a15, a16, a17, a18,
9      a21, a22, a23, a24, a25, a26, a27, a28,
10      a31, a32, a33, a34, a35, a36, a37, a38,
11      a41, a42, a43, a44, a45, a46, a47, a48,
12      a51, a52, a53, a54, a55, a56, a57, a58,
13      a61, a62, a63, a64, a65, a66, a67, a68,
14      a71, a72, a73, a74, a75, a76, a77, a78,
15      a81, a82, a83, a84, a85, a86, a87, a88;
16
17wire h1, h2, h3, h4, h5, h6, h7, h8;
18wire v1, v2, v3, v4, v5, v6, v7, v8;
19wire l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15;
20wire r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15;
21
22wire tmp1, tmp2, tmp3, tmp4, tmp5, tmp6;
23
24assign a11 = $ND(0, 1);
25assign a12 = $ND(0, 1);
26assign a13 = $ND(0, 1);
27assign a14 = $ND(0, 1);
28assign a15 = $ND(0, 1);
29assign a16 = $ND(0, 1);
30assign a17 = $ND(0, 1);
31assign a18 = $ND(0, 1);
32
33assign a21 = $ND(0, 1);
34assign a22 = $ND(0, 1);
35assign a23 = $ND(0, 1);
36assign a24 = $ND(0, 1);
37assign a25 = $ND(0, 1);
38assign a26 = $ND(0, 1);
39assign a27 = $ND(0, 1);
40assign a28 = $ND(0, 1);
41
42assign a31 = $ND(0, 1);
43assign a32 = $ND(0, 1);
44assign a33 = $ND(0, 1);
45assign a34 = $ND(0, 1);
46assign a35 = $ND(0, 1);
47assign a36 = $ND(0, 1);
48assign a37 = $ND(0, 1);
49assign a38 = $ND(0, 1);
50
51assign a41 = $ND(0, 1);
52assign a42 = $ND(0, 1);
53assign a43 = $ND(0, 1);
54assign a44 = $ND(0, 1);
55assign a45 = $ND(0, 1);
56assign a46 = $ND(0, 1);
57assign a47 = $ND(0, 1);
58assign a48 = $ND(0, 1);
59
60assign a51 = $ND(0, 1);
61assign a52 = $ND(0, 1);
62assign a53 = $ND(0, 1);
63assign a54 = $ND(0, 1);
64assign a55 = $ND(0, 1);
65assign a56 = $ND(0, 1);
66assign a57 = $ND(0, 1);
67assign a58 = $ND(0, 1);
68
69assign a61 = $ND(0, 1);
70assign a62 = $ND(0, 1);
71assign a63 = $ND(0, 1);
72assign a64 = $ND(0, 1);
73assign a65 = $ND(0, 1);
74assign a66 = $ND(0, 1);
75assign a67 = $ND(0, 1);
76assign a68 = $ND(0, 1);
77
78assign a71 = $ND(0, 1);
79assign a72 = $ND(0, 1);
80assign a73 = $ND(0, 1);
81assign a74 = $ND(0, 1);
82assign a75 = $ND(0, 1);
83assign a76 = $ND(0, 1);
84assign a77 = $ND(0, 1);
85assign a78 = $ND(0, 1);
86
87assign a81 = $ND(0, 1);
88assign a82 = $ND(0, 1);
89assign a83 = $ND(0, 1);
90assign a84 = $ND(0, 1);
91assign a85 = $ND(0, 1);
92assign a86 = $ND(0, 1);
93assign a87 = $ND(0, 1);
94assign a88 = $ND(0, 1);
95
96
97single8 H1( clk, a11, a12, a13, a14, a15, a16, a17, a18, h1 );
98single8 H2( clk, a21, a22, a23, a24, a25, a26, a27, a28, h2 );
99single8 H3( clk, a31, a32, a33, a34, a35, a36, a37, a38, h3 );
100single8 H4( clk, a41, a42, a43, a44, a45, a46, a47, a48, h4 );
101single8 H5( clk, a51, a52, a53, a54, a55, a56, a57, a58, h5 );
102none8 H6( clk, a61, a62, a63, a64, a65, a66, a67, a68, h6 );
103none8 H7( clk, a71, a72, a73, a74, a75, a76, a77, a78, h7 );
104none8 H8( clk, a81, a82, a83, a84, a85, a86, a87, a88, h8 );
105
106single8 V1( clk, a11, a21, a31, a41, a51, a61, a71, a81, v1 );
107single8 V2( clk, a12, a22, a32, a42, a52, a62, a72, a82, v2 );
108single8 V3( clk, a13, a23, a33, a43, a53, a63, a73, a83, v3 );
109single8 V4( clk, a14, a24, a34, a44, a54, a64, a74, a84, v4 );
110single8 V5( clk, a15, a25, a35, a45, a55, a65, a75, a85, v5 );
111none8 V6( clk, a16, a26, a36, a46, a56, a66, a76, a86, v6 );
112none8 V7( clk, a17, a27, a37, a47, a57, a67, a77, a87, v7 );
113none8 V8( clk, a18, a28, a38, a48, a58, a68, a78, a88, v8 );
114
115maxone8 L1( clk, a11, 0,   0,   0,   0,   0,   0,   0,   l1 );
116maxone8 L2( clk, a21, a12, 0,   0,   0,   0,   0,   0,   l2 );
117maxone8 L3( clk, a31, a22, a13, 0,   0,   0,   0,   0,   l3 );
118maxone8 L4( clk, a41, a32, a23, a41, 0,   0,   0,   0,   l4 );
119maxone8 L5( clk, a51, a42, a33, a24, a15, 0,   0,   0,   l5 );
120maxone8 L6( clk, a61, a52, a43, a34, a25, a16, 0,   0,   l6 );
121maxone8 L7( clk, a71, a62, a53, a44, a35, a26, a17, 0,   l7 );
122maxone8 L8( clk, a81, a72, a63, a54, a45, a36, a27, a18, l8 );
123
124maxone8 L9 ( clk, a82, a73, a64, a55, a46, a37, a28, 0  , l9  );
125maxone8 L10( clk, a83, a74, a65, a56, a47, a38, 0  , 0  , l10 );
126maxone8 L11( clk, a84, a75, a66, a57, a48, 0  , 0  , 0  , l11 );
127maxone8 L12( clk, a85, a76, a67, a58, 0  , 0  , 0  , 0  , l12 );
128maxone8 L13( clk, a86, a77, a68, 0  , 0  , 0  , 0  , 0  , l13 );
129maxone8 L14( clk, a87, a78, 0  , 0  , 0  , 0  , 0  , 0  , l14 );
130maxone8 L15( clk, a88, 0  , 0  , 0  , 0  , 0  , 0  , 0  , l15 );
131
132maxone8 R1( clk, a18, 0,   0,   0,   0,   0,   0,   0,   r1 );
133maxone8 R2( clk, a28, a17, 0,   0,   0,   0,   0,   0,   r2 );
134maxone8 R3( clk, a38, a27, a16, 0,   0,   0,   0,   0,   r3 );
135maxone8 R4( clk, a48, a37, a26, a15, 0,   0,   0,   0,   r4 );
136maxone8 R5( clk, a58, a47, a36, a25, a14, 0,   0,   0,   r5 );
137maxone8 R6( clk, a68, a57, a46, a35, a24, a13, 0,   0,   r6 );
138maxone8 R7( clk, a78, a67, a56, a45, a34, a23, a12, 0,   r7 );
139maxone8 R8( clk, a88, a77, a66, a55, a44, a33, a23, a11, r8 );
140
141maxone8 R9 ( clk, a87, a76, a65, a54, a43, a32, a21, 0  , r9  );
142maxone8 R10( clk, a86, a75, a64, a53, a42, a31, 0  , 0  , r10 );
143maxone8 R11( clk, a85, a74, a63, a52, a41, 0  , 0  , 0  , r11 );
144maxone8 R12( clk, a84, a73, a62, a51, 0  , 0  , 0  , 0  , r12 );
145maxone8 R13( clk, a83, a72, a61, 0  , 0  , 0  , 0  , 0  , r13 );
146maxone8 R14( clk, a82, a71, 0  , 0  , 0  , 0  , 0  , 0  , r14 );
147maxone8 R15( clk, a81, 0  , 0  , 0  , 0  , 0  , 0  , 0  , r15 );
148
149
150assign tmp1 = ( h1 && h2 && h3 && h4 && h5 && h6 && h7 && h8 );
151assign tmp2 = ( v1 && v2 && v3 && v4 && v5 && v6 && v7 && v8 );
152assign tmp3 = ( l1 && l2 && l3 && l4 && l5 && l6 && l7 && l8 );
153assign tmp4 = ( r1 && r2 && r3 && r4 && r5 && r6 && r7 && r8 );
154assign tmp5 = ( l9 && l10 && l11 && l12 && l13 && l14 && l15 );
155assign tmp6 = ( r9 && r10 && r11 && r12 && r13 && r14 && r15 );
156
157assign consistent = ( tmp1 && tmp2 && tmp3 && tmp4 && tmp5 && tmp6 );
158
159
160endmodule     
161
162/************************************************************************/
163module  single8(clk, x1, x2, x3, x4, x5, x6, x7, x8, out );
164  input clk;
165  input x1, x2, x3, x4, x5, x6, x7, x8;
166  output out;
167
168  wire x1, x2, x3, x4, x5, x6, x7, x8;
169  wire out;
170  wire tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
171
172assign tmp1 = (  x1 && !x2 && !x3 && !x4 && !x5 && !x6 && !x7 && !x8 );
173assign tmp2 = ( !x1 &&  x2 && !x3 && !x4 && !x5 && !x6 && !x7 && !x8 );
174assign tmp3 = ( !x1 && !x2 &&  x3 && !x4 && !x5 && !x6 && !x7 && !x8 );
175assign tmp4 = ( !x1 && !x2 && !x3 &&  x4 && !x5 && !x6 && !x7 && !x8 );
176assign tmp5 = ( !x1 && !x2 && !x3 && !x4 &&  x5 && !x6 && !x7 && !x8 );
177assign tmp6 = ( !x1 && !x2 && !x3 && !x4 && !x5 &&  x6 && !x7 && !x8 );
178assign tmp7 = ( !x1 && !x2 && !x3 && !x4 && !x5 && !x6 &&  x7 && !x8 );
179assign tmp8 = ( !x1 && !x2 && !x3 && !x4 && !x5 && !x6 && !x7 &&  x8 );
180
181
182assign out =  ( tmp1 || tmp2 || tmp3 || tmp4 || tmp5 || tmp6 || tmp7 || tmp8 );
183
184endmodule 
185/************************************************************************/
186module  maxone8(clk, x1, x2, x3, x4, x5, x6, x7, x8, out );
187  input clk;
188  input x1, x2, x3, x4, x5, x6, x7, x8;
189  output out;
190
191  wire x1, x2, x3, x4, x5, x6, x7, x8;
192  wire out;
193  wire tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
194
195assign tmp0 = ( !x1 && !x2 && !x3 && !x4 && !x5 && !x6 && !x7 && !x8 );
196assign tmp1 = (  x1 && !x2 && !x3 && !x4 && !x5 && !x6 && !x7 && !x8 );
197assign tmp2 = ( !x1 &&  x2 && !x3 && !x4 && !x5 && !x6 && !x7 && !x8 );
198assign tmp3 = ( !x1 && !x2 &&  x3 && !x4 && !x5 && !x6 && !x7 && !x8 );
199assign tmp4 = ( !x1 && !x2 && !x3 &&  x4 && !x5 && !x6 && !x7 && !x8 );
200assign tmp5 = ( !x1 && !x2 && !x3 && !x4 &&  x5 && !x6 && !x7 && !x8 );
201assign tmp6 = ( !x1 && !x2 && !x3 && !x4 && !x5 &&  x6 && !x7 && !x8 );
202assign tmp7 = ( !x1 && !x2 && !x3 && !x4 && !x5 && !x6 &&  x7 && !x8 );
203assign tmp8 = ( !x1 && !x2 && !x3 && !x4 && !x5 && !x6 && !x7 &&  x8 );
204
205assign out =  ( tmp0 || tmp1 || tmp2 || tmp3 || tmp4 || tmp5 || tmp6 || tmp7 || tmp8 );
206
207endmodule 
208
209/************************************************************************/
210module  none8(clk, x1, x2, x3, x4, x5, x6, x7, x8, out );
211  input clk;
212  input x1, x2, x3, x4, x5, x6, x7, x8;
213  output out;
214
215  wire x1, x2, x3, x4, x5, x6, x7, x8;
216  wire out;
217
218assign out =  ( !x1 && !x2 && !x3 && !x4 && !x5 && !x6 && !x7 && !x8 );
219
220endmodule 
Note: See TracBrowser for help on using the repository browser.