Results 1 to 3 of 3

Thread: Trouble hardcoding an initial value of flip-flop on power up.

  1. #1
    Join Date
    Aug 2017
    Posts
    1
    Rep Power
    1

    Default Trouble hardcoding an initial value of flip-flop on power up.

    Hi All,

    I'm using a Max 10 FPGA.

    I'm having trouble instantiating a d flip flop initially set to '1'.

    From the altera.altera_primitives_components.all I am instantiating the following:

    component dff
    port (
    D : in std_logic; -- Data Input
    CLK : in std_logic; -- 100 MHz clock
    CLRN : in std_logic; -- Clear Input
    PRN : in std_logic; -- Preset Input
    Q : out std_logic -- Output Data
    );
    end component;

    But there is no generic that let's me hardcore a '1' there?

    I want to shift in 0's when the power is recycled (by tying the pin to ground) and
    so I need the initial value of the register to power up to '1'.

    Thank you for your help.

    Bryan Kerr
    Electronics Engineer

  2. #2
    Tricky is offline Moderator **Forum Master**
    Join Date
    Oct 2008
    Posts
    5,753
    Rep Power
    1

    Default Re: Trouble hardcoding an initial value of flip-flop on power up.

    Why are you using the primitives? why not infer the register, because then you can apply the initial value yourself:

    Code:
    signal q : std_logic := '1';  -- initial value
    
    ....
    
    process(clk)
    begin
      if clrn = '0' then
        q <= '0';
      elsif prn = '0' then
        q <= '1'
      elsif rising_edge(clk) then
        q <= d;
      end if;
    end process;
    If a register has async clear, it often uses this as the power on value if none is specified.
    If you have to use the primitives, I think you can assign the power on value in the project assignments. You will need to compile the project to get the register path from the node finder.

  3. #3
    Join Date
    Dec 2007
    Location
    Bochum Germany
    Posts
    6,182
    Rep Power
    1

    Default Re: Trouble hardcoding an initial value of flip-flop on power up.

    Consider that simultaneous asynchronous reset and preset isn't supported by MAX10 logic elements. It has to be emulated by a combination of DFF and combinational logic, including latches.

    The dffeas primitive component and the ff wysiwyg component have a power_up generic, by the way.
    Last edited by FvM; August 4th, 2017 at 03:51 AM.

Similar Threads

  1. D flip flop trouble
    By volvogv in forum FPGA, Hardcopy, and CPLD Discussion
    Replies: 2
    Last Post: February 27th, 2017, 01:10 PM
  2. Flip-flop with aload?
    By poofjunior in forum FPGA, Hardcopy, and CPLD Discussion
    Replies: 0
    Last Post: September 27th, 2014, 11:57 PM
  3. Replies: 3
    Last Post: October 2nd, 2013, 05:46 PM
  4. D Flip Flop
    By digitalee in forum VHDL
    Replies: 3
    Last Post: April 13th, 2013, 11:08 AM
  5. JK Flip-Flop - Quartus
    By leafar28 in forum Quartus II and EDA Tools Discussion
    Replies: 6
    Last Post: April 12th, 2010, 09:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •