Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Specifying LUT's

Hi,

I'm currently trying to port the CERN WhiteRabbit TDC, which was originally written for Spartan FPGAs, to Cyclone4.

The code contains a ring oscillator build out of hand specified LUTs:

architecture rtl of tdc_ringosc is
signal s: std_logic_vector(g_LENGTH downto 0);
attribute keep: string;
attribute keep of s: signal is "true";
begin
    g_luts: for i in 0 to g_LENGTH-1 generate
        g_firstlut: if i = 0 generate
            cmp_LUT: LUT2
                generic map(
                    INIT => "0100"
                )
                port map(
                    I0 => s(i),
                    I1 => en_i,
                    O => s(i+1)
                );
         end generate;
         g_nextlut: if i > 0 generate
            cmp_LUT: LUT1
                generic map(
                    INIT => "01"
                )
                port map(
                    I0 => s(i),
                    O => s(i+1)
                );
         end generate;
    end generate;
    s(0) <= s(g_LENGTH);
    clk_o <= s(g_LENGTH);
end architecture;

There does not seem to be an equivalent primitive for Cyclone/quartus that supports the same functionality. It seems that either LUT_INPUT/LUT_OUTPUT or LCELL should be used instead, but I cannot figure out how to use them. The documentation of the primitives is short, at best, the "Designing with Low-Level Primitives" user guide does not contain more info and the Stratix Advanced Synthesis Cookbook does not mention them at all.

Could you point me to a description of how to use these primitives or something else I could use instead to solve this problem?

Thanks in advance

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    ... and what the definition for LUT1 and LUT2... <- doesn't matter

    It seems clock generated from logic (one-shot multivibrator) <- if you read book you saw many exclamation about it

    perhaps it is better to redesign block so you get managable value for output frequency

    (1) no dependacy logic elements are placed somewhere far from each other in the chip

    (2) why you do not want to use external clock with PLL?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    LUT* takes the value of INIT as a bit string that defines its output. The input pins are used as an address into this string.

    The LUT1 is basically just a buffer element while the LUT2 implements an AND gate with an inverted input to start/run the ring oscillator.

    No, a PLL does not work. The ring oscillator is there to measure the effects of temperature and voltage variation on the chip to compensate those variations in the delay chain used for the TDC itself. You can find the details of the design in http://www.ohwr.org/attachments/855/tdc_v3.pdf

    Yes, I know that I will have to do some manual placement to get things to work correctly. This is to be expected when building TDCs.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Altera doesnt provide support for configuring luts to the same level that Xilinx does.

    It provides specific gate functions (AND, OR) etc, but I also cannot find an ALUT as a configurable primitive. You can find them in in

    <install dir>/quartus/libraries/primitives