{"id":97,"date":"2012-06-04T17:15:13","date_gmt":"2012-06-04T17:15:13","guid":{"rendered":"http:\/\/retroramblings.net\/?p=97"},"modified":"2012-06-05T09:25:31","modified_gmt":"2012-06-05T09:25:31","slug":"experimenting-with-tg68-4","status":"publish","type":"post","link":"https:\/\/retroramblings.net\/?p=97","title":{"rendered":"Experimenting with TG68"},"content":{"rendered":"<p><strong>Part 4 &#8211; improving memory performance<\/strong><\/p>\n<p>Since the last instalment I&#8217;ve slightly modified the program run by the TG68, so that instead of simply filling a rectangle with the current colour it mixes it with the colour already there.\u00a0 Quite apart from looking prettier on-screen, this increases the demands on memory access, making for a better testbed for the next stage of the project: caches.<\/p>\n<p><a href=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/framebuffer3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-98\" title=\"framebuffer3\" src=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/framebuffer3.jpg\" alt=\"\" width=\"656\" height=\"500\" srcset=\"https:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/framebuffer3.jpg 656w, https:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/framebuffer3-300x228.jpg 300w, https:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/framebuffer3-393x300.jpg 393w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/a><\/p>\n<p>In the current design, when the TG68 wants to access memory, a request signal is raised.\u00a0 Depending on which part of the SDRAM cycle this happens, it can be up to 15 cycles before the controller notices the request, and if the bus is busy it can be 16 cycles more before the request is serviced.\u00a0 Since the processor&#8217;s waiting around for this to happen, it makes sense to add a temporary buffer into which a pending write can be placed, so the processor can carry on working.\u00a0 Better yet, since the SDRAM cycle&#8217;s already set up for 4-word bursts, if the processor tries to write to an address that will be written during the burst, we can gang the writes up and perform them as one operation.<\/p>\n<p>Likewise, when reading we&#8217;re getting four-word bursts from the SDRAM controller, so it makes sense to store all four words, which lets us respond immediately if the processor then asks for another word from the same burst.<\/p>\n<p>There are a couple of complications we have to take care of.\u00a0 Firstly, when writing the processor uses two signals to indicate which of the high and low bytes of the word should be written.\u00a0 This allows byte writes even though the bus is 16-bits wide.\u00a0 The write cache has to store these signals alongside the data to be written.<\/p>\n<p>The other complication, which I haven&#8217;t yet attended to, since it doesn&#8217;t affect this test project, is that with both read and write caches in use, it&#8217;s possible for the read cache to contain stale data.\u00a0 To fix this, I just need to mark the read cache as dirty if it holds data from an address that&#8217;s being written to.<\/p>\n<p>The code, as always, for anyone who might be interested, <a href=\"http:\/\/retroramblings.net\/downloads\/DE1_TG68Test_Part4_VGA3.zip\">can be downloaded here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part 4 &#8211; improving memory performance Since the last instalment I&#8217;ve slightly modified the program run by the TG68, so that instead of simply filling a rectangle with the current colour it mixes it with the colour already there.\u00a0 Quite &hellip; <a href=\"https:\/\/retroramblings.net\/?p=97\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-fpga"],"_links":{"self":[{"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":6,"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions\/103"}],"wp:attachment":[{"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}