Forum Discussion

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

SRFF VHDL implementation

Hello.

I'm trying to build SR flip-flop with VHDL. Here is the code:

entity first is

port(s,r:in bit;q,nq:buffer bit);

end first;

architecture first_arc of first is

begin

nq<=not (s or q);

q<=not (r or nq);

end first_arc;

Very simple.

However, while inputs change through simulation time range (in vector waveform file), Quartus simulator returns all outputs zeros, with no regard to the inputs.

When I set the inputs to constant value through the simulation time, it works properly.

I've tried functional simulation as well as time simulation. I've got the same result.

What's the reason for such results?

2 Replies

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

    This code is no safe in fpgas at all.

    1) combinatorial feedback not recommended.

    2) latches not recommended in rtl

    3) buffer is not used except in Uni lectures.

    4) if you want register, just use single clked statement.