{"id":719,"date":"2013-12-28T16:43:28","date_gmt":"2013-12-28T16:43:28","guid":{"rendered":"http:\/\/retroramblings.net\/?p=719"},"modified":"2013-12-28T18:48:00","modified_gmt":"2013-12-28T18:48:00","slug":"bringing-up-a-new-board-2","status":"publish","type":"post","link":"https:\/\/retroramblings.net\/?p=719","title":{"rendered":"Bringing up a new board"},"content":{"rendered":"<p><strong>Part 2: Hello World<\/strong><\/p>\n<p>Since my last post I&#8217;ve received yet another board from Emanuel &#8211; another prototype FPGA board with Spartan 6, SDRAM and SSRAM.\u00a0 This one&#8217;s a little simpler than the previous board, with no ports other than USB on the board itself, and a daughter card with a VGA connector on it.\u00a0 Unlike the previous board, which had a 2-bits-per-gun resistor ladder DAC, this one has an ADV7123 video DAC chip &#8211; the same one used on the DE2 board &#8211; which has an impressive 10 bits per gun.\u00a0 That&#8217;s good enough to do 24-bit true colour with headroom for calibration tables!<\/p>\n<p><a href=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/EMS11-BB21.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-720\" alt=\"EMS11-BB21\" src=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/EMS11-BB21.jpg\" width=\"816\" height=\"500\" srcset=\"https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/EMS11-BB21.jpg 816w, https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/EMS11-BB21-300x183.jpg 300w, https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/EMS11-BB21-489x300.jpg 489w\" sizes=\"auto, (max-width: 816px) 100vw, 816px\" \/><\/a><\/p>\n<p>So, let&#8217;s get &#8220;Hello World&#8221; running on this board.<!--more--><\/p>\n<p>I&#8217;m going to use the ZPUDemos repository, which I&#8217;ve tagged at the appropriate point, so we can check it out like so:<\/p>\n<pre>git clone https:\/\/github.com\/robinsonb5\/ZPUDemos\r\ncd ZPUDemos\r\ngit checkout 20131228_1\r\ngit submodule init\r\ngit submodule update<\/pre>\n<p>You should now have a clean copy of the repo.<\/p>\n<p>We need to add the following files<\/p>\n<p>In HelloWorld\/fpga\/ we need to add a directory for the new board &#8211; so:<\/p>\n<pre>mkdir HelloWorld\/fpga\/ems11-bb21<\/pre>\n<p>Now it&#8217;s time to fire up ISE and create a new project.<\/p>\n<p>Specify \/path\/to\/ZPUDemos\/HelloWorld\/fpga\/ems11-bb21\/ as the path to the new project, and call it &#8220;HelloWorld&#8221;.\u00a0 ISE will want to create a HelloWorld subdirectory, but that&#8217;s unnecessary here.<\/p>\n<p>Now we need to specify the device, which in this case is family: &#8220;Spartan 6&#8221;, Device: &#8220;XC6SLX45&#8221;, Package: &#8220;FGG676&#8221;.\u00a0 Also set the preferred language to VHDL, then click through to the end of the New Project wizard.<\/p>\n<p>We need to create a toplevel file for the new board, which will be filed in the &#8220;ZPUDemos\/RTL&#8221; directory.\u00a0 We also need a .ucf file to specify pin mappings.\u00a0 I have a .ucf file for the board, which has been automatically generated from the schematics &#8211; but the signals are all commented out by default, and some signal names need changing since they&#8217;re not valid in VHDL.\u00a0 So we&#8217;ll take a gradual approach, and enable them bit by bit.\u00a0 The .ucf file will go in ZPUDemos\/Board\/<\/p>\n<p>For &#8220;Hello World&#8221; we only actually need two pins defined.\u00a0 We need a clock input, and we need an RS232 serial output.\u00a0 These we can find on pin D14 for a 50MHz clock input, and L18 for the signal called &#8220;RXD1(FROM_FPGA)&#8221;.\u00a0 We can&#8217;t use brackets for VHDL signal names, so we&#8217;ll rename that to RXD1_FROM_FPGA.\u00a0 (That&#8217;s rxd from the perspective of the attached computer, not the FPGA.\u00a0 That&#8217;s why I like the SPI nomenclature &#8211; Master In, Slave Out is completely unambiguous regarding direction!)<\/p>\n<p>So the 50MHz input clock is specified in the .ucf file like so:<\/p>\n<pre>NET \"CLK50\" LOC = \"D14\";\r\nNET \"CLK50\" IOSTANDARD = LVTTL;\r\nNET \"CLK50\" TNM_NET = \"CLK50\" | CLOCK_DEDICATED_ROUTE = FALSE;\r\nTIMESPEC \"TS_CLK50\" = PERIOD \"CLK50\" 20 ns HIGH 50 %;<\/pre>\n<p>The board has two RS232 interfaces available to the FPGA &#8211; both of which are carried over a single USB cable &#8211; for now we&#8217;ll only define one of them, but we will define all four signals, not just the one required for Hello World:<\/p>\n<pre>NET \"RXD1_FROM_FPGA\" LOC = \"L18\";\r\nNET \"N_CTS1_FROM_FPGA\" LOC = \"K19\";\r\nNET \"N_RTS1_TO_FPGA\" LOC = \"H24\";\r\nNET \"TXD1_TO_FPGA\" LOC = \"F24\";\r\n\r\nNET \"RXD1_FROM_FPGA\" IOSTANDARD = LVTTL;\r\nNET \"N_CTS1_FROM_FPGA\" IOSTANDARD = LVTTL;\r\nNET \"N_RTS1_TO_FPGA\" IOSTANDARD = LVTTL;\r\nNET \"TXD1_TO_FPGA\" IOSTANDARD = LVTTL;<\/pre>\n<p>The simplified first-approximation toplevel file looks like this:<\/p>\n<pre>-- Toplevel file for EMS11-BB21 board\r\n\r\nlibrary ieee;\r\nuse IEEE.STD_LOGIC_1164.ALL;\r\nuse IEEE.numeric_std.ALL;\r\n\r\nentity EMS11_BB21Toplevel is\r\nport\r\n(\r\n\u00a0\u00a0 \u00a0CLK50 : in std_logic;\r\n\u00a0\u00a0 \u00a0TXD1_TO_FPGA : in std_logic;\r\n\u00a0\u00a0 \u00a0RXD1_FROM_FPGA : out std_logic;\r\n\u00a0\u00a0 \u00a0N_RTS1_TO_FPGA : in std_logic;\r\n\u00a0\u00a0 \u00a0N_CTS1_FROM_FPGA : out std_logic\r\n);\r\nend entity;\r\n\r\narchitecture rtl of EMS11_BB21Toplevel is\r\n\r\nbegin\r\nN_CTS1_FROM_FPGA&lt;='1';\u00a0 -- safe default since we're not using handshaking.\r\n\r\nproject: entity work.VirtualToplevel\r\n\u00a0\u00a0\u00a0 generic map (\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0sysclk_frequency =&gt; 500 -- Sysclk frequency * 10\r\n\u00a0\u00a0 \u00a0)\r\n\u00a0\u00a0 \u00a0port map (\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0clk =&gt; CLK50,\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0reset_in =&gt; '1',\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-- UART\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0rxd =&gt; TXD1_TO_FPGA,\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0txd =&gt; RXD1_FROM_FPGA\r\n);\r\n\r\nend architecture;<\/pre>\n<p>So having added the toplevel and the .ucf file to the project, we also need to add the following files:<\/p>\n<ul>\n<li>HelloWorld\/Firmware\/HelloWorld_ROM.vhd<\/li>\n<li>HelloWorld\/RTL\/HelloWorld_VirtualToplevel.vhd<\/li>\n<li>HelloWorld\/RTL\/Toplevel_config.vhd<\/li>\n<li>RTL\/simple_uart.vhd<\/li>\n<li>ZPUFlex\/RTL\/zpu_core_flex.vhd<\/li>\n<li>ZPUFlex\/RTL\/zpupkg.vhd<\/li>\n<li>ZPUFlex\/RTL\/zpu_config.vhd<\/li>\n<\/ul>\n<p>The project should now compile, and when uploaded via JTAG, should send &#8220;Hello World&#8221; to one of the RS232-over-USB ports. <a href=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/HelloWorld.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-725\" alt=\"HelloWorld\" src=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/HelloWorld.jpg\" width=\"841\" height=\"689\" srcset=\"https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/HelloWorld.jpg 841w, https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/HelloWorld-300x245.jpg 300w, https:\/\/retroramblings.net\/wp-content\/uploads\/2013\/12\/HelloWorld-366x300.jpg 366w\" sizes=\"auto, (max-width: 841px) 100vw, 841px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part 2: Hello World Since my last post I&#8217;ve received yet another board from Emanuel &#8211; another prototype FPGA board with Spartan 6, SDRAM and SSRAM.\u00a0 This one&#8217;s a little simpler than the previous board, with no ports other than &hellip; <a href=\"https:\/\/retroramblings.net\/?p=719\">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-719","post","type-post","status-publish","format-standard","hentry","category-fpga"],"_links":{"self":[{"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/719","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=719"}],"version-history":[{"count":9,"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/719\/revisions"}],"predecessor-version":[{"id":730,"href":"https:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/719\/revisions\/730"}],"wp:attachment":[{"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}