﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="thpdoc.xsl"?>
<page id="synthesize_hardware" suffix=" Statement">
  <subsection>Defines the root entity used to generate FPGA bitstream and specifies the port mapping in the UCF file.<code>synthesize_hardware&lt;"FPGA name"&gt; EntityName(
    port1 = "pin map 1",
    ...,
    portN = "pin map N"
);

synthesize_hardware&lt;"FPGA name"&gt; EntityName(
    port1 = "pin map 1",
    ...,
    portN = "pin map N"
) post_route_sim(PostRouteTestbenchEntity);</code></subsection>
  <subsection name="FPGA Name">The FPGA name specified in this statement will be passed directly to the underlying toolchain (e.g. Xilinx XST).</subsection>
  <subsection name="Pin mapping syntax">The pin mapping is used to generate the UCF file. Note that you can insert arbitrary lines to the UCF file by putting <kw>__ucf()</kw> statements in THDL++ files.<code><i>PIN1,PIN2,...,PINx
modifier1,...,modifierN:PIN1,PIN2,...,PINx</i></code></subsection>
  <subsection name="Modifier types">
    <table>
      <tr>
        <td>Modifier</td>
        <td>UCF equivalent</td>
      </tr>
      <tr>
        <td>up</td>
        <td>PULLUP</td>
      </tr>
      <tr>
        <td>down</td>
        <td>PULLDOWN</td>
      </tr>
      <tr>
        <td>slow</td>
        <td>SLEW = "SLOW"</td>
      </tr>
      <tr>
        <td>fast</td>
        <td>SLEW = "FAST"</td>
      </tr>
      <tr>
        <td>d=N</td>
        <td>DRIVE = "N"</td>
      </tr>
      <tr>
        <td>Any string in square brackets, e.g. [IOSTANDARD = SSTL18_II]</td>
        <td>directly copied to UCF file</td>
      </tr>
    </table>
  </subsection>
  <section name="Remarks">
    <p>Every time an FPGA-targeted configuration is built all source files are scanned for <kw>synthesize_hardware</kw> statements. The entity specified in the statement will be used as the root entity. If you are building a post-route simulation configuration, the <kw nolink="1">post_route_sim</kw> clause should also be specified; otherwise it will be ignored.</p>
    <p>If none or multiple statements are found, an error is raised. Use the <kw>#ifdef</kw> statements to ensure that every configuration has one and only one <kw>synthesize_hardware</kw> statement. Note that <kw>synthesize_hardware</kw> statements will be ignored when building behavioral simulation configurations.</p>
  </section>
  <examples>
  <example name="Simple port map"><code>synthesize_hardware&lt;"xc3s700an-fgg484-4"&gt; LEDBlinkDemo(
    clk="E12",
    LEDs="W21,Y22,V20,V19,U19,U20,T19,R20");</code>Generated UCF file:<code>NET "thp_n0000_clk" LOC = "E12";
NET "thp_n0001_LEDs&lt;7&gt;" LOC = "W21";
NET "thp_n0001_LEDs&lt;6&gt;" LOC = "Y22";
NET "thp_n0001_LEDs&lt;5&gt;" LOC = "V20";
NET "thp_n0001_LEDs&lt;4&gt;" LOC = "V19";
NET "thp_n0001_LEDs&lt;3&gt;" LOC = "U19";
NET "thp_n0001_LEDs&lt;2&gt;" LOC = "U20";
NET "thp_n0001_LEDs&lt;1&gt;" LOC = "T19";
NET "thp_n0001_LEDs&lt;0&gt;" LOC = "R20";</code></example><example name="Modifiers"><code>synthesize_hardware&lt;"XC5VFX70T-FF1136-1"&gt; FTDIConnectionTester(
    sclk="L19",
    OData="d=8,slow:R34,T33,N32,P32,K33,L34,K32,K34");</code>Generated UCF file:<code>NET "sclk" LOC = "L19";
NET "OData&lt;7&gt;" LOC = "R34" | DRIVE = "8" | SLEW = "SLOW";
NET "OData&lt;6&gt;" LOC = "T33" | DRIVE = "8" | SLEW = "SLOW";
NET "OData&lt;5&gt;" LOC = "N32" | DRIVE = "8" | SLEW = "SLOW";
NET "OData&lt;4&gt;" LOC = "P32" | DRIVE = "8" | SLEW = "SLOW";
NET "OData&lt;3&gt;" LOC = "K33" | DRIVE = "8" | SLEW = "SLOW";
NET "OData&lt;2&gt;" LOC = "L34" | DRIVE = "8" | SLEW = "SLOW";
NET "OData&lt;1&gt;" LOC = "K32" | DRIVE = "8" | SLEW = "SLOW";
NET "OData&lt;0&gt;" LOC = "K34" | DRIVE = "8" | SLEW = "SLOW";</code></example><example name="Advanced modifiers"><code>synthesize_hardware&lt;"XC5VFX70T-FF1136-1"&gt; FTDIConnectionTester(
    sclk="L19",
    OData="d=8,[IOSTANDARD = SSTL18_II],slow:R34,T33,N32,P32,K33,L34,K32,K34");</code>Generated UCF file:<code>NET "sclk" LOC = "L19";
NET "OData&lt;7&gt;" LOC = "R34" | DRIVE = "8" | IOSTANDARD = SSTL18_II | SLEW = "SLOW";
NET "OData&lt;6&gt;" LOC = "T33" | DRIVE = "8" | IOSTANDARD = SSTL18_II | SLEW = "SLOW";
NET "OData&lt;5&gt;" LOC = "N32" | DRIVE = "8" | IOSTANDARD = SSTL18_II | SLEW = "SLOW";
NET "OData&lt;4&gt;" LOC = "P32" | DRIVE = "8" | IOSTANDARD = SSTL18_II | SLEW = "SLOW";
NET "OData&lt;3&gt;" LOC = "K33" | DRIVE = "8" | IOSTANDARD = SSTL18_II | SLEW = "SLOW";
NET "OData&lt;2&gt;" LOC = "L34" | DRIVE = "8" | IOSTANDARD = SSTL18_II | SLEW = "SLOW";
NET "OData&lt;1&gt;" LOC = "K32" | DRIVE = "8" | IOSTANDARD = SSTL18_II | SLEW = "SLOW";
NET "OData&lt;0&gt;" LOC = "K34" | DRIVE = "8" | IOSTANDARD = SSTL18_II | SLEW = "SLOW";</code></example><example name="Post-route simulation"><code>synthesize_hardware&lt;"xc3s700an-fgg484-4"&gt; LEDBlinkDemo(
    clk="E12",
    LEDs="W21,Y22,V20,V19,U19,U20,T19,R20"
) post_route_sim(SimulatedClockProvider&lt;20ns, LEDBlinkDemo&gt;);</code>Generated entities:<p>For FPGA-targeted configurations the result will be equivalent to example 1. For post-route simulation configurations VisualHDL will generate FPGA layout with LEDBlinkDemo being the root entity and then generate a post-route ISim-based simulation using SimulatedClockProvider&lt;20ns, LEDBlinkDemo&gt; as the testbench. Note that all instances of LEDBlinkDemo inside SimulatedClockProvider&lt;20ns, LEDBlinkDemo&gt; will be replaced by the post-route simulation model generated by netgen. If the entity specified in <kw>post_route_sim</kw> does not contain an instance of the root entity specified in <kw>synthesize_hardware</kw>, VisualHDL will show an error and fail the build.</p></example></examples>
<seealso id="simulate_entity"/>
<seealso id="generate_vhdl"/>
</page>