paul@144 | 1 | = Signal Output = |
paul@144 | 2 | |
paul@144 | 3 | There are two principal mechanisms for generating a VGA signal demonstrated in |
paul@144 | 4 | this project: |
paul@144 | 5 | |
paul@144 | 6 | * Using the CPU to "copy" pixel data to an output port |
paul@144 | 7 | * Using DMA transfers to "copy" pixel data to an output port |
paul@144 | 8 | |
paul@144 | 9 | Within the latter, there are a number of variations in the mechanism employed: |
paul@144 | 10 | |
paul@144 | 11 | * Use of general-purpose output pins versus parallel mode outputs |
paul@144 | 12 | * Use of large transfer cells containing each entire pixel line versus small |
paul@144 | 13 | transfer cells containing fragments of each line |
paul@144 | 14 | * Use of a single transfer-initiating event versus separate line-initiating |
paul@144 | 15 | and transfer-initiating events |
paul@144 | 16 | |
paul@144 | 17 | == Using the CPU for Transfers == |
paul@144 | 18 | |
paul@144 | 19 | {{{#!graphviz |
paul@144 | 20 | //format=svg |
paul@144 | 21 | //transform=notugly |
paul@144 | 22 | digraph cpu { |
paul@144 | 23 | node [shape=box,fontsize="13.0",fontname="Helvetica"]; |
paul@144 | 24 | rankdir=TD; |
paul@144 | 25 | |
paul@144 | 26 | subgraph { |
paul@144 | 27 | rank=same; |
paul@144 | 28 | |
paul@144 | 29 | timer [label="Display line\ntimer",style=filled,fillcolor=gold]; |
paul@144 | 30 | t_0 [label="0",shape=ellipse]; |
paul@144 | 31 | t_hsync [label="hsync",shape=ellipse]; |
paul@144 | 32 | t_limit [label="limit",shape=ellipse]; |
paul@144 | 33 | } |
paul@144 | 34 | |
paul@144 | 35 | oc1 [label="Output compare",style=filled,fillcolor=gold]; |
paul@144 | 36 | |
paul@144 | 37 | subgraph { |
paul@144 | 38 | rank=same; |
paul@144 | 39 | |
paul@144 | 40 | lineirq [label="Display line\ninterrupt handler"]; |
paul@144 | 41 | pixelirq [label="Pixel output\ninterrupt handler"]; |
paul@144 | 42 | } |
paul@144 | 43 | |
paul@144 | 44 | subgraph { |
paul@144 | 45 | rank=same; |
paul@144 | 46 | |
paul@144 | 47 | pixels [label="Pixel output\nBlack/reset output",style=filled,fillcolor=green,shape=parallelogram]; |
paul@144 | 48 | hsync [label="Horizontal sync",shape=house,style=filled,fillcolor=red]; |
paul@144 | 49 | vsync [label="Vertical sync",shape=house,style=filled,fillcolor=red]; |
paul@144 | 50 | } |
paul@144 | 51 | |
paul@144 | 52 | /* The timer starts at 0 and wraps around at limit. */ |
paul@144 | 53 | |
paul@144 | 54 | timer -> t_0 [arrowhead=none]; |
paul@144 | 55 | t_0 -> t_hsync -> t_limit -> t_0 [style=dashed]; |
paul@144 | 56 | |
paul@144 | 57 | /* The timer initiates the interrupt request for pixel production. */ |
paul@144 | 58 | |
paul@144 | 59 | t_0 -> pixelirq; |
paul@144 | 60 | |
paul@144 | 61 | /* The interrupt handler generates the pixel output. */ |
paul@144 | 62 | |
paul@144 | 63 | pixelirq -> pixels; |
paul@144 | 64 | |
paul@144 | 65 | /* The timer feeds the output compare unit, driving hsync. */ |
paul@144 | 66 | |
paul@144 | 67 | t_hsync -> oc1; |
paul@144 | 68 | oc1 -> hsync; |
paul@144 | 69 | |
paul@144 | 70 | /* The output compare unit initiates the interrupt request for each line, |
paul@144 | 71 | driving vsync. */ |
paul@144 | 72 | |
paul@144 | 73 | oc1 -> lineirq; |
paul@144 | 74 | lineirq -> vsync; |
paul@144 | 75 | } |
paul@144 | 76 | }}} |
paul@144 | 77 | |
paul@144 | 78 | == Using DMA for Transfers == |
paul@144 | 79 | |
paul@144 | 80 | {{{#!graphviz |
paul@144 | 81 | //format=svg |
paul@144 | 82 | //transform=notugly |
paul@144 | 83 | digraph dma { |
paul@144 | 84 | node [shape=box,fontsize="13.0",fontname="Helvetica"]; |
paul@144 | 85 | rankdir=TD; |
paul@144 | 86 | |
paul@144 | 87 | subgraph { |
paul@144 | 88 | rank=same; |
paul@144 | 89 | |
paul@144 | 90 | timer [label="Display line\ntimer",style=filled,fillcolor=gold]; |
paul@144 | 91 | t_0 [label="0",shape=ellipse]; |
paul@144 | 92 | t_hsync [label="hsync",shape=ellipse]; |
paul@144 | 93 | t_limit [label="limit",shape=ellipse]; |
paul@144 | 94 | } |
paul@144 | 95 | |
paul@144 | 96 | oc1 [label="Output compare",style=filled,fillcolor=gold]; |
paul@144 | 97 | |
paul@144 | 98 | subgraph { |
paul@144 | 99 | rank=same; |
paul@144 | 100 | |
paul@144 | 101 | dma_line [label="Pixel output\nDMA channel",style=filled,fillcolor=lightblue]; |
paul@144 | 102 | dma_reset [label="Pixel reset\nDMA channel",style=filled,fillcolor=lightblue]; |
paul@144 | 103 | lineirq [label="Display line\ninterrupt handler"]; |
paul@144 | 104 | } |
paul@144 | 105 | |
paul@144 | 106 | subgraph { |
paul@144 | 107 | rank=same; |
paul@144 | 108 | |
paul@144 | 109 | pixels [label="Pixel output",style=filled,fillcolor=green,shape=parallelogram]; |
paul@144 | 110 | black [label="Black/reset output",style=filled,fillcolor=black,fontcolor=white,shape=parallelogram]; |
paul@144 | 111 | hsync [label="Horizontal sync",shape=house,style=filled,fillcolor=red]; |
paul@144 | 112 | vsync [label="Vertical sync",shape=house,style=filled,fillcolor=red]; |
paul@144 | 113 | } |
paul@144 | 114 | |
paul@144 | 115 | /* The timer starts at 0 and wraps around at limit. */ |
paul@144 | 116 | |
paul@144 | 117 | timer -> t_0 [arrowhead=none]; |
paul@144 | 118 | t_0 -> t_hsync -> t_limit -> t_0 [style=dashed]; |
paul@144 | 119 | |
paul@144 | 120 | /* The timer initiates the DMA transfer for pixel production. */ |
paul@144 | 121 | |
paul@144 | 122 | t_0 -> dma_line; |
paul@144 | 123 | |
paul@144 | 124 | /* The line channel generates the pixel output. */ |
paul@144 | 125 | |
paul@144 | 126 | dma_line -> pixels; |
paul@144 | 127 | |
paul@144 | 128 | /* The completion of the line channel initiates the reset channel. */ |
paul@144 | 129 | |
paul@144 | 130 | dma_line -> dma_reset; |
paul@144 | 131 | |
paul@144 | 132 | /* The reset channel generates black/reset output. */ |
paul@144 | 133 | |
paul@144 | 134 | dma_reset -> black; |
paul@144 | 135 | |
paul@144 | 136 | /* The black/reset value follows the visible pixels. */ |
paul@144 | 137 | |
paul@144 | 138 | pixels -> black [style=dashed]; |
paul@144 | 139 | |
paul@144 | 140 | /* The timer feeds the output compare unit, driving hsync. */ |
paul@144 | 141 | |
paul@144 | 142 | t_hsync -> oc1; |
paul@144 | 143 | oc1 -> hsync; |
paul@144 | 144 | |
paul@144 | 145 | /* The output compare unit initiates the interrupt request for each line, |
paul@144 | 146 | driving vsync. */ |
paul@144 | 147 | |
paul@144 | 148 | oc1 -> lineirq; |
paul@144 | 149 | lineirq -> vsync; |
paul@144 | 150 | } |
paul@144 | 151 | }}} |
paul@144 | 152 | |
paul@144 | 153 | == Using DMA and Timed Transfers == |
paul@144 | 154 | |
paul@144 | 155 | {{{#!graphviz |
paul@144 | 156 | //format=svg |
paul@144 | 157 | //transform=notugly |
paul@144 | 158 | digraph dma { |
paul@144 | 159 | node [shape=box,fontsize="13.0",fontname="Helvetica"]; |
paul@144 | 160 | rankdir=TD; |
paul@144 | 161 | |
paul@144 | 162 | subgraph { |
paul@144 | 163 | rank=same; |
paul@144 | 164 | |
paul@144 | 165 | timer [label="Display line\ntimer",style=filled,fillcolor=gold]; |
paul@144 | 166 | t_0 [label="0",shape=ellipse]; |
paul@144 | 167 | t_hsync [label="hsync",shape=ellipse]; |
paul@144 | 168 | t_limit [label="limit",shape=ellipse]; |
paul@144 | 169 | } |
paul@144 | 170 | |
paul@144 | 171 | oc1 [label="Output compare",style=filled,fillcolor=gold]; |
paul@144 | 172 | |
paul@144 | 173 | subgraph { |
paul@144 | 174 | rank=same; |
paul@144 | 175 | |
paul@144 | 176 | trtimer [label="Transfer timer",style=filled,fillcolor=gold]; |
paul@144 | 177 | tr_0 [label="0",shape=ellipse]; |
paul@144 | 178 | tr_limit [label="limit",shape=ellipse]; |
paul@144 | 179 | } |
paul@144 | 180 | |
paul@144 | 181 | subgraph { |
paul@144 | 182 | rank=same; |
paul@144 | 183 | |
paul@144 | 184 | dma_init [label="Initiator\nDMA channel",style=filled,fillcolor=lightblue]; |
paul@144 | 185 | dma_line [label="Pixel output\nDMA channel",style=filled,fillcolor=lightblue]; |
paul@144 | 186 | dma_reset [label="Pixel reset\nDMA channel",style=filled,fillcolor=lightblue]; |
paul@144 | 187 | lineirq [label="Display line\ninterrupt handler"]; |
paul@144 | 188 | } |
paul@144 | 189 | |
paul@144 | 190 | subgraph { |
paul@144 | 191 | rank=same; |
paul@144 | 192 | |
paul@144 | 193 | pixels [label="Pixel output",style=filled,fillcolor=green,shape=parallelogram]; |
paul@144 | 194 | black [label="Black/reset output",style=filled,fillcolor=black,fontcolor=white,shape=parallelogram]; |
paul@144 | 195 | hsync [label="Horizontal sync",shape=house,style=filled,fillcolor=red]; |
paul@144 | 196 | vsync [label="Vertical sync",shape=house,style=filled,fillcolor=red]; |
paul@144 | 197 | } |
paul@144 | 198 | |
paul@144 | 199 | /* The line timer starts at 0 and wraps around at limit. */ |
paul@144 | 200 | |
paul@144 | 201 | timer -> t_0 [arrowhead=none]; |
paul@144 | 202 | t_0 -> t_hsync -> t_limit -> t_0 [style=dashed]; |
paul@144 | 203 | |
paul@144 | 204 | /* The transfer timer starts at 0 and wraps around at limit. */ |
paul@144 | 205 | |
paul@144 | 206 | trtimer -> tr_0 [arrowhead=none]; |
paul@144 | 207 | tr_0 -> tr_limit -> tr_0 [style=dashed]; |
paul@144 | 208 | |
paul@144 | 209 | /* The line timer initiates the DMA transfers for the display line. */ |
paul@144 | 210 | |
paul@144 | 211 | t_0 -> dma_init; |
paul@144 | 212 | |
paul@144 | 213 | /* The completion of the initiating channel enables the line channel. */ |
paul@144 | 214 | |
paul@144 | 215 | dma_init -> dma_line; |
paul@144 | 216 | |
paul@144 | 217 | /* Each cell transfer in the line channel is initiated by the transfer |
paul@144 | 218 | timer. */ |
paul@144 | 219 | |
paul@144 | 220 | tr_0 -> dma_line; |
paul@144 | 221 | |
paul@144 | 222 | /* The line channel generates the pixel output. */ |
paul@144 | 223 | |
paul@144 | 224 | dma_line -> pixels; |
paul@144 | 225 | |
paul@144 | 226 | /* The completion of the line channel initiates the reset channel. */ |
paul@144 | 227 | |
paul@144 | 228 | dma_line -> dma_reset; |
paul@144 | 229 | |
paul@144 | 230 | /* The reset channel generates black/reset output. */ |
paul@144 | 231 | |
paul@144 | 232 | dma_reset -> black; |
paul@144 | 233 | |
paul@144 | 234 | /* The black/reset value follows the visible pixels. */ |
paul@144 | 235 | |
paul@144 | 236 | pixels -> black [style=dashed]; |
paul@144 | 237 | |
paul@144 | 238 | /* The timer feeds the output compare unit, driving hsync. */ |
paul@144 | 239 | |
paul@144 | 240 | t_hsync -> oc1; |
paul@144 | 241 | oc1 -> hsync; |
paul@144 | 242 | |
paul@144 | 243 | /* The output compare unit initiates the interrupt request for each line, |
paul@144 | 244 | driving vsync. */ |
paul@144 | 245 | |
paul@144 | 246 | oc1 -> lineirq; |
paul@144 | 247 | lineirq -> vsync; |
paul@144 | 248 | } |
paul@144 | 249 | }}} |
paul@144 | 250 | |
paul@144 | 251 | == Using DMA and Timed Dual-Channel Transfers == |
paul@144 | 252 | |
paul@144 | 253 | {{{#!graphviz |
paul@144 | 254 | //format=svg |
paul@144 | 255 | //transform=notugly |
paul@144 | 256 | digraph dma { |
paul@144 | 257 | node [shape=box,fontsize="13.0",fontname="Helvetica"]; |
paul@144 | 258 | rankdir=TD; |
paul@144 | 259 | |
paul@144 | 260 | subgraph { |
paul@144 | 261 | rank=same; |
paul@144 | 262 | |
paul@144 | 263 | timer [label="Display line\ntimer",style=filled,fillcolor=gold]; |
paul@144 | 264 | t_0 [label="0",shape=ellipse]; |
paul@144 | 265 | t_hsync [label="hsync",shape=ellipse]; |
paul@144 | 266 | t_limit [label="limit",shape=ellipse]; |
paul@144 | 267 | } |
paul@144 | 268 | |
paul@144 | 269 | oc1 [label="Output compare",style=filled,fillcolor=gold]; |
paul@144 | 270 | |
paul@144 | 271 | subgraph { |
paul@144 | 272 | rank=same; |
paul@144 | 273 | |
paul@144 | 274 | trtimer [label="Transfer timer",style=filled,fillcolor=gold]; |
paul@144 | 275 | tr_0 [label="0",shape=ellipse]; |
paul@144 | 276 | tr_limit [label="limit",shape=ellipse]; |
paul@144 | 277 | } |
paul@144 | 278 | |
paul@144 | 279 | subgraph { |
paul@144 | 280 | rank=same; |
paul@144 | 281 | |
paul@144 | 282 | dma_init [label="Initiator\nDMA channel",style=filled,fillcolor=lightblue]; |
paul@144 | 283 | dma_line [label="{Pixel output\nDMA channel #1 | Pixel output\nDMA channel #2}",style=filled,fillcolor=lightblue,shape=record]; |
paul@144 | 284 | dma_reset [label="Pixel reset\nDMA channel",style=filled,fillcolor=lightblue]; |
paul@144 | 285 | lineirq [label="Display line\ninterrupt handler"]; |
paul@144 | 286 | } |
paul@144 | 287 | |
paul@144 | 288 | subgraph { |
paul@144 | 289 | rank=same; |
paul@144 | 290 | |
paul@144 | 291 | pixels [label="Pixel output",style=filled,fillcolor=green,shape=parallelogram]; |
paul@144 | 292 | black [label="Black/reset output",style=filled,fillcolor=black,fontcolor=white,shape=parallelogram]; |
paul@144 | 293 | hsync [label="Horizontal sync",shape=house,style=filled,fillcolor=red]; |
paul@144 | 294 | vsync [label="Vertical sync",shape=house,style=filled,fillcolor=red]; |
paul@144 | 295 | } |
paul@144 | 296 | |
paul@144 | 297 | /* The line timer starts at 0 and wraps around at limit. */ |
paul@144 | 298 | |
paul@144 | 299 | timer -> t_0 [arrowhead=none]; |
paul@144 | 300 | t_0 -> t_hsync -> t_limit -> t_0 [style=dashed]; |
paul@144 | 301 | |
paul@144 | 302 | /* The transfer timer starts at 0 and wraps around at limit. */ |
paul@144 | 303 | |
paul@144 | 304 | trtimer -> tr_0 [arrowhead=none]; |
paul@144 | 305 | tr_0 -> tr_limit -> tr_0 [style=dashed]; |
paul@144 | 306 | |
paul@144 | 307 | /* The line timer initiates the DMA transfers for the display line. */ |
paul@144 | 308 | |
paul@144 | 309 | t_0 -> dma_init; |
paul@144 | 310 | |
paul@144 | 311 | /* The completion of the initiating channel enables the line channels. */ |
paul@144 | 312 | |
paul@144 | 313 | dma_init -> dma_line; |
paul@144 | 314 | |
paul@144 | 315 | /* Each cell transfer in the line channels is initiated by the transfer |
paul@144 | 316 | timer. */ |
paul@144 | 317 | |
paul@144 | 318 | tr_0 -> dma_line; |
paul@144 | 319 | |
paul@144 | 320 | /* The line channels generate the pixel output. */ |
paul@144 | 321 | |
paul@144 | 322 | dma_line -> pixels; |
paul@144 | 323 | |
paul@144 | 324 | /* The completion of the line channels initiates the reset channel. */ |
paul@144 | 325 | |
paul@144 | 326 | dma_line -> dma_reset; |
paul@144 | 327 | |
paul@144 | 328 | /* The reset channel generates black/reset output. */ |
paul@144 | 329 | |
paul@144 | 330 | dma_reset -> black; |
paul@144 | 331 | |
paul@144 | 332 | /* The black/reset value follows the visible pixels. */ |
paul@144 | 333 | |
paul@144 | 334 | pixels -> black [style=dashed]; |
paul@144 | 335 | |
paul@144 | 336 | /* The timer feeds the output compare unit, driving hsync. */ |
paul@144 | 337 | |
paul@144 | 338 | t_hsync -> oc1; |
paul@144 | 339 | oc1 -> hsync; |
paul@144 | 340 | |
paul@144 | 341 | /* The output compare unit initiates the interrupt request for each line, |
paul@144 | 342 | driving vsync. */ |
paul@144 | 343 | |
paul@144 | 344 | oc1 -> lineirq; |
paul@144 | 345 | lineirq -> vsync; |
paul@144 | 346 | } |
paul@144 | 347 | }}} |