Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

SRFF VHDL implementation

Altera_Forum
Honored Contributor II
1,886 Views

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?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
790 Views

The "design" is working correctly for me in Quartus simulator.

0 Kudos
Altera_Forum
Honored Contributor II
790 Views

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.
0 Kudos
Reply