

  <refentry id="DPGEN-ADSB2F">
  <?dbhtml filename="man_dpgen_adsb2f.html">

  <refmeta>
    <refentrytitle>DPGEN_ADSB2F</refentrytitle>
    <manvolnum>3</manvolnum>
    <refmiscinfo>ASIM/LIP6</refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname> DPGEN_ADSB2F </refname>
    <refpurpose> Adder/Substractor Macro-Generator </refpurpose>
  </refnamediv>


  <refsynopsisdiv>
    <funcsynopsis>
      <funcsynopsisinfo>#include  &lt;genlib.h&gt;</funcsynopsisinfo>
      <funcprototype>
        <funcdef>void <function>GENLIB_MACRO</function></funcdef>
          <paramdef>DPGEN_ADSB2F</paramdef>
          <paramdef>char *<parameter>modelname</parameter></paramdef>
          <paramdef>long <parameter>flags</parameter></paramdef>
          <paramdef>long <parameter>N</parameter></paramdef>
      </funcprototype>
    </funcsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title> Description </title>

    <para> Generate a &N; bits adder/substractor named &modelname;.
    </para>
    <para> How it works :
    <itemizedlist>
      <listitem>
        <para> if the &add-sub; signal is set to &zero; an addition is
        performed, otherwise it's a substraction.
        </para>
      </listitem>
      <listitem>
        <para> Operation can be either signed or unsigned. In unsigned
        mode &c31; is the overflow, in unsigned mode you have to compute
        overflow by <emphasis>XORing</emphasis> &c31; and &c30;.
        </para>
      </listitem>
    </itemizedlist>
    </para>

    <refsect2>
      <title> Terminal Names </title>

      <orderedlist>
        <listitem>
          <para> &add-sub; : select addition or substraction
          (input, 1 bit).
          </para>
        </listitem>
        <listitem>
          <para> &c31; : carry out. In unsigned mode, this is the
          overflow (output, 1 bits). </para>
        </listitem>
        <listitem>
          <para> &c30; : used to compute overflow in signed mode :
          <literal>overflow := c31 xor c30</literal> (output, 1 bits).
          </para>
        </listitem>
        <listitem>
          <para> &i1; : first operand (input, &N; bits). </para>
        </listitem>
        <listitem>
          <para> &i0; : second operand (input, &N; bits). </para>
        </listitem>
        <listitem>
          <para> &q; : output (&N; bits). </para>
        </listitem>
        <listitem>
          <para> <literal>vdd</literal> : power. </para>
        </listitem>
        <listitem>
          <para> <literal>vss</literal> : ground. </para>
        </listitem>
      </orderedlist>

    </refsect2>

  </refsect1>

  <refsect1>
    <title> Example </title>

    <para>
    <programlisting>
GENLIB_MACRO(DPGEN_ADSB2F, "model_adsb2f_32"
                            , F_BEHAV|F_PLACE
                            , 32
                            );

GENLIB_LOINS( "model_adsb2f_32"
            , "instance1_adsb2f_32"
            , "add_sub"
            , "c32"
            , "c31"
            , "i1[31:0]"
            , "i0[31:0]"
            ,  "q[31:0]"
            , "vdd", "vss", NULL
            );
    </programlisting>
    </para>

  </refsect1>

  &man-dpgen-see-also;

  </refentry>
