{"id":487,"date":"2013-05-09T23:58:52","date_gmt":"2013-05-09T23:58:52","guid":{"rendered":"http:\/\/retroramblings.net\/?p=487"},"modified":"2013-05-11T15:07:24","modified_gmt":"2013-05-11T15:07:24","slug":"a-system-on-chip-in-2300-logic-elements","status":"publish","type":"post","link":"https:\/\/retroramblings.net\/?p=487","title":{"rendered":"A System-on-Chip in 2300 logic elements!"},"content":{"rendered":"<p>My experiments with the &#8220;small&#8221; variant of the ZPU processor have resulted so far in a reasonably functional and tiny System-on-Chip. Supported so far are:<\/p>\n<ul>\n<li>ZPU processor with GCC toolchain support<\/li>\n<li>SDRAM controller with cache<\/li>\n<li>VGA video output, 640x480x16-bit (Dithered on DE1 board)<\/li>\n<li>Millsecond counter<\/li>\n<li>SD card access<\/li>\n<li>UART<\/li>\n<li>HEX display (DE1 only)<\/li>\n<\/ul>\n<p>All within a mere 2300 logic elements.<br \/>\n<!--more--><br \/>\nThere are a few gotchas, however:<\/p>\n<p>Firstly, Block RAM usage is fairly high, especially if your Boot ROM is large.\u00a0 I currently have a SD-Loader which is a shade under 8kb.\u00a0 I&#8217;m hoping I can massage that down to 4kb in time, but we shall see.\u00a0 Removing the Two-way cache would also save a fair bit of BlockRAM.<\/p>\n<p>Secondly, while I now have support for writing 16-bit halfwords and 8-bit bytes to SDRAM, I haven&#8217;t attempted to support these writes to BlockRAM.\u00a0 This means that global variables in the boot code currently need to be 32-bit in size, and 32-bit aligned.\u00a0 (This issue can be avoided by disabling hardware storeb and storeh support (and you save a handful of LEs in the process), but if your firmware does a lot of 8- and 16-bit writes, there will be a major speed penalty.)<\/p>\n<p>Full source <a href=\"https:\/\/github.com\/robinsonb5\/ZPUTest\">can be found at GitHub<\/a>, and a binary snapshot for the DE1 board (.sof file to be JTAGged to the board, and four images to be placed on an SD card) <a href=\"http:\/\/retroramblings.net\/snapshots\/ZPUTest_Snapshot_20130510.zip\">can be found here<\/a>, for anyone who might be interested.<\/p>\n<p>The boot firmware contains some really ugly hacks to put some global structures in SDRAM &#8211; they should be allocated properly, but I certainly don&#8217;t want to pull a full malloc() implementation into the project!\u00a0 [Edit: I&#8217;ve since replaced said ugly hacks with some linker script magic to put the BSS section into SDRAM.]<\/p>\n<p><a href=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2013\/05\/Slideshow.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-488\" alt=\"Slideshow\" src=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2013\/05\/Slideshow.jpg\" width=\"614\" height=\"500\" srcset=\"https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/05\/Slideshow.jpg 614w, https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/05\/Slideshow-300x244.jpg 300w, https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/05\/Slideshow-368x300.jpg 368w\" sizes=\"auto, (max-width: 614px) 100vw, 614px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>My experiments with the &#8220;small&#8221; variant of the ZPU processor have resulted so far in a reasonably functional and tiny System-on-Chip. Supported so far are: ZPU processor with GCC toolchain support SDRAM controller with cache VGA video output, 640x480x16-bit (Dithered &hellip; <a href=\"https:\/\/retroramblings.net\/?p=487\">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-487","post","type-post","status-publish","format-standard","hentry","category-fpga"],"_links":{"self":[{"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/487","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=487"}],"version-history":[{"count":4,"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/487\/revisions"}],"predecessor-version":[{"id":491,"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/487\/revisions\/491"}],"wp:attachment":[{"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}