Forum Discussion

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

Using PLL "lock" signal as the async reset in Verilog

If I want to use the PLL "lock' signal to work as an async reset, the "lock" signal will keep low after the FPGA is powered and goes high after a duration. If I won't reset my PLL, then it means "lock" siganl will never have a falling edge. If I power off the FPGA and power it again, it will have another rising edge.

In this case, can I still write the Verilog as following:

always @(posedge clk or negedge lock)

begin

if (lock == 1'b0)

……

else

……

end

As I mentioned previously, since there is no falling edge for "lock", will the Verilog code work? I guess it will but I am not sure.

Thanks in advance.

13 Replies

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

    --- Quote Start ---

    You do not want to use PLL lock as a reset signal directly. Not all PLL locked outputs have a debounce/deglitch filter, so they may toggle for a while before they stay in a static state.

    Download the code associated with this PCIe test

    http://www.alteraforum.com/forum/showthread.php?t=35678

    There's a deglitch/debounce filter in there you can use to "clean-up" the locked signal. You can then decide whether to use the "clean" signal as a synchronous or asynchronous reset signal.

    Cheers,

    Dave

    --- Quote End ---

    Hi Dave,

    First of all I hope you don't mind about my english, it's not my mother language. I'd like to know why you set the locked filter time to 0.5ms (25000 cycles in 50MHz), since Cyclone IV DS indicates Tlock = 1ms I figured out it might be set to 50000. Can you tell me more about it?

    Thank's!

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

    --- Quote Start ---

    This is synthesizeable - it tells the compiler what the initial register state is in the download bit-stream.

    --- Quote End ---

    Would this be the 'initial' block?? Or is there something else?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Would this be the 'initial' block?? Or is there something else?

    --- Quote End ---

    Synthesis tools do not support initial blocks very consistently. If you want to have an FPGA power-up with a particular value in a register you can assign that value during the initialization of the signal. For example;

    logic [31:0] regA = 32'h12345678;

    signal regA : std_logic_vector(31 downto 0) := X"12345678";

    You can chose to override these values in the reset part of a clocked process.

    Cheers,

    Dave