SR Flip Flop

Discussion in 'VHDL' started by RishiD, Oct 29, 2006.

  1. RishiD

    RishiD Guest

    Hi,

    Just started learning VHDL, and trying to code up a S-R Flip flop with
    async reset.

    Here is what I got, believe this is correct.

    Any thing I am missing?

    Thanks,

    RishiD

    achitecture SR of SRFF is
    signal Qint : STD_LOGIC;
    begin
    process (clk, reset) begin
    if (reset = '1' and s = '1') then
    Qint <= 'X';
    elsif (reset = '1' and s = '0') then
    Qint <= '0';
    elsif (clk'event AND clk = '1') then
    if (s = '1') then
    Qint <= '1';
    end if;
    end if;
    end process;
    Q <= Qint;
    end SR;
     
    RishiD, Oct 29, 2006
    #1
    1. Advertising

  2. RishiD

    phong

    Joined:
    Oct 26, 2006
    Messages:
    1
    achitecture SR of SRFF is
    signal Qint : STD_LOGIC;
    begin
    process (clk, reset) begin
    if (reset = '1') then
    Qint <= '0'; -- or '1';
    elsif (clk'event AND clk = '1') then
    if (s = '1') then Qint <= '1';
    else Qint <= Qint;
    end if;
    end if;
    end process;
    Q <= Qint;
    end SR;
     
    phong, Oct 29, 2006
    #2
    1. Advertising

  3. RishiD schrieb:

    > Just started learning VHDL, and trying to code up a S-R Flip flop with
    > async reset.


    SR-flipflop? Unfortunately there is no unique meaning behind this word.

    Usually it is called RS-flipflop. Unfortunately a lot of professors do
    not mean and edge-sensitive register (a flipflop) with this, but a
    "RS-latch" - a level sensitive register.

    If you really mean a flipflop there is the possibility of
    * both async set and reset
    * one async set or reset and one sync reset or set
    * both sync set and reset.

    > process (clk, reset) begin
    > if (reset = '1' and s = '1') then
    > Qint <= 'X';
    > elsif (reset = '1' and s = '0') then
    > Qint <= '0';
    > elsif (clk'event AND clk = '1') then
    > if (s = '1') then
    > Qint <= '1';
    > end if;
    > end if;
    > end process;


    You try to model a flipflop with async reset and sync set. But why do
    you try to assign an 'X' to Qint if the synchronous set and the
    asynchronous reset are active? For the RS-latch it is forbidden to
    activate the async set and the async reset simultaneously. But for a
    flipflop?

    Furthermore two RS-latches forming a master/slave flipflop are quite
    uncommon in todays cell libraries. D-type flipflops are common.

    -- D-flipflop with async set+reset and sync set/reset:
    process (clk, async_reset, async_set) begin
    if (async_reset='1') then
    Qint <= '0';
    elsif (async_set = '1') then
    Qint <= '1';
    elsif (clk'event AND clk = '1') then
    if (sync_set = '1') then
    Qint <= '1';
    elsif (sync_reset='1') then
    Qint <='0';
    else
    Qint <= data_in;
    end if;
    end if;


    Ralf
     
    Ralf Hildebrandt, Oct 30, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    Flip Flop Synchronization

    John, Jan 3, 2004, in forum: VHDL
    Replies:
    3
    Views:
    9,723
    valentin tihomirov
    Jan 5, 2004
  2. eric
    Replies:
    15
    Views:
    1,455
  3. Weng Tianxiang

    IC area of flip-flop and SRAM?

    Weng Tianxiang, May 19, 2004, in forum: VHDL
    Replies:
    1
    Views:
    1,188
    Samuel Fuhrer
    May 23, 2004
  4. Weng Tianxiang

    Best book on a flip flop circuit

    Weng Tianxiang, May 19, 2004, in forum: VHDL
    Replies:
    1
    Views:
    821
    Mike Treseler
    May 20, 2004
  5. Jim

    Tristate Flip Flop

    Jim, Oct 27, 2004, in forum: VHDL
    Replies:
    12
    Views:
    4,893
    Ho. Li
    Nov 18, 2004
Loading...

Share This Page