

  <refentry id="DPGEN-SHIFT">
  <?dbhtml filename="man_dpgen_shift.html">

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

  <refnamediv>
    <refname> DPGEN_SHIFT </refname>
    <refpurpose> Shifter Macro-Generator </refpurpose>
  </refnamediv>


  <refsynopsisdiv>
    <funcsynopsis>
      <funcsynopsisinfo>#include  &lt;genlib.h&gt;</funcsynopsisinfo>
      <funcprototype>
        <funcdef>void <function>GENLIB_MACRO</function></funcdef>
          <paramdef>DPGEN_SHIFT</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 shifter with name &modelname;.
    </para>
    <para> How it works :
    <itemizedlist>
      <listitem>
        <para> if the <literal>op[0]</literal> signal is set to &one; performs
        a right shift, performs a left shift otherwise.
        </para>
      </listitem>
      <listitem>
        <para> if the <literal>op[1]</literal> signal is set to &one; performs
        an arithmetic shift (only meaningful in case of a right shift).
        </para>
      </listitem>
      <listitem>
        <para> &shamt; : specifies the shift amount. The width of this signal
        (&Y;) is computed from the operator's width :
        <literal>Y = ceil(log<subscript>2</subscript>(N)) - 1</literal>.
        </para>
      </listitem>
    </itemizedlist>
    </para>

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

      <orderedlist>
        <listitem>
          <para> &op; : select the kind of shift (input, 2 bit).
          </para>
        </listitem>
        <listitem>
          <para> &shamt; : the shift amount (input, &Y; bits). </para>
        </listitem>
        <listitem>
          <para> &i; : value to shift (input, &N; bits). </para>
        </listitem>
        <listitem>
          <para> &o; : 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_SHIFT, "model_shift_32",
                          F_BEHAV|F_PLACE,
                          32);

GENLIB_LOINS("model_shift_32",
             "instance1_shift_32", 
             "op[1:0]", 
             "shamt[4:0]", 
             "x[31:0]", 
             "y[31:0]", 
             "vdd", "vss", NULL);
    </programlisting>
    </para>

  </refsect1>

  &man-dpgen-see-also;

  </refentry>
