-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsync.ice
353 lines (353 loc) · 13.8 KB
/
sync.ice
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
{
"version": "1.2",
"package": {
"name": "VGA Sync",
"version": "",
"description": "VGA sync signal generator",
"author": "sam210723",
"image": "%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20id=%22Layer_1%22%20viewBox=%220%200%20544.98944%20253%22%20width=%22544.989%22%20height=%22253%22%3E%3Cstyle%20id=%22style4093%22%3E.st0,.st1%7Bfill:#fff;stroke:#000;stroke-width:2;stroke-miterlimit:10%7D.st1%7Bfill:#0b4e9a%7D.st2%7Bfill:none%7D.st3%7Bfont-family:'DejaVuSansCondensed-Bold',sans-serif;font-stretch:condensed;font-weight:700%7D.st4%7Bfont-size:31px%7D%3C/style%3E%3Cg%20id=%22g4147%22%20transform=%22translate(-286.25%20-141.5)%22%3E%3Cg%20id=%22g4137%22%20transform=%22translate(0%20-72)%22%3E%3Cpath%20class=%22st0%22%20d=%22M634.34%20214.5H354c-41.49%200-72.92%2040.33-65.72%2084.33l17.57%20107.29c5.62%2034.34%2033.33%2059.38%2065.72%2059.38h374.35c32.38%200%2060.09-25.04%2065.72-59.38l17.57-107.29c7.2-44-24.23-84.33-65.72-84.33z%22%20id=%22path4103%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Cpath%20class=%22st1%22%20d=%22M629.12%20231.5H368.15c-38.62%200-67.88%2034.87-61.18%2072.91l16.36%2092.76c5.23%2029.69%2031.03%2051.33%2061.18%2051.33h348.48c30.15%200%2055.94-21.64%2061.18-51.33l16.36-92.76c6.71-38.04-22.55-72.91-61.18-72.91z%22%20id=%22path4105%22%20fill=%22#0b4e9a%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22392.5%22%20cy=%22271.75%22%20r=%2225.25%22%20id=%22circle4107%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22632.31%22%20cy=%22271.75%22%20r=%2225.25%22%20id=%22circle4109%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22712.25%22%20cy=%22271.75%22%20r=%2225.25%22%20id=%22circle4111%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22552.38%22%20cy=%22271.75%22%20r=%2225.25%22%20id=%22circle4113%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22472.44%22%20cy=%22271.75%22%20r=%2225.25%22%20id=%22circle4115%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22392.5%22%20cy=%22410%22%20r=%2225.25%22%20id=%22circle4117%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22632.31%22%20cy=%22410%22%20r=%2225.25%22%20id=%22circle4119%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22712.25%22%20cy=%22410%22%20r=%2225.25%22%20id=%22circle4121%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22552.38%22%20cy=%22410%22%20r=%2225.25%22%20id=%22circle4123%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22472.44%22%20cy=%22410%22%20r=%2225.25%22%20id=%22circle4125%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22432.38%22%20cy=%22340.88%22%20r=%2225.25%22%20id=%22circle4127%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22672.19%22%20cy=%22340.88%22%20r=%2225.25%22%20id=%22circle4129%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22752.13%22%20cy=%22340.88%22%20r=%2225.25%22%20id=%22circle4131%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22592.25%22%20cy=%22340.88%22%20r=%2225.25%22%20id=%22circle4133%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3Ccircle%20class=%22st0%22%20cx=%22512.31%22%20cy=%22340.88%22%20r=%2225.25%22%20id=%22circle4135%22%20fill=%22#fff%22%20stroke=%22#000%22%20stroke-width=%222%22%20stroke-miterlimit=%2210%22/%3E%3C/g%3E%3C/g%3E%3Cpath%20class=%22st2%22%20id=%22rect4149%22%20fill=%22none%22%20d=%22M-285.75-141h1121v547h-1121z%22/%3E%3C/svg%3E"
},
"design": {
"board": "TinyFPGA-BX",
"graph": {
"blocks": [
{
"id": "79970647-0a55-428e-8ac7-9b100a472de4",
"type": "basic.output",
"data": {
"name": "h_sync",
"pins": [
{
"index": "0",
"name": "",
"value": ""
}
],
"virtual": true
},
"position": {
"x": 1384,
"y": 184
}
},
{
"id": "cb08ac43-f855-4385-8bb5-00fe788e90b7",
"type": "basic.output",
"data": {
"name": "v_sync",
"pins": [
{
"index": "0",
"name": "",
"value": ""
}
],
"virtual": true
},
"position": {
"x": 1384,
"y": 312
}
},
{
"id": "ab56b571-4970-4915-8d69-303c7c7b9de0",
"type": "basic.input",
"data": {
"name": "clock",
"pins": [
{
"index": "0",
"name": "",
"value": ""
}
],
"virtual": true,
"clock": false
},
"position": {
"x": 344,
"y": 440
}
},
{
"id": "a3d0ae56-09e7-4799-b83f-2895dff03342",
"type": "basic.output",
"data": {
"name": "x",
"range": "[11:0]",
"pins": [
{
"index": "11",
"name": "",
"value": ""
},
{
"index": "10",
"name": "",
"value": ""
},
{
"index": "9",
"name": "",
"value": ""
},
{
"index": "8",
"name": "",
"value": ""
},
{
"index": "7",
"name": "",
"value": ""
},
{
"index": "6",
"name": "",
"value": ""
},
{
"index": "5",
"name": "",
"value": ""
},
{
"index": "4",
"name": "",
"value": ""
},
{
"index": "3",
"name": "",
"value": ""
},
{
"index": "2",
"name": "",
"value": ""
},
{
"index": "1",
"name": "",
"value": ""
},
{
"index": "0",
"name": "",
"value": ""
}
],
"virtual": true
},
"position": {
"x": 1384,
"y": 440
}
},
{
"id": "19c7f259-b191-4e83-9856-5522b44a7378",
"type": "basic.output",
"data": {
"name": "y",
"range": "[11:0]",
"pins": [
{
"index": "11",
"name": "",
"value": ""
},
{
"index": "10",
"name": "",
"value": ""
},
{
"index": "9",
"name": "",
"value": ""
},
{
"index": "8",
"name": "",
"value": ""
},
{
"index": "7",
"name": "",
"value": ""
},
{
"index": "6",
"name": "",
"value": ""
},
{
"index": "5",
"name": "",
"value": ""
},
{
"index": "4",
"name": "",
"value": ""
},
{
"index": "3",
"name": "",
"value": ""
},
{
"index": "2",
"name": "",
"value": ""
},
{
"index": "1",
"name": "",
"value": ""
},
{
"index": "0",
"name": "",
"value": ""
}
],
"virtual": true
},
"position": {
"x": 1384,
"y": 560
}
},
{
"id": "2eb4452b-baff-4ed7-a8d2-deeec56bc3f9",
"type": "basic.output",
"data": {
"name": "active",
"pins": [
{
"index": "0",
"name": "",
"value": ""
}
],
"virtual": true
},
"position": {
"x": 1384,
"y": 688
}
},
{
"id": "463e834f-09b5-447c-a009-bb7493faf741",
"type": "basic.code",
"data": {
"code": "// Timing parameters (1024x768 @ 60 Hz)\nlocalparam H_ACTIVE = 1024; // Horizontal active pixels\nlocalparam H_FPORCH = 24; // Horizontal front porch\nlocalparam H_PULSE = 136; // Horizontal sync pulse\nlocalparam H_BPORCH = 160; // Horizontal back porch\nlocalparam H_SYNC_S = 1048; // Horizontal sync start\nlocalparam H_SYNC_E = 1183; // Horizontal sync end\nlocalparam H_TOTAL = 1343; // Horizontal total pixels\nlocalparam V_ACTIVE = 768; // Vertical active pixels\nlocalparam V_FPORCH = 3; // Vertical front porch\nlocalparam V_PULSE = 6; // Vertical sync pulse\nlocalparam V_BPORCH = 29; // Vertical back porch\nlocalparam V_SYNC_S = 771; // Vertical sync start\nlocalparam V_SYNC_E = 776; // Veritcal start end\nlocalparam V_TOTAL = 805; // Vertical total pixels\n\nreg [11:0] h_pos, v_pos;\n\nalways @(posedge clock)\n begin\n // Increment horizontal counter then reset on maximum value (H_TOTAL)\n h_pos = h_pos == H_TOTAL ? 0 : h_pos + 1;\n \n // Increment vertical counter after horizontal counter reset\n // then reset on maximum vertical value (V_TOTAL)\n v_pos = h_pos == 0 ? (\n v_pos == V_TOTAL ? 0 : v_pos + 1\n ) : v_pos;\n end\n\nassign h_sync = ~( h_pos >= H_SYNC_S && h_pos <= H_SYNC_E );\nassign v_sync = ~( v_pos >= V_SYNC_S && v_pos <= V_SYNC_E );\nassign x = h_pos;\nassign y = v_pos;\nassign active = h_pos < H_ACTIVE && v_pos < V_ACTIVE;\n",
"params": [],
"ports": {
"in": [
{
"name": "clock"
}
],
"out": [
{
"name": "h_sync"
},
{
"name": "v_sync"
},
{
"name": "x",
"range": "[11:0]",
"size": 12
},
{
"name": "y",
"range": "[11:0]",
"size": 12
},
{
"name": "active"
}
]
}
},
"position": {
"x": 520,
"y": 152
},
"size": {
"width": 784,
"height": 632
}
}
],
"wires": [
{
"source": {
"block": "ab56b571-4970-4915-8d69-303c7c7b9de0",
"port": "out"
},
"target": {
"block": "463e834f-09b5-447c-a009-bb7493faf741",
"port": "clock"
}
},
{
"source": {
"block": "463e834f-09b5-447c-a009-bb7493faf741",
"port": "h_sync"
},
"target": {
"block": "79970647-0a55-428e-8ac7-9b100a472de4",
"port": "in"
}
},
{
"source": {
"block": "463e834f-09b5-447c-a009-bb7493faf741",
"port": "v_sync"
},
"target": {
"block": "cb08ac43-f855-4385-8bb5-00fe788e90b7",
"port": "in"
}
},
{
"source": {
"block": "463e834f-09b5-447c-a009-bb7493faf741",
"port": "active"
},
"target": {
"block": "2eb4452b-baff-4ed7-a8d2-deeec56bc3f9",
"port": "in"
}
},
{
"source": {
"block": "463e834f-09b5-447c-a009-bb7493faf741",
"port": "x"
},
"target": {
"block": "a3d0ae56-09e7-4799-b83f-2895dff03342",
"port": "in"
},
"size": 12
},
{
"source": {
"block": "463e834f-09b5-447c-a009-bb7493faf741",
"port": "y"
},
"target": {
"block": "19c7f259-b191-4e83-9856-5522b44a7378",
"port": "in"
},
"size": 12
}
]
}
},
"dependencies": {}
}